mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: drive pipeline forever in debug.continuous (#2375)
Co-authored-by: Roman Krasiuk <rokrassyuk@gmail.com>
This commit is contained in:
@ -10,7 +10,7 @@ pub struct DebugArgs {
|
||||
/// Prompt the downloader to download blocks one at a time.
|
||||
///
|
||||
/// NOTE: This is for testing purposes only.
|
||||
#[arg(long = "debug.continuous", help_heading = "Debug")]
|
||||
#[arg(long = "debug.continuous", help_heading = "Debug", conflicts_with = "tip")]
|
||||
pub continuous: bool,
|
||||
|
||||
/// Flag indicating whether the node should be terminated after the pipeline sync.
|
||||
@ -20,7 +20,7 @@ pub struct DebugArgs {
|
||||
/// Set the chain tip manually for testing purposes.
|
||||
///
|
||||
/// NOTE: This is a temporary flag
|
||||
#[arg(long = "debug.tip", help_heading = "Debug")]
|
||||
#[arg(long = "debug.tip", help_heading = "Debug", conflicts_with = "continuous")]
|
||||
pub tip: Option<H256>,
|
||||
|
||||
/// Runs the sync only up to the specified block.
|
||||
|
||||
@ -158,7 +158,7 @@ impl Command {
|
||||
|
||||
debug!(target: "reth::cli", chain=%self.chain.chain, genesis=?self.chain.genesis_hash(), "Initializing genesis");
|
||||
|
||||
init_genesis(db.clone(), self.chain.clone())?;
|
||||
let genesis_hash = init_genesis(db.clone(), self.chain.clone())?;
|
||||
|
||||
let consensus: Arc<dyn Consensus> = if self.auto_mine {
|
||||
debug!(target: "reth::cli", "Using auto seal");
|
||||
@ -212,12 +212,25 @@ impl Command {
|
||||
info!(target: "reth::cli", peer_id = %network.peer_id(), local_addr = %network.local_addr(), "Connected to P2P network");
|
||||
debug!(target: "reth::cli", peer_id = ?network.peer_id(), "Full peer ID");
|
||||
|
||||
let (consensus_engine_tx, consensus_engine_rx) = unbounded_channel();
|
||||
|
||||
// Forward genesis as forkchoice state to the consensus engine.
|
||||
// This will allow the downloader to start
|
||||
if self.debug.continuous {
|
||||
info!(target: "reth::cli", "Continuous sync mode enabled");
|
||||
let (tip_tx, _tip_rx) = oneshot::channel();
|
||||
let state = ForkchoiceState {
|
||||
head_block_hash: genesis_hash,
|
||||
finalized_block_hash: genesis_hash,
|
||||
safe_block_hash: genesis_hash,
|
||||
};
|
||||
consensus_engine_tx.send(BeaconEngineMessage::ForkchoiceUpdated {
|
||||
state,
|
||||
payload_attrs: None,
|
||||
tx: tip_tx,
|
||||
})?;
|
||||
}
|
||||
|
||||
let (consensus_engine_tx, consensus_engine_rx) = unbounded_channel();
|
||||
|
||||
// Forward the `debug.tip` as forkchoice state to the consensus engine.
|
||||
// This will initiate the sync up to the provided tip.
|
||||
let _tip_rx = match self.debug.tip {
|
||||
@ -307,6 +320,7 @@ impl Command {
|
||||
pipeline,
|
||||
blockchain_tree.clone(),
|
||||
self.debug.max_block,
|
||||
self.debug.continuous,
|
||||
payload_builder.clone(),
|
||||
consensus_engine_tx,
|
||||
consensus_engine_rx,
|
||||
|
||||
Reference in New Issue
Block a user