Skip to content

Commit a3b417b

Browse files
author
wubin1
committed
fix bug
1 parent a4bf566 commit a3b417b

4 files changed

Lines changed: 9 additions & 7 deletions

File tree

‎src/main/java/org/tron/core/Wallet.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,7 @@ public TransactionInfo getTransactionInfoById(ByteString transactionId) {
12451245
return null;
12461246
}
12471247

1248-
return transactionInfoCapsule.getInstance();
1248+
return transactionInfoCapsule == null ? null : transactionInfoCapsule.getInstance();
12491249
}
12501250

12511251
public Proposal getProposalById(ByteString proposalId) {

‎src/main/java/org/tron/core/db/Manager.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,9 @@ public void processBlock(BlockCapsule block)
15391539
accountStateCallBack.preExeTrans();
15401540
TransactionInfo result = processTransaction(transactionCapsule, block);
15411541
accountStateCallBack.exeTransFinish();
1542-
Optional.ofNullable(result).ifPresent(t -> transationRetCapsule.addTransactionInfo(result));
1542+
if (Objects.nonNull(result)) {
1543+
transationRetCapsule.addTransactionInfo(result);
1544+
}
15431545
}
15441546
accountStateCallBack.executePushFinish();
15451547
} finally {

‎src/main/java/org/tron/core/db/TransactionRetStore.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public TransactionInfoCapsule getTransactionInfo(byte[] key) throws BadItemExcep
3333
}
3434
byte[] value = revokingDB.getUnchecked(ByteArray.fromLong(blockNumber));
3535
TransactionRetCapsule result = new TransactionRetCapsule(value);
36-
if (Objects.isNull(result)) {
36+
if (Objects.isNull(result) || Objects.isNull(result.getInstance())) {
3737
return null;
3838
}
3939
for (TransactionInfo transactionResultInfo : result.getInstance().getTransactioninfoList()) {

‎src/main/java/org/tron/core/db/TransactionStore.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,17 @@ private TransactionCapsule getTransactionFromKhaosDatabase(byte[] key, long high
6767
return null;
6868
}
6969

70-
public long getBlockNumber(byte[] key) {
70+
public long getBlockNumber(byte[] key) throws BadItemException {
7171
byte[] value = revokingDB.getUnchecked(key);
7272
if (ArrayUtils.isEmpty(value)) {
7373
return -1;
7474
}
75-
TransactionCapsule transactionCapsule = null;
75+
7676
if (value.length == 8) {
7777
return ByteArray.toLong(value);
7878
}
79-
80-
return transactionCapsule == null ? -1 : transactionCapsule.getBlockNum();
79+
TransactionCapsule transactionCapsule = new TransactionCapsule(value);
80+
return transactionCapsule.getBlockNum();
8181
}
8282

8383
@Override

0 commit comments

Comments
 (0)