fix test_blockchain_json -> add a call to accounts_cache.persist

This commit is contained in:
jangko 2020-06-01 12:00:36 +07:00
parent 46e9c11d3f
commit 079579c1cb
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
1 changed files with 3 additions and 1 deletions

View File

@ -14,7 +14,7 @@ import
../premix/parser, test_config,
../nimbus/vm/interpreter/vm_forks,
../nimbus/[vm_state, utils, vm_types, errors, transaction, constants],
../nimbus/db/[db_chain, state_db],
../nimbus/db/[db_chain, accounts_cache],
../nimbus/utils/header,
../nimbus/p2p/[executor, dao],
../nimbus/config
@ -299,6 +299,7 @@ proc assignBlockRewards(minedBlock: PlainBlock, vmState: BaseVMState, fork: Fork
# Reward beneficiary
vmState.mutateStateDB:
db.addBalance(minedBlock.header.coinbase, mainReward)
db.persist()
let stateDb = vmState.accountDb
if minedBlock.header.stateRoot != stateDb.rootHash:
@ -698,6 +699,7 @@ proc testFixture(node: JsonNode, testStatusIMPL: var TestStatus, debugMode = fal
vmState.mutateStateDB:
setupStateDB(fixture["pre"], db)
db.persist()
let obtainedHash = $(vmState.readOnlyStateDB.rootHash)
check obtainedHash == $(tester.genesisBlockHeader.stateRoot)