mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
Encode only if condition permit
This commit is contained in:
parent
941ae33d7e
commit
9489438515
1 changed files with 3 additions and 4 deletions
|
|
@ -236,11 +236,10 @@ func (l *StructLogger) GetResult() (json.RawMessage, error) {
|
|||
return nil, l.reason
|
||||
}
|
||||
failed := l.err != nil
|
||||
returnData := common.CopyBytes(l.output)
|
||||
var returnVal string
|
||||
// Return data when successful and revert reason when reverted, otherwise empty.
|
||||
returnVal := fmt.Sprintf("%x", returnData)
|
||||
if failed && l.err != vm.ErrExecutionReverted {
|
||||
returnVal = ""
|
||||
if !failed || l.err == vm.ErrExecutionReverted {
|
||||
returnVal = hexutil.Encode(l.output)
|
||||
}
|
||||
return json.Marshal(&ExecutionResult{
|
||||
Gas: l.usedGas,
|
||||
|
|
|
|||
Loading…
Reference in a new issue