mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: Pseudo peer and staged sync
For simplicity, we use with_pow() + pseudo peer that connects to reth itself, so that it can support 1. StateFetcher via NetworkState 2. Block announcement (which requires with_pow()). For block announcement, another way was using ImportService like before, or calling engine_api. But for simplicitiy, for now we just publish from pseudo peer like pre-PoS, hence with_pow().
This commit is contained in:
@ -12,6 +12,7 @@ use crate::{
|
||||
},
|
||||
storage::HlStorage,
|
||||
},
|
||||
pseudo_peer::BlockSourceConfig,
|
||||
};
|
||||
use consensus::HlConsensusBuilder;
|
||||
use engine::HlPayloadServiceBuilder;
|
||||
@ -49,12 +50,15 @@ pub type HlNodeAddOns<N> =
|
||||
pub struct HlNode {
|
||||
engine_handle_rx:
|
||||
Arc<Mutex<Option<oneshot::Receiver<BeaconConsensusEngineHandle<HlPayloadTypes>>>>>,
|
||||
block_source_config: BlockSourceConfig,
|
||||
}
|
||||
|
||||
impl HlNode {
|
||||
pub fn new() -> (Self, oneshot::Sender<BeaconConsensusEngineHandle<HlPayloadTypes>>) {
|
||||
pub fn new(
|
||||
block_source_config: BlockSourceConfig,
|
||||
) -> (Self, oneshot::Sender<BeaconConsensusEngineHandle<HlPayloadTypes>>) {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
(Self { engine_handle_rx: Arc::new(Mutex::new(Some(rx))) }, tx)
|
||||
(Self { engine_handle_rx: Arc::new(Mutex::new(Some(rx))), block_source_config }, tx)
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,7 +83,10 @@ impl HlNode {
|
||||
.pool(HlPoolBuilder)
|
||||
.executor(HlExecutorBuilder::default())
|
||||
.payload(HlPayloadServiceBuilder::default())
|
||||
.network(HlNetworkBuilder { engine_handle_rx: self.engine_handle_rx.clone() })
|
||||
.network(HlNetworkBuilder {
|
||||
engine_handle_rx: self.engine_handle_rx.clone(),
|
||||
block_source_config: self.block_source_config.clone(),
|
||||
})
|
||||
.consensus(HlConsensusBuilder::default())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user