mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-24 11:11:59 +00:00
move initializeEmptyDb to genesis.nim
This commit is contained in:
parent
7190b218de
commit
0c887b3711
@ -8,7 +8,7 @@
|
||||
import
|
||||
tables, sequtils, algorithm,
|
||||
rlp, ranges, state_db, nimcrypto, eth_trie/[hexary, db], eth_common, byteutils, chronicles,
|
||||
../errors, ../block_types, ../utils/header, ../constants, ./storage_types.nim
|
||||
../errors, ../block_types, ../utils/header, ../constants, ./storage_types
|
||||
|
||||
type
|
||||
BaseChainDB* = ref object
|
||||
|
@ -104,3 +104,11 @@ proc commit*(g: Genesis, db: BaseChainDB) =
|
||||
let b = g.toBlock(db)
|
||||
assert(b.blockNumber == 0, "can't commit genesis block with number > 0")
|
||||
discard db.persistHeaderToDb(b)
|
||||
|
||||
proc initializeEmptyDb*(db: BaseChainDB) =
|
||||
trace "Writing genesis to DB"
|
||||
let networkId = getConfiguration().net.networkId.toPublicNetwork()
|
||||
if networkId == CustomNet:
|
||||
raise newException(Exception, "Custom genesis not implemented")
|
||||
else:
|
||||
defaultGenesisBlockForNetwork(networkId).commit(db)
|
||||
|
@ -35,14 +35,6 @@ type
|
||||
ethNode*: EthereumNode
|
||||
state*: NimbusState
|
||||
|
||||
proc initializeEmptyDb(db: BaseChainDB) =
|
||||
trace "Writing genesis to DB"
|
||||
let networkId = getConfiguration().net.networkId.toPublicNetwork()
|
||||
if networkId == CustomNet:
|
||||
raise newException(Exception, "Custom genesis not implemented")
|
||||
else:
|
||||
defaultGenesisBlockForNetwork(networkId).commit(db)
|
||||
|
||||
proc start(): NimbusObject =
|
||||
var nimbus = NimbusObject()
|
||||
var conf = getConfiguration()
|
||||
|
@ -10,15 +10,6 @@ import
|
||||
../nimbus/[genesis, utils, config],
|
||||
../nimbus/p2p/chain
|
||||
|
||||
# TODO: move this one and the one in nimbus.nim to db_chain.nim
|
||||
proc initializeEmptyDb(db: BaseChainDB) =
|
||||
echo "Writing genesis to DB"
|
||||
let networkId = getConfiguration().net.networkId.toPublicNetwork()
|
||||
if networkId == CustomNet:
|
||||
raise newException(Exception, "Custom genesis not implemented")
|
||||
else:
|
||||
defaultGenesisBlockForNetwork(networkId).commit(db)
|
||||
|
||||
const
|
||||
manualCommit = nimbus_db_backend == "lmdb"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user