mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 04:36:42 +00:00
Add refund support in JitVm
This commit is contained in:
parent
91c0a80d34
commit
6a89bdc07a
1 changed files with 7 additions and 0 deletions
|
|
@ -207,6 +207,13 @@ func env_sstore(vmPtr unsafe.Pointer, indexPtr unsafe.Pointer, valuePtr unsafe.P
|
||||||
index := llvm2hash(bswap((*i256)(indexPtr)))
|
index := llvm2hash(bswap((*i256)(indexPtr)))
|
||||||
value := llvm2hash(bswap((*i256)(valuePtr)))
|
value := llvm2hash(bswap((*i256)(valuePtr)))
|
||||||
value = trim(value)
|
value = trim(value)
|
||||||
|
if len(value) == 0 {
|
||||||
|
prevValue := vm.env.State().GetState(vm.me.Address(), index)
|
||||||
|
if len(prevValue) != 0 {
|
||||||
|
vm.Env().State().Refund(vm.callerAddr, GasSStoreRefund)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
vm.env.State().SetState(vm.me.Address(), index, value)
|
vm.env.State().SetState(vm.me.Address(), index, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue