fix processBlock regression
This commit is contained in:
parent
fdf9e04108
commit
9c31980b79
|
@ -67,7 +67,6 @@ proc processBlock*(chainDB: BaseChainDB, head, header: BlockHeader, body: BlockB
|
||||||
debug "Mismatched txRoot", blockNumber=header.blockNumber
|
debug "Mismatched txRoot", blockNumber=header.blockNumber
|
||||||
return ValidationResult.Error
|
return ValidationResult.Error
|
||||||
|
|
||||||
var stateDb = vmState.accountDb
|
|
||||||
if header.txRoot != BLANK_ROOT_HASH:
|
if header.txRoot != BLANK_ROOT_HASH:
|
||||||
if body.transactions.len == 0:
|
if body.transactions.len == 0:
|
||||||
debug "No transactions in body", blockNumber=header.blockNumber
|
debug "No transactions in body", blockNumber=header.blockNumber
|
||||||
|
@ -85,7 +84,8 @@ proc processBlock*(chainDB: BaseChainDB, head, header: BlockHeader, body: BlockB
|
||||||
|
|
||||||
# miner fee
|
# miner fee
|
||||||
let txFee = gasUsed.u256 * tx.gasPrice.u256
|
let txFee = gasUsed.u256 * tx.gasPrice.u256
|
||||||
stateDb.addBalance(header.coinbase, txFee)
|
vmState.mutateStateDB:
|
||||||
|
db.addBalance(header.coinbase, txFee)
|
||||||
else:
|
else:
|
||||||
debug "Could not get sender", txIndex, tx
|
debug "Could not get sender", txIndex, tx
|
||||||
return ValidationResult.Error
|
return ValidationResult.Error
|
||||||
|
@ -102,12 +102,15 @@ proc processBlock*(chainDB: BaseChainDB, head, header: BlockHeader, body: BlockB
|
||||||
uncleReward -= header.blockNumber
|
uncleReward -= header.blockNumber
|
||||||
uncleReward = uncleReward * blockReward
|
uncleReward = uncleReward * blockReward
|
||||||
uncleReward = uncleReward div 8.u256
|
uncleReward = uncleReward div 8.u256
|
||||||
stateDb.addBalance(uncle.coinbase, uncleReward)
|
vmState.mutateStateDB:
|
||||||
|
db.addBalance(uncle.coinbase, uncleReward)
|
||||||
mainReward += blockReward div 32.u256
|
mainReward += blockReward div 32.u256
|
||||||
|
|
||||||
# Reward beneficiary
|
# Reward beneficiary
|
||||||
stateDb.addBalance(header.coinbase, mainReward)
|
vmState.mutateStateDB:
|
||||||
|
db.addBalance(header.coinbase, mainReward)
|
||||||
|
|
||||||
|
let stateDb = vmState.accountDb
|
||||||
if header.stateRoot != stateDb.rootHash:
|
if header.stateRoot != stateDb.rootHash:
|
||||||
error "Wrong state root in block", blockNumber=header.blockNumber, expected=header.stateRoot, actual=stateDb.rootHash, arrivedFrom=chainDB.getCanonicalHead().stateRoot
|
error "Wrong state root in block", blockNumber=header.blockNumber, expected=header.stateRoot, actual=stateDb.rootHash, arrivedFrom=chainDB.getCanonicalHead().stateRoot
|
||||||
# this one is a show stopper until we are confident in our VM's
|
# this one is a show stopper until we are confident in our VM's
|
||||||
|
|
Loading…
Reference in New Issue