Run beacon_node --network=altona without initial Eth1 syncing

This commit is contained in:
Zahary Karadjov 2020-07-02 18:52:48 +03:00
parent e342b96d2e
commit 98761afc64
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
3 changed files with 14 additions and 2 deletions

View File

@ -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

View File

@ -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. " &

@ -1 +1 @@
Subproject commit f9415621f87287524d26aa99a94e2613b237cc3c
Subproject commit 39456fa3d5b637053b616e50a8350b2b932a1d4c