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:
|
||||
return tx.gasLimit
|
||||
|
||||
var snapshot = vmState.snapshot()
|
||||
defer: snapshot.dispose()
|
||||
|
||||
var contractOK = true
|
||||
result = tx.gasLimit
|
||||
|
||||
if execComputation(computation):
|
||||
if tx.isContractCreation:
|
||||
contractOK = computation.writeContract(fork)
|
||||
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):
|
||||
return 0
|
||||
|
|
|
@ -81,6 +81,11 @@ proc execComputation*(computation: var BaseComputation): bool =
|
|||
result = false
|
||||
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:
|
||||
snapshot.commit()
|
||||
computation.vmState.addLogs(computation.logEntries)
|
||||
|
|
Loading…
Reference in New Issue