From a0c82c55b2b775c50242ab7b7d3761ba17d62039 Mon Sep 17 00:00:00 2001 From: Roman Krasiuk Date: Fri, 24 Feb 2023 15:53:05 +0200 Subject: [PATCH] fix(cli): block node command from exiting (#1540) --- .github/workflows/integration.yml | 3 ++- bin/reth/src/node/mod.rs | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index ea99304c2..259156ec9 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -91,4 +91,5 @@ jobs: cargo run --profile ${{ matrix.profile }} \ --bin reth -- node \ --debug.tip 0x91c90676cab257a59cd956d7cb0bceb9b1a71d79755c23c7277a0697ccfaf8c4 \ - --debug.max-block 100000 + --debug.max-block 100000 \ + --debug.terminate diff --git a/bin/reth/src/node/mod.rs b/bin/reth/src/node/mod.rs index 1c24c6ecf..55a4a9ef3 100644 --- a/bin/reth/src/node/mod.rs +++ b/bin/reth/src/node/mod.rs @@ -111,6 +111,10 @@ pub struct Command { #[arg(long = "debug.max-block", help_heading = "Debug")] max_block: Option, + /// Flag indicating whether the node should be terminated after the pipeline sync. + #[arg(long = "debug.terminate", help_heading = "Debug")] + terminate: bool, + #[clap(flatten)] rpc: RpcServerArgs, } @@ -196,8 +200,15 @@ impl Command { tx.await??; - info!(target: "reth::cli", "Finishing up"); - Ok(()) + info!(target: "reth::cli", "Pipeline has finished."); + + if self.terminate { + Ok(()) + } else { + // The pipeline has finished downloading blocks up to `--debug.tip` or + // `--debug.max-block`. Keep other node components alive for further usage. + futures::future::pending().await + } } async fn build_networked_pipeline(