File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed
test/java/org/tron/core/db Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,9 @@ public void addTransactionInfo(TransactionInfo result) {
40
40
41
41
@ Override
42
42
public byte [] getData () {
43
+ if (Objects .isNull (transactionRet )) {
44
+ return null ;
45
+ }
43
46
return transactionRet .toByteArray ();
44
47
}
45
48
Original file line number Diff line number Diff line change @@ -1389,7 +1389,10 @@ public synchronized BlockCapsule generateBlock(
1389
1389
tmpSeesion .merge ();
1390
1390
// push into block
1391
1391
blockCapsule .addTransaction (trx );
1392
- transationRetCapsule .addTransactionInfo (result );
1392
+
1393
+ if (Objects .nonNull (result )) {
1394
+ transationRetCapsule .addTransactionInfo (result );
1395
+ }
1393
1396
if (fromPending ) {
1394
1397
iterator .remove ();
1395
1398
}
Original file line number Diff line number Diff line change @@ -73,4 +73,19 @@ public void get() throws BadItemException {
73
73
TransactionInfoCapsule resultCapsule = transactionRetStore .getTransactionInfo (transactionId );
74
74
Assert .assertNotNull ("get transaction ret store" , resultCapsule );
75
75
}
76
+
77
+ @ Test
78
+ public void put () {
79
+ TransactionInfoCapsule transactionInfoCapsule = new TransactionInfoCapsule ();
80
+ transactionInfoCapsule .setId (transactionId );
81
+ transactionInfoCapsule .setFee (1000L );
82
+ transactionInfoCapsule .setBlockNumber (100L );
83
+ transactionInfoCapsule .setBlockTimeStamp (200L );
84
+
85
+ TransactionRetCapsule transactionRetCapsule = new TransactionRetCapsule ();
86
+ transactionRetCapsule .addTransactionInfo (transactionInfoCapsule .getInstance ());
87
+ Assert .assertNull ("put transaction info error" , transactionRetStore .getUnchecked (transactionInfoCapsule .getId ()));
88
+ transactionRetStore .put (transactionInfoCapsule .getId (), transactionRetCapsule );
89
+ Assert .assertNotNull ("get transaction info error" , transactionRetStore .getUnchecked (transactionInfoCapsule .getId ()));
90
+ }
76
91
}
You can’t perform that action at this time.
0 commit comments