fix(cli): block node command from exiting (#1540)

This commit is contained in:
Roman Krasiuk
2023-02-24 15:53:05 +02:00
committed by GitHub
parent dc57fbad07
commit a0c82c55b2
2 changed files with 15 additions and 3 deletions

View File

@ -91,4 +91,5 @@ jobs:
cargo run --profile ${{ matrix.profile }} \ cargo run --profile ${{ matrix.profile }} \
--bin reth -- node \ --bin reth -- node \
--debug.tip 0x91c90676cab257a59cd956d7cb0bceb9b1a71d79755c23c7277a0697ccfaf8c4 \ --debug.tip 0x91c90676cab257a59cd956d7cb0bceb9b1a71d79755c23c7277a0697ccfaf8c4 \
--debug.max-block 100000 --debug.max-block 100000 \
--debug.terminate

View File

@ -111,6 +111,10 @@ pub struct Command {
#[arg(long = "debug.max-block", help_heading = "Debug")] #[arg(long = "debug.max-block", help_heading = "Debug")]
max_block: Option<u64>, max_block: Option<u64>,
/// Flag indicating whether the node should be terminated after the pipeline sync.
#[arg(long = "debug.terminate", help_heading = "Debug")]
terminate: bool,
#[clap(flatten)] #[clap(flatten)]
rpc: RpcServerArgs, rpc: RpcServerArgs,
} }
@ -196,8 +200,15 @@ impl Command {
tx.await??; tx.await??;
info!(target: "reth::cli", "Finishing up"); info!(target: "reth::cli", "Pipeline has finished.");
Ok(())
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( async fn build_networked_pipeline(