mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-14 14:24:32 +00:00
71e466d173
* Block header download starting at Beacon down to Era1 details: The header download implementation is intended to be completed to a full sync facility. Downloaded block headers are stored in a `CoreDb` table. Later on they should be fetched, complemented by a block body, executed/imported, and deleted from the table. The Era1 repository may be partial or missing. Era1 headers are neither downloaded nor stored on the `CoreDb` table. Headers are downloaded top down (largest block number first) using the hash of the block header by one peer. Other peers fetch headers opportunistically using block numbers Observed download times for 14m `MainNet` headers varies between 30min and 1h (Era1 size truncated to 66m blocks.), full download 52min (anectdotal.) The number of peers downloading concurrently is crucial here. * Activate `flare` by command line option * Fix copyright year
80 lines
1.8 KiB
Nim
80 lines
1.8 KiB
Nim
# Nimbus
|
|
# Copyright (c) 2024 Status Research & Development GmbH
|
|
# Licensed under either of
|
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
|
# at your option.
|
|
# This file may not be copied, modified, or distributed except according to
|
|
# those terms.
|
|
|
|
import
|
|
chronos,
|
|
eth/p2p,
|
|
metrics/chronos_httpserver,
|
|
./rpc/rpc_server,
|
|
./core/chain,
|
|
./core/tx_pool,
|
|
./sync/peers,
|
|
./sync/[beacon, flare],
|
|
# ./sync/snap, # -- todo
|
|
./beacon/beacon_engine,
|
|
./common,
|
|
./config
|
|
|
|
export
|
|
chronos,
|
|
p2p,
|
|
chronos_httpserver,
|
|
rpc_server,
|
|
chain,
|
|
tx_pool,
|
|
peers,
|
|
beacon,
|
|
flare,
|
|
#snap,
|
|
full,
|
|
beacon_engine,
|
|
common,
|
|
config
|
|
|
|
type
|
|
NimbusState* = enum
|
|
Starting, Running, Stopping
|
|
|
|
NimbusNode* = ref object
|
|
httpServer*: NimbusHttpServerRef
|
|
engineApiServer*: NimbusHttpServerRef
|
|
ethNode*: EthereumNode
|
|
state*: NimbusState
|
|
ctx*: EthContext
|
|
chainRef*: ForkedChainRef
|
|
txPool*: TxPoolRef
|
|
networkLoop*: Future[void]
|
|
peerManager*: PeerManagerRef
|
|
# snapSyncRef*: SnapSyncRef # -- todo
|
|
beaconSyncRef*: BeaconSyncRef
|
|
flareSyncRef*: FlareSyncRef
|
|
beaconEngine*: BeaconEngineRef
|
|
metricsServer*: MetricsHttpServerRef
|
|
|
|
{.push gcsafe, raises: [].}
|
|
|
|
proc stop*(nimbus: NimbusNode, conf: NimbusConf) {.async, gcsafe.} =
|
|
trace "Graceful shutdown"
|
|
if nimbus.httpServer.isNil.not:
|
|
await nimbus.httpServer.stop()
|
|
if nimbus.engineApiServer.isNil.not:
|
|
await nimbus.engineApiServer.stop()
|
|
if conf.maxPeers > 0:
|
|
await nimbus.networkLoop.cancelAndWait()
|
|
if nimbus.peerManager.isNil.not:
|
|
await nimbus.peerManager.stop()
|
|
#if nimbus.snapSyncRef.isNil.not:
|
|
# nimbus.snapSyncRef.stop()
|
|
if nimbus.beaconSyncRef.isNil.not:
|
|
nimbus.beaconSyncRef.stop()
|
|
if nimbus.metricsServer.isNil.not:
|
|
await nimbus.metricsServer.stop()
|
|
|
|
{.pop.}
|