mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-26 10:55:41 +00:00
turn getAccountsForDeletion into interator
This commit is contained in:
parent
b6587bddfd
commit
a02cbdd91b
@ -12,18 +12,6 @@ proc processTransaction*(tx: Transaction, sender: EthAddress, vmState: BaseVMSta
|
|||||||
trace "Sender", sender
|
trace "Sender", sender
|
||||||
trace "txHash", rlpHash = tx.rlpHash
|
trace "txHash", rlpHash = tx.rlpHash
|
||||||
|
|
||||||
# TODO: we have identical `fork` code in setupComputation.
|
|
||||||
# at later stage, we need to get rid of it
|
|
||||||
# and apply changes in eth_*, debug_* RPC,
|
|
||||||
# macro assembler and premix tool set.
|
|
||||||
# at every place where setupComputation and
|
|
||||||
# processTransaction are used.
|
|
||||||
let fork =
|
|
||||||
if forkOverride.isSome:
|
|
||||||
forkOverride.get
|
|
||||||
else:
|
|
||||||
vmState.blockNumber.toFork
|
|
||||||
|
|
||||||
let upfrontGasCost = tx.gasLimit.u256 * tx.gasPrice.u256
|
let upfrontGasCost = tx.gasLimit.u256 * tx.gasPrice.u256
|
||||||
var balance = vmState.readOnlyStateDb().getBalance(sender)
|
var balance = vmState.readOnlyStateDb().getBalance(sender)
|
||||||
if balance < upfrontGasCost:
|
if balance < upfrontGasCost:
|
||||||
|
@ -236,14 +236,10 @@ proc addLogEntry*(c: var BaseComputation, log: Log) {.inline.} =
|
|||||||
|
|
||||||
# many methods are basically TODO, but they still return valid values
|
# many methods are basically TODO, but they still return valid values
|
||||||
# in order to test some existing code
|
# in order to test some existing code
|
||||||
func getAccountsForDeletion*(c: BaseComputation): seq[EthAddress] =
|
iterator accountsForDeletion*(c: BaseComputation): EthAddress =
|
||||||
# TODO
|
if not c.isError:
|
||||||
if c.isError:
|
|
||||||
result = @[]
|
|
||||||
else:
|
|
||||||
result = @[]
|
|
||||||
for account in c.accountsToDelete.keys:
|
for account in c.accountsToDelete.keys:
|
||||||
result.add(account)
|
yield account
|
||||||
|
|
||||||
proc getGasRefund*(c: BaseComputation): GasInt =
|
proc getGasRefund*(c: BaseComputation): GasInt =
|
||||||
if c.isError:
|
if c.isError:
|
||||||
|
@ -70,7 +70,7 @@ proc execComputation*(computation: var BaseComputation): bool =
|
|||||||
result = computation.applyMessage(Call)
|
result = computation.applyMessage(Call)
|
||||||
|
|
||||||
computation.vmState.mutateStateDB:
|
computation.vmState.mutateStateDB:
|
||||||
for deletedAccount in computation.getAccountsForDeletion:
|
for deletedAccount in computation.accountsForDeletion:
|
||||||
db.deleteAccount deletedAccount
|
db.deleteAccount deletedAccount
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user