Program: 34972
Project: 34972
Buggy source:
/** 
 * 获取未确认的交易
 */
private Result getUnconfirmedTx(String hash){
  Result result=null;
  try {
    Result<Transaction> txResult=accountLedgerService.getUnconfirmedTransaction(NulsDigestData.fromDigestHex(hash));
    if (txResult.isFailed() || null == txResult.getData()) {
      result=Result.getFailed(LedgerErrorCode.DATA_NOT_FOUND);
    }
 else {
      Transaction tx=txResult.getData();
      tx.setStatus(TxStatusEnum.CONFIRMED);
      TransactionDto txDto=null;
      CoinData coinData=tx.getCoinData();
      if (coinData != null) {
        List<Coin> froms=coinData.getFrom();
        if (froms != null && froms.size() > 0) {
          byte[] fromHash, owner;
          int fromIndex;
          NulsDigestData fromHashObj;
          Transaction fromTx;
          Coin fromUtxo;
          for (          Coin from : froms) {
            owner=from.getOwner();
            fromHash=AccountLegerUtils.getTxHashBytes(owner);
            fromIndex=AccountLegerUtils.getIndex(owner);
            fromHashObj=new NulsDigestData();
            fromHashObj.parse(fromHash,0);
            fromTx=accountLedgerService.getUnconfirmedTransaction(fromHashObj).getData();
            if (null == fromTx) {
              fromTx=ledgerService.getTx(fromHashObj);
            }
            fromUtxo=fromTx.getCoinData().getTo().get(fromIndex);
            from.setFrom(fromUtxo);
          }
        }
        txDto=new TransactionDto(tx);
        List<OutputDto> outputDtoList=new ArrayList<>();
        List<Coin> tos=coinData.getTo();
        if (tos != null && tos.size() > 0) {
          byte[] txHashBytes=tx.getHash().serialize();
          String txHash=hash;
          OutputDto outputDto=null;
          Coin to, temp;
          long bestHeight=NulsContext.getInstance().getBestHeight();
          long currentTime=TimeService.currentTimeMillis();
          long lockTime;
          for (int i=0, length=tos.size(); i < length; i++) {
            to=tos.get(i);
            outputDto=new OutputDto(to);
            outputDto.setTxHash(txHash);
            outputDto.setIndex(i);
            temp=ledgerService.getUtxo(Arrays.concatenate(txHashBytes,new VarInt(i).encode()));
            if (temp == null) {
              outputDto.setStatus(3);
            }
 else {
              lockTime=temp.getLockTime();
              if (lockTime < 0) {
                outputDto.setStatus(2);
              }
 else               if (lockTime == 0) {
                outputDto.setStatus(0);
              }
 else               if (lockTime > NulsConstant.BlOCKHEIGHT_TIME_DIVIDE) {
                if (lockTime > currentTime) {
                  outputDto.setStatus(1);
                }
 else {
                  outputDto.setStatus(0);
                }
              }
 else {
                if (lockTime > bestHeight) {
                  outputDto.setStatus(1);
                }
 else {
                  outputDto.setStatus(0);
                }
              }
            }
            outputDtoList.add(outputDto);
          }
        }
        txDto.setOutputs(outputDtoList);
        calTransactionValue(txDto);
      }
      result=Result.getSuccess();
      result.setData(txDto);
    }
  }
 catch (  NulsRuntimeException re) {
    Log.error(re);
    result=Result.getFailed(re.getErrorCode());
  }
catch (  Exception e) {
    Log.error(e);
    result=Result.getFailed(LedgerErrorCode.SYS_UNKOWN_EXCEPTION);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * 获取未确认的交易
 */
private Result getUnconfirmedTx(String hash){
  Result result=null;
  try {
    Result<Transaction> txResult=accountLedgerService.getUnconfirmedTransaction(NulsDigestData.fromDigestHex(hash));
    if (txResult.isFailed() || null == txResult.getData()) {
      result=Result.getFailed(LedgerErrorCode.DATA_NOT_FOUND);
    }
 else {
      Transaction tx=txResult.getData();
      tx.setStatus(TxStatusEnum.UNCONFIRM);
      TransactionDto txDto=null;
      CoinData coinData=tx.getCoinData();
      if (coinData != null) {
        List<Coin> froms=coinData.getFrom();
        if (froms != null && froms.size() > 0) {
          byte[] fromHash, owner;
          int fromIndex;
          NulsDigestData fromHashObj;
          Transaction fromTx;
          Coin fromUtxo;
          for (          Coin from : froms) {
            owner=from.getOwner();
            fromHash=AccountLegerUtils.getTxHashBytes(owner);
            fromIndex=AccountLegerUtils.getIndex(owner);
            fromHashObj=new NulsDigestData();
            fromHashObj.parse(fromHash,0);
            fromTx=accountLedgerService.getUnconfirmedTransaction(fromHashObj).getData();
            if (null == fromTx) {
              fromTx=ledgerService.getTx(fromHashObj);
            }
            fromUtxo=fromTx.getCoinData().getTo().get(fromIndex);
            from.setFrom(fromUtxo);
          }
        }
        txDto=new TransactionDto(tx);
        List<OutputDto> outputDtoList=new ArrayList<>();
        List<Coin> tos=coinData.getTo();
        if (tos != null && tos.size() > 0) {
          byte[] txHashBytes=tx.getHash().serialize();
          String txHash=hash;
          OutputDto outputDto=null;
          Coin to, temp;
          long bestHeight=NulsContext.getInstance().getBestHeight();
          long currentTime=TimeService.currentTimeMillis();
          long lockTime;
          for (int i=0, length=tos.size(); i < length; i++) {
            to=tos.get(i);
            outputDto=new OutputDto(to);
            outputDto.setTxHash(txHash);
            outputDto.setIndex(i);
            temp=ledgerService.getUtxo(Arrays.concatenate(txHashBytes,new VarInt(i).encode()));
            if (temp == null) {
              outputDto.setStatus(3);
            }
 else {
              lockTime=temp.getLockTime();
              if (lockTime < 0) {
                outputDto.setStatus(2);
              }
 else               if (lockTime == 0) {
                outputDto.setStatus(0);
              }
 else               if (lockTime > NulsConstant.BlOCKHEIGHT_TIME_DIVIDE) {
                if (lockTime > currentTime) {
                  outputDto.setStatus(1);
                }
 else {
                  outputDto.setStatus(0);
                }
              }
 else {
                if (lockTime > bestHeight) {
                  outputDto.setStatus(1);
                }
 else {
                  outputDto.setStatus(0);
                }
              }
            }
            outputDtoList.add(outputDto);
          }
        }
        txDto.setOutputs(outputDtoList);
        calTransactionValue(txDto);
      }
      result=Result.getSuccess();
      result.setData(txDto);
    }
  }
 catch (  NulsRuntimeException re) {
    Log.error(re);
    result=Result.getFailed(re.getErrorCode());
  }
catch (  Exception e) {
    Log.error(e);
    result=Result.getFailed(LedgerErrorCode.SYS_UNKOWN_EXCEPTION);
  }
  return result;
}