@@ -164,23 +164,6 @@ public void init() {
164164 dbManager .getTransactionStore ()
165165 .put (transactionCapsule3 .getTransactionId ().getBytes (), transactionCapsule3 );
166166
167- blockCapsule0 .getTransactions ().forEach (tx -> {
168- TransactionCapsule transactionCapsule = new TransactionCapsule (tx .getInstance ());
169- transactionCapsule .setBlockNum (blockCapsule0 .getNum ());
170- dbManager .getTransactionStore ()
171- .put (transactionCapsule .getTransactionId ().getBytes (), transactionCapsule );
172- });
173-
174- TransactionRetCapsule transactionRetCapsule0 = new TransactionRetCapsule ();
175- blockCapsule0 .getTransactions ().forEach (tx -> {
176- TransactionInfoCapsule transactionInfoCapsule = new TransactionInfoCapsule ();
177- transactionInfoCapsule .setId (tx .getTransactionId ().getBytes ());
178- transactionInfoCapsule .setBlockNumber (blockCapsule0 .getNum ());
179- transactionRetCapsule0 .addTransactionInfo (transactionInfoCapsule .getInstance ());
180- });
181- dbManager .getTransactionRetStore ().put (
182- ByteArray .fromLong (blockCapsule0 .getNum ()), transactionRetCapsule0 );
183-
184167 List <Protocol .TransactionInfo .Log > logs = new ArrayList <>();
185168 logs .add (Protocol .TransactionInfo .Log .newBuilder ()
186169 .setAddress (ByteString .copyFrom ("address1" .getBytes ()))
@@ -340,6 +323,8 @@ public void testGetBlockByNumber() {
340323 }
341324 Assert .assertEquals (ByteArray .toJsonHex (0L ), blockResult .getNumber ());
342325 Assert .assertEquals (ByteArray .toJsonHex (blockCapsule0 .getNum ()), blockResult .getNumber ());
326+ Assert .assertEquals (blockResult .getTransactions ().length ,
327+ blockCapsule0 .getTransactions ().size ());
343328
344329 // latest
345330 try {
@@ -1048,7 +1033,7 @@ public void testGetBlockReceipts() {
10481033
10491034 try {
10501035 List <TransactionReceipt > transactionReceiptList = tronJsonRpc .getBlockReceipts ("earliest" );
1051- Assert .assertFalse (transactionReceiptList . isEmpty () );
1036+ Assert .assertNull (transactionReceiptList );
10521037 } catch (JsonRpcInvalidParamsException | JsonRpcInternalException e ) {
10531038 throw new RuntimeException (e );
10541039 }
@@ -1088,6 +1073,20 @@ public void testGetBlockReceipts() {
10881073 throw new RuntimeException (e );
10891074 }
10901075
1076+ try {
1077+ String blockHash = blockCapsule1 .getBlockId ().toString ();
1078+ List <TransactionReceipt > transactionReceiptList
1079+ = tronJsonRpc .getBlockReceipts (blockHash );
1080+ List <TransactionReceipt > transactionReceiptList2
1081+ = tronJsonRpc .getBlockReceipts ("0x" + blockHash );
1082+
1083+ Assert .assertFalse (transactionReceiptList .isEmpty ());
1084+ Assert .assertEquals (JSON .toJSONString (transactionReceiptList ),
1085+ JSON .toJSONString (transactionReceiptList2 ));
1086+ } catch (JsonRpcInvalidParamsException | JsonRpcInternalException e ) {
1087+ throw new RuntimeException (e );
1088+ }
1089+
10911090 }
10921091
10931092 @ Test
0 commit comments