From 2a45ffe555ec47998086498f646264a5dac63b59 Mon Sep 17 00:00:00 2001 From: mikeluxue Date: Wed, 17 May 2023 16:42:43 +0800 Subject: [PATCH] feat(ApiWrapper):fix getTransactionFromPending bug --- .../src/main/java/org/tron/trident/core/ApiWrapper.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/trident-java/core/src/main/java/org/tron/trident/core/ApiWrapper.java b/trident-java/core/src/main/java/org/tron/trident/core/ApiWrapper.java index 368da00..66645c6 100644 --- a/trident-java/core/src/main/java/org/tron/trident/core/ApiWrapper.java +++ b/trident-java/core/src/main/java/org/tron/trident/core/ApiWrapper.java @@ -15,6 +15,7 @@ import org.tron.trident.core.key.KeyPair; import org.tron.trident.core.transaction.BlockId; import org.tron.trident.core.transaction.TransactionBuilder; +import org.tron.trident.core.utils.ByteArray; import org.tron.trident.core.utils.Sha256Hash; import org.tron.trident.core.transaction.TransactionCapsule; import org.tron.trident.core.utils.Utils; @@ -1914,15 +1915,12 @@ public long getPendingSize() { * @throws IllegalException if fail to get transaction from pending */ public Transaction getTransactionFromPending(String txId) throws IllegalException { - ByteString bsTxid = parseAddress(txId); + ByteString bsTxid = ByteString.copyFrom(ByteArray.fromHexString(txId)); BytesMessage request = BytesMessage.newBuilder() .setValue(bsTxid) .build(); - Transaction transaction = blockingStubSolidity.getTransactionById(request); - if(transaction.getRetCount() == 0){ - throw new IllegalException(); - } + Transaction transaction = blockingStub.getTransactionFromPending(request); return transaction; }