Program: 35126
Project: 35126
Buggy source:
@Override @DbSession public void rollback(CoinData coinData,Transaction tx){
  UtxoData utxoData=(UtxoData)coinData;
  if (utxoData == null) {
    return;
  }
  Set<String> addressSet=new HashSet<>();
  if (TxStatusEnum.AGREED.equals(tx.getStatus())) {
    for (    UtxoInput input : utxoData.getInputs()) {
      UtxoOutput from=ledgerCacheService.getUtxo(input.getKey());
      if (from != null) {
        if (from.getStatus() == OutPutStatusEnum.UTXO_SPENT) {
          from.setStatus(OutPutStatusEnum.UTXO_CONFIRM_UNSPEND);
        }
 else         if (from.getStatus() == OutPutStatusEnum.UTXO_CONFIRM_SPEND) {
          from.setStatus(OutPutStatusEnum.UTXO_CONFIRM_UNSPEND);
        }
 else         if (from.getStatus() == OutPutStatusEnum.UTXO_UNCONFIRM_SPEND) {
          from.setStatus(OutPutStatusEnum.UTXO_UNCONFIRM_UNSPEND);
        }
        addressSet.add(from.getAddress());
      }
    }
    for (int i=utxoData.getOutputs().size() - 1; i >= 0; i--) {
      UtxoOutput output=utxoData.getOutputs().get(i);
      ledgerCacheService.removeUtxo(output.getKey());
      addressSet.add(output.getAddress());
    }
  }
 else   if (tx.getStatus().equals(TxStatusEnum.CONFIRMED)) {
    outputDataService.deleteByHash(tx.getHash().getDigestHex());
    for (int i=utxoData.getOutputs().size() - 1; i >= 0; i--) {
      UtxoOutput output=utxoData.getOutputs().get(i);
      ledgerCacheService.removeUtxo(output.getKey());
      addressSet.add(output.getAddress());
    }
    inputDataService.deleteByHash(tx.getHash().getDigestHex());
    Map<String,Object> keyMap=new HashMap<>();
    for (int i=utxoData.getInputs().size() - 1; i >= 0; i--) {
      UtxoInput input=utxoData.getInputs().get(i);
      keyMap.clear();
      keyMap.put("String_Node_Str",input.getFromHash().getDigestHex());
      keyMap.put("String_Node_Str",input.getFromIndex());
      UtxoOutputPo outputPo=outputDataService.get(keyMap);
      outputPo.setStatus(UtxoOutputPo.USABLE);
      outputDataService.updateStatus(outputPo);
      addressSet.add(outputPo.getAddress());
      UtxoOutput output=UtxoTransferTool.toOutput(outputPo);
      ledgerCacheService.putUtxo(output.getKey(),output);
    }
    relationDataService.deleteRelation(tx.getHash().getDigestHex(),addressSet);
  }
  for (  String address : addressSet) {
    UtxoTransactionTool.getInstance().calcBalance(address,false);
  }
}

Fixed version (ground truth):
@Override @DbSession public void rollback(CoinData coinData,Transaction tx){
  UtxoData utxoData=(UtxoData)coinData;
  if (utxoData == null) {
    return;
  }
  Set<String> addressSet=new HashSet<>();
  if (TxStatusEnum.AGREED.equals(tx.getStatus())) {
    for (    UtxoInput input : utxoData.getInputs()) {
      UtxoOutput from=ledgerCacheService.getUtxo(input.getKey());
      if (from != null) {
        if (from.getStatus() == OutPutStatusEnum.UTXO_SPENT) {
          from.setStatus(OutPutStatusEnum.UTXO_CONFIRMED_UNSPENT);
        }
 else         if (from.getStatus() == OutPutStatusEnum.UTXO_CONFIRMED_SPENT) {
          from.setStatus(OutPutStatusEnum.UTXO_CONFIRMED_UNSPENT);
        }
 else         if (from.getStatus() == OutPutStatusEnum.UTXO_UNCONFIRMED_SPENT) {
          from.setStatus(OutPutStatusEnum.UTXO_UNCONFIRMED_UNSPENT);
        }
        addressSet.add(from.getAddress());
      }
    }
    for (int i=utxoData.getOutputs().size() - 1; i >= 0; i--) {
      UtxoOutput output=utxoData.getOutputs().get(i);
      ledgerCacheService.removeUtxo(output.getKey());
      addressSet.add(output.getAddress());
    }
  }
 else   if (tx.getStatus().equals(TxStatusEnum.CONFIRMED)) {
    outputDataService.deleteByHash(tx.getHash().getDigestHex());
    for (int i=utxoData.getOutputs().size() - 1; i >= 0; i--) {
      UtxoOutput output=utxoData.getOutputs().get(i);
      ledgerCacheService.removeUtxo(output.getKey());
      addressSet.add(output.getAddress());
    }
    inputDataService.deleteByHash(tx.getHash().getDigestHex());
    Map<String,Object> keyMap=new HashMap<>();
    for (int i=utxoData.getInputs().size() - 1; i >= 0; i--) {
      UtxoInput input=utxoData.getInputs().get(i);
      keyMap.clear();
      keyMap.put("String_Node_Str",input.getFromHash().getDigestHex());
      keyMap.put("String_Node_Str",input.getFromIndex());
      UtxoOutputPo outputPo=outputDataService.get(keyMap);
      outputPo.setStatus(UtxoOutputPo.USABLE);
      outputDataService.updateStatus(outputPo);
      addressSet.add(outputPo.getAddress());
      UtxoOutput output=UtxoTransferTool.toOutput(outputPo);
      ledgerCacheService.putUtxo(output.getKey(),output);
    }
    relationDataService.deleteRelation(tx.getHash().getDigestHex(),addressSet);
  }
  for (  String address : addressSet) {
    UtxoTransactionTool.getInstance().calcBalance(address,false);
  }
}