diff --git a/src/main/java/org/tron/api/BlockApiController.java b/src/main/java/org/tron/api/BlockApiController.java index f31f6f5..be03ecf 100644 --- a/src/main/java/org/tron/api/BlockApiController.java +++ b/src/main/java/org/tron/api/BlockApiController.java @@ -351,12 +351,15 @@ public Pair handlerBlockTransaction(BlockTransactionRequest blo } - private List removeBlackHole(List operations){ + private List removeUselessOperations(List operations){ List result = new LinkedList<>(); for (BalanceContract.TransactionBalanceTrace.Operation op : operations) { if (Arrays.equals(op.getAddress().toByteArray(),chainBaseManager.getAccountStore().getBlackholeAddress())) { continue; } + if (op.getAmount()==0) { + continue; + } result.add(op); } return result; @@ -454,23 +457,23 @@ private org.tron.model.Transaction toRosettaVmTx(BalanceContract.TransactionBala .transactionIdentifier(new org.tron.model.TransactionIdentifier() .hash(ByteArray.toHexString(transactionBalanceTrace.getTransactionIdentifier().toByteArray()))); //2. set operations - List operations = removeBlackHole(transactionBalanceTrace.getOperationList()); + List operations = removeUselessOperations(transactionBalanceTrace.getOperationList()); String feeAddress = ""; for (BalanceContract.TransactionBalanceTrace.Operation op : operations) { - if (op.getAmount() == -1 * energyFee) { + if (energyFee != 0 && op.getAmount() == -1 * energyFee) { feeAddress = encode58Check(op.getAddress().toByteArray()); fee += op.getAmount(); energyFee = 0; continue; } - if (op.getAmount() == -1 * netFee) { + if (netFee != 0 && op.getAmount() == -1 * netFee) { feeAddress = encode58Check(op.getAddress().toByteArray()); fee += op.getAmount(); netFee = 0; continue; } - if (op.getAmount() == -1 * multiSignFee) { + if (multiSignFee != 0 && op.getAmount() == -1 * multiSignFee) { feeAddress = encode58Check(op.getAddress().toByteArray()); fee += op.getAmount(); multiSignFee = 0; @@ -501,7 +504,7 @@ private org.tron.model.Transaction toRosettaOtherTx(BalanceContract.TransactionB .transactionIdentifier(new org.tron.model.TransactionIdentifier() .hash(ByteArray.toHexString(transactionBalanceTrace.getTransactionIdentifier().toByteArray()))); - List operations = removeBlackHole(transactionBalanceTrace.getOperationList()); + List operations = removeUselessOperations(transactionBalanceTrace.getOperationList()); int transactionCount = getTransOperationCount(transaction.getInstance().getRawData().getContract(0)); int feeOperationCount = operations.size() - transactionCount; if (transactionBalanceTrace.getType().equals(ContractType.MarketSellAssetContract.name()) ||