mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-22 03:08:30 +00:00
Run beacon_node --network=altona without initial Eth1 syncing
This commit is contained in:
parent
e342b96d2e
commit
98761afc64
@ -98,6 +98,8 @@ proc getStateFromSnapshot(conf: BeaconNodeConf): NilableBeaconStateRef =
|
||||
except CatchableError as err:
|
||||
error "Failed to read genesis file", err = err.msg
|
||||
quit 1
|
||||
elif conf.stateSnapshotContents != nil:
|
||||
swap(snapshotContents, TaintedString conf.stateSnapshotContents[])
|
||||
else:
|
||||
# No snapshot was provided. We should wait for genesis.
|
||||
return nil
|
||||
@ -193,6 +195,10 @@ proc init*(T: type BeaconNode, conf: BeaconNodeConf): Future[BeaconNode] {.async
|
||||
error "Failed to initialize database", err = e.msg
|
||||
quit 1
|
||||
|
||||
if conf.stateSnapshotContents != nil:
|
||||
# The memory for the initial snapshot won't be needed anymore
|
||||
conf.stateSnapshotContents[] = ""
|
||||
|
||||
# TODO check that genesis given on command line (if any) matches database
|
||||
let blockPool = BlockPool.init(
|
||||
db,
|
||||
@ -1135,6 +1141,9 @@ programMain:
|
||||
for node in metadata.bootstrapNodes:
|
||||
config.bootstrapNodes.add node
|
||||
|
||||
if config.stateSnapshot.isNone:
|
||||
config.stateSnapshotContents = newClone metadata.genesisData
|
||||
|
||||
template checkForIncompatibleOption(flagName, fieldName) =
|
||||
# TODO: This will have to be reworked slightly when we introduce config files.
|
||||
# We'll need to keep track of the "origin" of the config value, so we can
|
||||
|
@ -127,10 +127,13 @@ type
|
||||
name: "wallets-dir" }: Option[InputDir]
|
||||
|
||||
stateSnapshot* {.
|
||||
desc: "Json file specifying a recent state snapshot"
|
||||
desc: "SSZ file specifying a recent state snapshot"
|
||||
abbr: "s"
|
||||
name: "state-snapshot" }: Option[InputFile]
|
||||
|
||||
stateSnapshotContents* {.hidden.}: ref string
|
||||
# This is ref so we can mutate it (to erase it) after the initial loading.
|
||||
|
||||
nodeName* {.
|
||||
defaultValue: ""
|
||||
desc: "A name for this node that will appear in the logs. " &
|
||||
|
2
vendor/nim-confutils
vendored
2
vendor/nim-confutils
vendored
@ -1 +1 @@
|
||||
Subproject commit f9415621f87287524d26aa99a94e2613b237cc3c
|
||||
Subproject commit 39456fa3d5b637053b616e50a8350b2b932a1d4c
|
Loading…
x
Reference in New Issue
Block a user