Skip to content
Open
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
10 changes: 10 additions & 0 deletions actuator/src/main/java/org/tron/core/vm/program/Program.java
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,11 @@ this, new DataWord(newAddress), getContractAddress(), value, DataWord.ZERO(),
// 4. CREATE THE CONTRACT OUT OF RETURN
byte[] code = createResult.getHReturn();

// capture output (deployed code) on internal transaction for indexing
if (internalTx != null) {
internalTx.setOutput(code);
}

if (code.length != 0 && VMConfig.allowTvmLondon() && code[0] == (byte) 0xEF) {
createResult.setException(Program.Exception
.invalidCodeException());
Expand Down Expand Up @@ -1083,6 +1088,11 @@ this, new DataWord(contextAddress),
memorySaveLimited(offset, buffer, size);

returnDataBuffer = buffer;

// capture output on internal transaction for indexing
if (internalTx != null) {
internalTx.setOutput(buffer);
}
}

// 5. REFUND THE REMAIN ENERGY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ public class InternalTransaction {
*/
private String extra;

/*
* output/return data of the internal call
*/
private byte[] output;


/**
* Construct a root InternalTransaction
Expand Down Expand Up @@ -219,6 +224,17 @@ public String getExtra() {
return extra == null ? "" : extra;
}

public void setOutput(byte[] output) {
this.output = output;
}

public byte[] getOutput() {
if (output == null) {
return EMPTY_BYTE_ARRAY;
}
return output.clone();
}

public final byte[] getHash() {
if (!isEmpty(hash)) {
return Arrays.copyOf(hash, hash.length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ public static Protocol.InternalTransaction buildInternalTransaction(InternalTran
itBuilder.setNote(ByteString.copyFrom(it.getNote().getBytes()));
itBuilder.setRejected(it.isRejected());
itBuilder.setExtra(it.getExtra());
itBuilder.setData(ByteString.copyFrom(it.getData()));
itBuilder.setOutput(ByteString.copyFrom(it.getOutput()));
return itBuilder.build();
}

Expand Down
4 changes: 4 additions & 0 deletions protocol/src/main/protos/core/Tron.proto
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,10 @@ message InternalTransaction {
bytes note = 5;
bool rejected = 6;
string extra = 7;
// Input data of the internal transaction
bytes data = 8;
// Output/return data of the internal transaction
bytes output = 9;
}

message DelegatedResourceAccountIndex {
Expand Down