mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 01:13:45 +00:00
core/vm: fixed clearing issue on return data
This commit is contained in:
parent
edf95ec610
commit
797172bfe8
2 changed files with 26 additions and 21 deletions
|
|
@ -231,9 +231,9 @@ func (in *Interpreter) Run(snapshot int, contract *Contract, input []byte) (ret
|
|||
case !operation.jumps:
|
||||
pc++
|
||||
}
|
||||
// if the operation returned a value make sure that is also set
|
||||
// the last return data.
|
||||
if res != nil {
|
||||
// if the operation clears the return data (e.g. it has returning data)
|
||||
// set the last return to the result of the operation.
|
||||
if operation.clearsReturndata {
|
||||
in.returnData = res
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ type operation struct {
|
|||
valid bool
|
||||
// reverts determined whether the operation reverts state
|
||||
reverts bool
|
||||
// clearsReturndata determines whether the opertions clears the return data
|
||||
clearsReturndata bool
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
@ -887,6 +889,7 @@ func NewFrontierInstructionSet() [256]operation {
|
|||
memorySize: memoryCreate,
|
||||
valid: true,
|
||||
writes: true,
|
||||
clearsReturndata: true,
|
||||
},
|
||||
CALL: {
|
||||
execute: opCall,
|
||||
|
|
@ -894,6 +897,7 @@ func NewFrontierInstructionSet() [256]operation {
|
|||
validateStack: makeStackFunc(7, 1),
|
||||
memorySize: memoryCall,
|
||||
valid: true,
|
||||
clearsReturndata: true,
|
||||
},
|
||||
CALLCODE: {
|
||||
execute: opCallCode,
|
||||
|
|
@ -901,6 +905,7 @@ func NewFrontierInstructionSet() [256]operation {
|
|||
validateStack: makeStackFunc(7, 1),
|
||||
memorySize: memoryCall,
|
||||
valid: true,
|
||||
clearsReturndata: true,
|
||||
},
|
||||
RETURN: {
|
||||
execute: opReturn,
|
||||
|
|
|
|||
Loading…
Reference in a new issue