diff --git a/beacon_chain/nimbus_beacon_node.nim b/beacon_chain/nimbus_beacon_node.nim index 7e772037cd..4b2f78fdc3 100644 --- a/beacon_chain/nimbus_beacon_node.nim +++ b/beacon_chain/nimbus_beacon_node.nim @@ -63,7 +63,7 @@ declareGauge sync_committee_active, declareCounter db_checkpoint_seconds, "Time spent checkpointing the database to clear the WAL file" -proc fetchGenesisState( +proc fetchGenesisState*( metadata: Eth2NetworkMetadata, genesisState = none(InputFile), genesisStateUrl = none(Uri) @@ -101,7 +101,7 @@ proc fetchGenesisState( else: nil -proc doRunTrustedNodeSync( +proc doRunTrustedNodeSync*( db: BeaconChainDB, metadata: Eth2NetworkMetadata, databaseDir: string, @@ -1891,7 +1891,7 @@ proc onSlotStart(node: BeaconNode, wallTime: BeaconTime, proc onSecond(node: BeaconNode, time: Moment) = # Nim GC metrics (for the main thread) - updateThreadMetrics() + # updateThreadMetrics() if node.config.stopAtSyncedEpoch != 0 and node.dag.head.slot.epoch >= node.config.stopAtSyncedEpoch: @@ -2350,7 +2350,7 @@ when not defined(windows): asyncSpawn statusBarUpdatesPollingLoop() -proc doRunBeaconNode(config: var BeaconNodeConf, rng: ref HmacDrbgContext) {.raises: [CatchableError].} = +proc doRunBeaconNode*(config: var BeaconNodeConf, rng: ref HmacDrbgContext) {.raises: [CatchableError].} = info "Launching beacon node", version = fullVersionStr, bls_backend = $BLS_BACKEND, @@ -2369,7 +2369,7 @@ proc doRunBeaconNode(config: var BeaconNodeConf, rng: ref HmacDrbgContext) {.rai ignoreDeprecatedOption validatorMonitorTotals ignoreDeprecatedOption web3ForcePolling - createPidFile(config.dataDir.string / "beacon_node.pid") + # createPidFile(config.dataDir.string / "beacon_node.pid") config.createDumpDirs() @@ -2386,7 +2386,7 @@ proc doRunBeaconNode(config: var BeaconNodeConf, rng: ref HmacDrbgContext) {.rai # Nim GC metrics (for the main thread) will be collected in onSecond(), but # we disable piggy-backing on other metrics here. - setSystemMetricsAutomaticUpdate(false) + # setSystemMetricsAutomaticUpdate(false) # There are no managed event loops in here, to do a graceful shutdown, but # letting the default Ctrl+C handler exit is safe, since we only read from @@ -2398,26 +2398,26 @@ proc doRunBeaconNode(config: var BeaconNodeConf, rng: ref HmacDrbgContext) {.rai for node in metadata.bootstrapNodes: config.bootstrapNodes.add node - ## Ctrl+C handling - proc controlCHandler() {.noconv.} = - when defined(windows): - # workaround for https://github.com/nim-lang/Nim/issues/4057 - try: - setupForeignThreadGc() - except Exception as exc: raiseAssert exc.msg # shouldn't happen - notice "Shutting down after having received SIGINT" - bnStatus = BeaconNodeStatus.Stopping - try: - setControlCHook(controlCHandler) - except Exception as exc: # TODO Exception - warn "Cannot set ctrl-c handler", msg = exc.msg - - # equivalent SIGTERM handler - when defined(posix): - proc SIGTERMHandler(signal: cint) {.noconv.} = - notice "Shutting down after having received SIGTERM" - bnStatus = BeaconNodeStatus.Stopping - c_signal(ansi_c.SIGTERM, SIGTERMHandler) + # ## Ctrl+C handling + # proc controlCHandler() {.noconv.} = + # when defined(windows): + # # workaround for https://github.com/nim-lang/Nim/issues/4057 + # try: + # setupForeignThreadGc() + # except Exception as exc: raiseAssert exc.msg # shouldn't happen + # notice "Shutting down after having received SIGINT" + # bnStatus = BeaconNodeStatus.Stopping + # try: + # setControlCHook(controlCHandler) + # except Exception as exc: # TODO Exception + # warn "Cannot set ctrl-c handler", msg = exc.msg + + # # equivalent SIGTERM handler + # when defined(posix): + # proc SIGTERMHandler(signal: cint) {.noconv.} = + # notice "Shutting down after having received SIGTERM" + # bnStatus = BeaconNodeStatus.Stopping + # c_signal(ansi_c.SIGTERM, SIGTERMHandler) block: let res = @@ -2570,7 +2570,7 @@ proc handleStartUpCmd(config: var BeaconNodeConf) {.raises: [CatchableError].} = {.pop.} # TODO moduletests exceptions -programMain: +when isMainModule: var config = makeBannerAndConfig(clientId, copyrights, nimBanner, SPEC_VERSION, [], BeaconNodeConf).valueOr: stderr.write error