File tree Expand file tree Collapse file tree 6 files changed +29
-4
lines changed
test/java/org/tron/core/db Expand file tree Collapse file tree 6 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -925,7 +925,6 @@ public void setResult(Runtime runtime) {
925
925
return ;
926
926
}
927
927
this .setResultCode (contractResult .UNKNOWN );
928
- return ;
929
928
}
930
929
931
930
public void setResultCode (contractResult code ) {
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 @@ -135,11 +135,11 @@ public class Args {
135
135
private String storageDbEngine = "" ;
136
136
137
137
@ Parameter (names = {
138
- "--storage-db-synchronous" }, description = "Storage db is synchronous or not.(true or flase )" )
138
+ "--storage-db-synchronous" }, description = "Storage db is synchronous or not.(true or false )" )
139
139
private String storageDbSynchronous = "" ;
140
140
141
141
@ Parameter (names = {
142
- "--contract-parse-enable" }, description = "enable contract parses in java-tron or not.(true or flase )" )
142
+ "--contract-parse-enable" }, description = "enable contract parses in java-tron or not.(true or false )" )
143
143
private String contractParseEnable = "" ;
144
144
145
145
@ Parameter (names = {"--storage-index-directory" }, description = "Storage index directory" )
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 @@ -39,10 +39,15 @@ public TransactionInfoCapsule getTransactionInfo(byte[] key) throws BadItemExcep
39
39
return null ;
40
40
}
41
41
byte [] value = revokingDB .getUnchecked (ByteArray .fromLong (blockNumber ));
42
+ if (Objects .isNull (value )) {
43
+ return null ;
44
+ }
45
+
42
46
TransactionRetCapsule result = new TransactionRetCapsule (value );
43
47
if (Objects .isNull (result ) || Objects .isNull (result .getInstance ())) {
44
48
return null ;
45
49
}
50
+
46
51
for (TransactionInfo transactionResultInfo : result .getInstance ().getTransactioninfoList ()) {
47
52
if (transactionResultInfo .getId ().equals (ByteString .copyFrom (key ))) {
48
53
return new TransactionInfoCapsule (transactionResultInfo );
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