mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-12 21:34:33 +00:00
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
|
# TODO: this actually also creates a HexaryTrie and AccountStateDB, which we
|
||||||
# could skip
|
# could skip
|
||||||
let header = toBlock(cn.genesis, chainDB)
|
let header = toGenesisHeader(chainDB)
|
||||||
|
|
||||||
# Trie exists already in flat db, but need to provide the root
|
# Trie exists already in flat db, but need to provide the root
|
||||||
initHexaryTrie(chainDB.db, header.stateRoot, chainDB.pruneTrie)
|
initHexaryTrie(chainDB.db, header.stateRoot, chainDB.pruneTrie)
|
||||||
|
@ -90,11 +90,11 @@ proc initDbAccounts(db: BaseChainDB): BlockHeader
|
|||||||
# Public functions
|
# Public functions
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
proc toGenesisHeader*(params: NetworkParams): BlockHeader
|
proc toGenesisHeader*(params: NetworkParams, db = newMemoryDb()): BlockHeader
|
||||||
{.raises: [Defect, RlpError].} =
|
{.raises: [Defect, RlpError].} =
|
||||||
## Generate the genesis block header from the `params` argument value.
|
## Generate the genesis block header from the `params` argument value.
|
||||||
newBaseChainDB(
|
newBaseChainDB(
|
||||||
newMemoryDb(),
|
db = db,
|
||||||
id = params.config.chainID.NetworkId,
|
id = params.config.chainID.NetworkId,
|
||||||
params = params,
|
params = params,
|
||||||
pruneTrie = true).initDbAccounts
|
pruneTrie = true).initDbAccounts
|
||||||
@ -105,7 +105,7 @@ proc toGenesisHeader*(db: BaseChainDB): BlockHeader
|
|||||||
## fields of the argument `db` descriptor.
|
## fields of the argument `db` descriptor.
|
||||||
NetworkParams(
|
NetworkParams(
|
||||||
config: db.config,
|
config: db.config,
|
||||||
genesis: db.genesis).toGenesisHeader
|
genesis: db.genesis).toGenesisHeader(db.db)
|
||||||
|
|
||||||
proc initializeEmptyDb*(db: BaseChainDB)
|
proc initializeEmptyDb*(db: BaseChainDB)
|
||||||
{.raises: [Defect, CatchableError].} =
|
{.raises: [Defect, CatchableError].} =
|
||||||
|
@ -341,7 +341,7 @@ method baseFee*(vmState: BaseVMState): UInt256 {.base, gcsafe.} =
|
|||||||
when defined(geth):
|
when defined(geth):
|
||||||
import db/geth_db
|
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
|
var ancestorDepth = vmState.blockNumber - blockNumber - 1
|
||||||
if ancestorDepth >= constants.MAX_PREV_HEADER_DEPTH:
|
if ancestorDepth >= constants.MAX_PREV_HEADER_DEPTH:
|
||||||
return
|
return
|
||||||
|
@ -328,7 +328,7 @@ method baseFee*(vmState: BaseVMState): UInt256 {.base, gcsafe.} =
|
|||||||
when defined(geth):
|
when defined(geth):
|
||||||
import db/geth_db
|
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
|
var ancestorDepth = vmState.blockNumber - blockNumber - 1
|
||||||
if ancestorDepth >= constants.MAX_PREV_HEADER_DEPTH:
|
if ancestorDepth >= constants.MAX_PREV_HEADER_DEPTH:
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user