Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,6 @@ public void setResult(Runtime runtime) {
return;
}
this.setResultCode(contractResult.UNKNOWN);
return;
}

public void setResultCode(contractResult code) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public void addTransactionInfo(TransactionInfo result) {

@Override
public byte[] getData() {
if (Objects.isNull(transactionRet)) {
return null;
}
return transactionRet.toByteArray();
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/tron/core/config/args/Args.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ public class Args {
private String storageDbEngine = "";

@Parameter(names = {
"--storage-db-synchronous"}, description = "Storage db is synchronous or not.(true or flase)")
"--storage-db-synchronous"}, description = "Storage db is synchronous or not.(true or false)")
private String storageDbSynchronous = "";

@Parameter(names = {
"--contract-parse-enable"}, description = "enable contract parses in java-tron or not.(true or flase)")
"--contract-parse-enable"}, description = "enable contract parses in java-tron or not.(true or false)")
private String contractParseEnable = "";

@Parameter(names = {"--storage-index-directory"}, description = "Storage index directory")
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/org/tron/core/db/Manager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,10 @@ public synchronized BlockCapsule generateBlock(
tmpSeesion.merge();
// push into block
blockCapsule.addTransaction(trx);
transationRetCapsule.addTransactionInfo(result);

if (Objects.nonNull(result)) {
transationRetCapsule.addTransactionInfo(result);
}
if (fromPending) {
iterator.remove();
}
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/tron/core/db/TransactionRetStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,15 @@ public TransactionInfoCapsule getTransactionInfo(byte[] key) throws BadItemExcep
return null;
}
byte[] value = revokingDB.getUnchecked(ByteArray.fromLong(blockNumber));
if (Objects.isNull(value)) {
return null;
}

TransactionRetCapsule result = new TransactionRetCapsule(value);
if (Objects.isNull(result) || Objects.isNull(result.getInstance())) {
return null;
}

for (TransactionInfo transactionResultInfo : result.getInstance().getTransactioninfoList()) {
if (transactionResultInfo.getId().equals(ByteString.copyFrom(key))) {
return new TransactionInfoCapsule(transactionResultInfo);
Expand Down
15 changes: 15 additions & 0 deletions src/test/java/org/tron/core/db/TransactionRetStoreTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,19 @@ public void get() throws BadItemException {
TransactionInfoCapsule resultCapsule = transactionRetStore.getTransactionInfo(transactionId);
Assert.assertNotNull("get transaction ret store", resultCapsule);
}

@Test
public void put() {
TransactionInfoCapsule transactionInfoCapsule = new TransactionInfoCapsule();
transactionInfoCapsule.setId(transactionId);
transactionInfoCapsule.setFee(1000L);
transactionInfoCapsule.setBlockNumber(100L);
transactionInfoCapsule.setBlockTimeStamp(200L);

TransactionRetCapsule transactionRetCapsule = new TransactionRetCapsule();
transactionRetCapsule.addTransactionInfo(transactionInfoCapsule.getInstance());
Assert.assertNull("put transaction info error", transactionRetStore.getUnchecked(transactionInfoCapsule.getId()));
transactionRetStore.put(transactionInfoCapsule.getId(), transactionRetCapsule);
Assert.assertNotNull("get transaction info error", transactionRetStore.getUnchecked(transactionInfoCapsule.getId()));
}
}