From 438ad832cc6faf1e0c6e2b8f18dbbad85d91c893 Mon Sep 17 00:00:00 2001 From: jangko Date: Mon, 22 Jun 2020 10:10:12 +0700 Subject: [PATCH] fix rpc/p2p.nim --- nimbus/rpc/p2p.nim | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/nimbus/rpc/p2p.nim b/nimbus/rpc/p2p.nim index ecf4ce070..90aa610c0 100644 --- a/nimbus/rpc/p2p.nim +++ b/nimbus/rpc/p2p.nim @@ -86,11 +86,10 @@ proc binarySearchGas(vmState: var BaseVMState, transaction: Transaction, sender: proc setupEthRpc*(node: EthereumNode, chain: BaseChainDB, rpcsrv: RpcServer) = - func getAccountDb(header: BlockHeader): ReadOnlyStateDB = + proc getAccountDb(header: BlockHeader): ReadOnlyStateDB = ## Retrieves the account db from canonical head - # TODO: header.stateRoot to prevStateRoot - let vmState = newBaseVMState(header.stateRoot, header, chain) - result = vmState.readOnlyStateDB() + let ac = AccountsCache.init(chain.db, header.stateRoot, chain.pruneTrie) + result = ReadOnlyStateDB(ac) proc accountDbFromTag(tag: string, readOnly = true): ReadOnlyStateDB = result = getAccountDb(chain.headerFromTag(tag))