mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-04 08:16:19 +00:00
processTransaction simplification
This commit is contained in:
parent
b73a1238e0
commit
9cc5db73c2
@ -43,23 +43,9 @@ proc processTransaction*(tx: Transaction, sender: EthAddress, vmState: BaseVMSta
|
|||||||
if tx.isContractCreation and isCollision:
|
if tx.isContractCreation and isCollision:
|
||||||
return tx.gasLimit
|
return tx.gasLimit
|
||||||
|
|
||||||
var snapshot = vmState.snapshot()
|
|
||||||
defer: snapshot.dispose()
|
|
||||||
|
|
||||||
var contractOK = true
|
|
||||||
result = tx.gasLimit
|
result = tx.gasLimit
|
||||||
|
|
||||||
if execComputation(computation):
|
if execComputation(computation):
|
||||||
if tx.isContractCreation:
|
|
||||||
contractOK = computation.writeContract(fork)
|
|
||||||
result = computation.refundGas(tx, sender)
|
result = computation.refundGas(tx, sender)
|
||||||
|
|
||||||
if not contractOK and fork == FkHomestead:
|
|
||||||
snapshot.revert()
|
|
||||||
# consume all gas
|
|
||||||
result = tx.gasLimit
|
|
||||||
else:
|
|
||||||
snapshot.commit()
|
|
||||||
|
|
||||||
if computation.isSuicided(vmState.blockHeader.coinbase):
|
if computation.isSuicided(vmState.blockHeader.coinbase):
|
||||||
return 0
|
return 0
|
||||||
|
@ -81,6 +81,11 @@ proc execComputation*(computation: var BaseComputation): bool =
|
|||||||
result = false
|
result = false
|
||||||
debug "execComputation() error", msg = getCurrentExceptionMsg()
|
debug "execComputation() error", msg = getCurrentExceptionMsg()
|
||||||
|
|
||||||
|
if result and computation.msg.isCreate:
|
||||||
|
let fork = computation.getFork
|
||||||
|
let contractFailed = not computation.writeContract(fork)
|
||||||
|
result = not(contractFailed and fork == FkHomestead)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
snapshot.commit()
|
snapshot.commit()
|
||||||
computation.vmState.addLogs(computation.logEntries)
|
computation.vmState.addLogs(computation.logEntries)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user