Skip to content

Commit

Permalink
feature: adjust printed info for constant trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
yanghang8612 committed Aug 30, 2021
1 parent f87ee8a commit 7e7d13d
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/main/java/org/tron/walletserver/WalletApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -2178,15 +2178,13 @@ public boolean triggerContract(
Transaction transaction = transactionExtention
.getTransaction();
// for constant
if (transaction.getRetCount() != 0
&& transactionExtention.getConstantResult(0) != null
&& transactionExtention.getResult() != null) {
byte[] result = transactionExtention.getConstantResult(0).toByteArray();
System.out.println("message:" + transaction.getRet(0).getRet());
System.out.println(
":" + ByteArray.toStr(transactionExtention.getResult().getMessage().toByteArray()));
System.out.println("Result:" + Hex.toHexString(result));
System.out.println("EnergyUsed:" + transactionExtention.getEnergyUsed());
if (transaction.getRetCount() != 0) {
TransactionExtention.Builder builder =
transactionExtention.toBuilder().clearTransaction().clearTxid();
if (transaction.getRet(0).getRet() == Result.code.FAILED) {
builder.setResult(builder.getResult().toBuilder().setResult(false));
}
System.out.println("Execution result = " + Utils.formatMessageString(builder.build()));
return true;
}

Expand Down

0 comments on commit 7e7d13d

Please sign in to comment.