[skip ci] collectTouchedAccounts reduction
This commit is contained in:
parent
20a138c270
commit
5e6018b20b
|
@ -13,9 +13,6 @@ proc processTransaction*(tx: Transaction, sender: EthAddress, vmState: BaseVMSta
|
|||
trace "Sender", sender
|
||||
trace "txHash", rlpHash = tx.rlpHash
|
||||
|
||||
if fork >= FkSpurious:
|
||||
vmState.touchedAccounts.incl(vmState.blockHeader.coinbase)
|
||||
|
||||
var gasUsed = tx.gasLimit
|
||||
var coinBaseSuicide = false
|
||||
|
||||
|
@ -61,11 +58,13 @@ proc processTransaction*(tx: Transaction, sender: EthAddress, vmState: BaseVMSta
|
|||
else:
|
||||
db.addBalance(vmState.blockHeader.coinbase, 0.u256)
|
||||
|
||||
# EIP158 state clearing
|
||||
for account in vmState.touchedAccounts:
|
||||
if db.accountExists(account) and db.isEmptyAccount(account):
|
||||
debug "state clearing", account
|
||||
db.deleteAccount(account)
|
||||
if fork >= FkSpurious:
|
||||
vmState.touchedAccounts.incl(vmState.blockHeader.coinbase)
|
||||
# EIP158/161 state clearing
|
||||
for account in vmState.touchedAccounts:
|
||||
if db.accountExists(account) and db.isEmptyAccount(account):
|
||||
debug "state clearing", account
|
||||
db.deleteAccount(account)
|
||||
|
||||
vmState.accountDb.updateOriginalRoot()
|
||||
result = gasUsed
|
||||
|
|
|
@ -210,6 +210,7 @@ proc addChildComputation*(computation: BaseComputation, child: BaseComputation)
|
|||
computation.logEntries.add child.logEntries
|
||||
computation.gasMeter.refundGas(child.gasMeter.gasRefunded)
|
||||
computation.suicides.incl child.suicides
|
||||
computation.touchedAccounts.incl child.touchedAccounts
|
||||
|
||||
if not child.shouldBurnGas:
|
||||
computation.gasMeter.returnGas(child.gasMeter.gasRemaining)
|
||||
|
@ -258,16 +259,6 @@ proc collectTouchedAccounts*(c: BaseComputation, output: var HashSet[EthAddress]
|
|||
let isIstanbul = c.getFork >= FkIstanbul
|
||||
let condition = c.isError or ancestorHadError
|
||||
|
||||
for beneficiary in c.touchedAccounts:
|
||||
if condition:
|
||||
# Special case to account for geth+parity bug
|
||||
# https://github.com/ethereum/EIPs/issues/716
|
||||
if beneficiary.cmpThree:
|
||||
output.incl beneficiary
|
||||
continue
|
||||
else:
|
||||
output.incl beneficiary
|
||||
|
||||
if not c.msg.isCreate:
|
||||
if condition:
|
||||
# Special case to account for geth+parity bug
|
||||
|
|
|
@ -79,6 +79,8 @@ proc execComputation*(computation: var BaseComputation) =
|
|||
|
||||
if computation.getFork >= FkSpurious:
|
||||
computation.collectTouchedAccounts(computation.vmState.touchedAccounts)
|
||||
if computation.isSuccess:
|
||||
computation.vmState.touchedAccounts.incl computation.touchedAccounts
|
||||
|
||||
computation.vmstate.status = computation.isSuccess
|
||||
if computation.isSuccess:
|
||||
|
|
Loading…
Reference in New Issue