mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-12 05:14:14 +00:00
fix contract creation
This commit is contained in:
parent
f5e54b8d4f
commit
bc675b1daa
@ -298,6 +298,9 @@ proc registerAccountForDeletion*(c: var BaseComputation, beneficiary: EthAddress
|
||||
"registered for deletion multiple times")
|
||||
c.accountsToDelete[c.msg.storageAddress] = beneficiary
|
||||
|
||||
proc isSuicided*(c: var BaseComputation, address: EthAddress): bool =
|
||||
result = address in c.accountsToDelete
|
||||
|
||||
proc addLogEntry*(c: var BaseComputation, log: Log) {.inline.} =
|
||||
c.vmState.addLogEntry(log)
|
||||
|
||||
|
@ -87,7 +87,7 @@ proc applyCreateTransaction*(t: Transaction, vmState: BaseVMState, sender: EthAd
|
||||
# once verified in GST fixture
|
||||
let
|
||||
gasRemaining = c.gasMeter.gasRemaining.u256
|
||||
gasRefunded = c.gasMeter.gasRefunded.u256
|
||||
gasRefunded = c.getGasRefund().u256
|
||||
gasUsed2 = t.gasLimit.u256 - gasRemaining
|
||||
gasRefund = min(gasRefunded, gasUsed2 div 2)
|
||||
gasRefundAmount = (gasRefund + gasRemaining) * t.gasPrice.u256
|
||||
@ -99,7 +99,7 @@ proc applyCreateTransaction*(t: Transaction, vmState: BaseVMState, sender: EthAd
|
||||
# for purposes of accounting. Py-EVM apparently does consume the gas, but it is
|
||||
# not matching observed blockchain balances if consumeGas is called.
|
||||
|
||||
if db.accountExists(contractAddress):
|
||||
if not c.isSuicided(contractAddress):
|
||||
# make changes only if it not selfdestructed
|
||||
db.addBalance(contractAddress, t.value)
|
||||
if gasRemaining >= codeCost.u256:
|
||||
|
Loading…
x
Reference in New Issue
Block a user