fixes regression caused by #962
This commit is contained in:
parent
215e9856d3
commit
6374c9f66d
|
@ -30,7 +30,7 @@ proc genesisToTrie(filePath: string): HexaryTrie =
|
|||
)
|
||||
# TODO: this actually also creates a HexaryTrie and AccountStateDB, which we
|
||||
# could skip
|
||||
let header = toBlock(cn.genesis, chainDB)
|
||||
let header = toGenesisHeader(chainDB)
|
||||
|
||||
# Trie exists already in flat db, but need to provide the root
|
||||
initHexaryTrie(chainDB.db, header.stateRoot, chainDB.pruneTrie)
|
||||
|
|
|
@ -90,11 +90,11 @@ proc initDbAccounts(db: BaseChainDB): BlockHeader
|
|||
# Public functions
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
proc toGenesisHeader*(params: NetworkParams): BlockHeader
|
||||
proc toGenesisHeader*(params: NetworkParams, db = newMemoryDb()): BlockHeader
|
||||
{.raises: [Defect, RlpError].} =
|
||||
## Generate the genesis block header from the `params` argument value.
|
||||
newBaseChainDB(
|
||||
newMemoryDb(),
|
||||
db = db,
|
||||
id = params.config.chainID.NetworkId,
|
||||
params = params,
|
||||
pruneTrie = true).initDbAccounts
|
||||
|
@ -105,7 +105,7 @@ proc toGenesisHeader*(db: BaseChainDB): BlockHeader
|
|||
## fields of the argument `db` descriptor.
|
||||
NetworkParams(
|
||||
config: db.config,
|
||||
genesis: db.genesis).toGenesisHeader
|
||||
genesis: db.genesis).toGenesisHeader(db.db)
|
||||
|
||||
proc initializeEmptyDb*(db: BaseChainDB)
|
||||
{.raises: [Defect, CatchableError].} =
|
||||
|
|
|
@ -341,7 +341,7 @@ method baseFee*(vmState: BaseVMState): UInt256 {.base, gcsafe.} =
|
|||
when defined(geth):
|
||||
import db/geth_db
|
||||
|
||||
method getAncestorHash*(vmState: BaseVMState, blockNumber: BlockNumber): Hash256 {.base, gcsafe, raises: [Defect,CatchableError].} =
|
||||
method getAncestorHash*(vmState: BaseVMState, blockNumber: BlockNumber): Hash256 {.base, gcsafe, raises: [Defect,CatchableError,Exception].} =
|
||||
var ancestorDepth = vmState.blockNumber - blockNumber - 1
|
||||
if ancestorDepth >= constants.MAX_PREV_HEADER_DEPTH:
|
||||
return
|
||||
|
|
|
@ -328,7 +328,7 @@ method baseFee*(vmState: BaseVMState): UInt256 {.base, gcsafe.} =
|
|||
when defined(geth):
|
||||
import db/geth_db
|
||||
|
||||
method getAncestorHash*(vmState: BaseVMState, blockNumber: BlockNumber): Hash256 {.base, gcsafe, raises: [Defect,CatchableError].} =
|
||||
method getAncestorHash*(vmState: BaseVMState, blockNumber: BlockNumber): Hash256 {.base, gcsafe, raises: [Defect,CatchableError,Exception].} =
|
||||
var ancestorDepth = vmState.blockNumber - blockNumber - 1
|
||||
if ancestorDepth >= constants.MAX_PREV_HEADER_DEPTH:
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue