Skip to content

Commit

Permalink
Merge pull request #3326 from jkczyz/2024-09-split-router
Browse files Browse the repository at this point in the history
Decouple `MessageRouter` from `Router`
  • Loading branch information
tnull authored Sep 24, 2024
2 parents 66fb520 + cad0985 commit 4e1f1a8
Show file tree
Hide file tree
Showing 12 changed files with 214 additions and 184 deletions.
3 changes: 3 additions & 0 deletions fuzz/src/chanmon_consistency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ type ChanMan<'a> = ChannelManager<
Arc<KeyProvider>,
Arc<FuzzEstimator>,
&'a FuzzRouter,
&'a FuzzRouter,
Arc<dyn Logger>,
>;

Expand Down Expand Up @@ -709,6 +710,7 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
monitor.clone(),
broadcast.clone(),
&router,
&router,
Arc::clone(&logger),
keys_manager.clone(),
keys_manager.clone(),
Expand Down Expand Up @@ -777,6 +779,7 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
chain_monitor: chain_monitor.clone(),
tx_broadcaster: broadcast.clone(),
router: &router,
message_router: &router,
logger,
default_config: config,
channel_monitors: monitor_refs,
Expand Down
2 changes: 2 additions & 0 deletions fuzz/src/full_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ type ChannelMan<'a> = ChannelManager<
Arc<KeyProvider>,
Arc<FuzzEstimator>,
&'a FuzzRouter,
&'a FuzzRouter,
Arc<dyn Logger>,
>;
type PeerMan<'a> = PeerManager<
Expand Down Expand Up @@ -653,6 +654,7 @@ pub fn do_test(mut data: &[u8], logger: &Arc<dyn Logger>) {
monitor.clone(),
broadcast.clone(),
&router,
&router,
Arc::clone(&logger),
keys_manager.clone(),
keys_manager.clone(),
Expand Down
8 changes: 8 additions & 0 deletions lightning-background-processor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1154,6 +1154,13 @@ mod tests {
TestScorer,
>,
>,
Arc<
DefaultMessageRouter<
Arc<NetworkGraph<Arc<test_utils::TestLogger>>>,
Arc<test_utils::TestLogger>,
Arc<KeysManager>,
>,
>,
Arc<test_utils::TestLogger>,
>;

Expand Down Expand Up @@ -1579,6 +1586,7 @@ mod tests {
chain_monitor.clone(),
tx_broadcaster.clone(),
router.clone(),
msg_router.clone(),
logger.clone(),
keys_manager.clone(),
keys_manager.clone(),
Expand Down
10 changes: 7 additions & 3 deletions lightning-block-sync/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ where
/// use lightning::chain::channelmonitor::ChannelMonitor;
/// use lightning::chain::chaininterface::BroadcasterInterface;
/// use lightning::chain::chaininterface::FeeEstimator;
/// use lightning::sign;
/// use lightning::sign::{EntropySource, NodeSigner, SignerProvider};
/// use lightning::ln::channelmanager::{ChannelManager, ChannelManagerReadArgs};
/// use lightning::onion_message::messenger::MessageRouter;
/// use lightning::routing::router::Router;
/// use lightning::sign;
/// use lightning::sign::{EntropySource, NodeSigner, SignerProvider};
/// use lightning::util::config::UserConfig;
/// use lightning::util::logger::Logger;
/// use lightning::util::ser::ReadableArgs;
Expand All @@ -69,6 +70,7 @@ where
/// T: BroadcasterInterface,
/// F: FeeEstimator,
/// R: Router,
/// MR: MessageRouter,
/// L: Logger,
/// C: chain::Filter,
/// P: chainmonitor::Persist<SP::EcdsaSigner>,
Expand All @@ -82,6 +84,7 @@ where
/// tx_broadcaster: &T,
/// fee_estimator: &F,
/// router: &R,
/// message_router: &MR,
/// logger: &L,
/// persister: &P,
/// ) {
Expand All @@ -101,11 +104,12 @@ where
/// chain_monitor,
/// tx_broadcaster,
/// router,
/// message_router,
/// logger,
/// config,
/// vec![&mut monitor],
/// );
/// <(BlockHash, ChannelManager<&ChainMonitor<SP::EcdsaSigner, &C, &T, &F, &L, &P>, &T, &ES, &NS, &SP, &F, &R, &L>)>::read(
/// <(BlockHash, ChannelManager<&ChainMonitor<SP::EcdsaSigner, &C, &T, &F, &L, &P>, &T, &ES, &NS, &SP, &F, &R, &MR, &L>)>::read(
/// &mut Cursor::new(&serialized_manager), read_args).unwrap()
/// };
///
Expand Down
Loading

0 comments on commit 4e1f1a8

Please sign in to comment.