Skip to content

Commit 982f58e

Browse files
committed
Move router to a separate module
1 parent 9098240 commit 982f58e

File tree

9 files changed

+13
-9
lines changed

9 files changed

+13
-9
lines changed

lightning/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ extern crate bitcoin;
2626
pub mod util;
2727
pub mod chain;
2828
pub mod ln;
29+
pub mod routing;
30+

lightning/src/ln/channelmanager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! responsible for tracking which channels are open, HTLCs are in flight and reestablishing those
55
//! upon reconnect to the relevant peer(s).
66
//!
7-
//! It does not manage routing logic (see ln::router for that) nor does it manage constructing
7+
//! It does not manage routing logic (see routing::router for that) nor does it manage constructing
88
//! on-chain transactions (it only monitors the chain to watch for any force-closes that might
99
//! imply it needs to fail HTLCs/payments/channels it manages).
1010
@@ -31,7 +31,7 @@ use chain::transaction::OutPoint;
3131
use ln::channel::{Channel, ChannelError};
3232
use ln::channelmonitor::{ChannelMonitor, ChannelMonitorUpdate, ChannelMonitorUpdateErr, ManyChannelMonitor, HTLC_FAIL_BACK_BUFFER, CLTV_CLAIM_BUFFER, LATENCY_GRACE_PERIOD_BLOCKS, ANTI_REORG_DELAY};
3333
use ln::features::{InitFeatures, NodeFeatures};
34-
use ln::router::{Route, RouteHop};
34+
use routing::router::{Route, RouteHop};
3535
use ln::msgs;
3636
use ln::onion_utils;
3737
use ln::msgs::{ChannelMessageHandler, DecodeError, LightningError};

lightning/src/ln/functional_test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use chain::transaction::OutPoint;
66
use chain::keysinterface::KeysInterface;
77
use ln::channelmanager::{ChannelManager, ChannelManagerReadArgs, RAACommitmentOrder, PaymentPreimage, PaymentHash, PaymentSecret, PaymentSendFailure};
88
use ln::channelmonitor::{ChannelMonitor, ManyChannelMonitor};
9-
use ln::router::{Route, Router, RouterReadArgs};
9+
use routing::router::{Route, Router, RouterReadArgs};
1010
use ln::features::InitFeatures;
1111
use ln::msgs;
1212
use ln::msgs::{ChannelMessageHandler,RoutingMessageHandler};

lightning/src/ln/functional_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use ln::channelmonitor::{ChannelMonitor, CLTV_CLAIM_BUFFER, LATENCY_GRACE_PERIOD
1212
use ln::channelmonitor;
1313
use ln::channel::{Channel, ChannelError};
1414
use ln::{chan_utils, onion_utils};
15-
use ln::router::{Route, RouteHop};
15+
use routing::router::{Route, RouteHop};
1616
use ln::features::{ChannelFeatures, InitFeatures, NodeFeatures};
1717
use ln::msgs;
1818
use ln::msgs::{ChannelMessageHandler,RoutingMessageHandler,HTLCFailChannelUpdate, ErrorAction};

lightning/src/ln/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
pub mod channelmanager;
1313
pub mod channelmonitor;
1414
pub mod msgs;
15-
pub mod router;
1615
pub mod peer_handler;
1716
pub mod chan_utils;
1817
pub mod features;

lightning/src/ln/onion_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use ln::channelmanager::{PaymentHash, PaymentSecret, HTLCSource};
22
use ln::msgs;
3-
use ln::router::RouteHop;
3+
use routing::router::RouteHop;
44
use util::byte_utils;
55
use util::chacha20::ChaCha20;
66
use util::errors::{self, APIError};
@@ -472,7 +472,7 @@ pub(super) fn process_onion_failure<T: secp256k1::Signing>(secp_ctx: &Secp256k1<
472472
mod tests {
473473
use ln::channelmanager::PaymentHash;
474474
use ln::features::{ChannelFeatures, NodeFeatures};
475-
use ln::router::{Route, RouteHop};
475+
use routing::router::{Route, RouteHop};
476476
use ln::msgs;
477477
use util::ser::{Writeable, Writer};
478478

lightning/src/routing/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//! Structs and impls for receiving messages about the network and storing the topology live here.
2+
3+
pub mod router;

lightning/src/ln/router.rs renamed to lightning/src/routing/router.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ impl Router {
10771077
mod tests {
10781078
use chain::chaininterface;
10791079
use ln::channelmanager;
1080-
use ln::router::{Router,NodeInfo,NetworkMap,ChannelInfo,DirectionalChannelInfo,RouteHint};
1080+
use routing::router::{Router,NodeInfo,NetworkMap,ChannelInfo,DirectionalChannelInfo,RouteHint};
10811081
use ln::features::{ChannelFeatures, InitFeatures, NodeFeatures};
10821082
use ln::msgs::{ErrorAction, LightningError, RoutingMessageHandler, UnsignedNodeAnnouncement, NodeAnnouncement,
10831083
UnsignedChannelAnnouncement, ChannelAnnouncement, UnsignedChannelUpdate, ChannelUpdate, HTLCFailChannelUpdate};

lightning/src/util/macro_logger.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use bitcoin::hash_types::Txid;
55
use bitcoin::blockdata::transaction::Transaction;
66
use bitcoin::secp256k1::key::PublicKey;
77

8-
use ln::router::Route;
8+
use routing::router::Route;
99
use ln::chan_utils::HTLCType;
1010

1111
use std;

0 commit comments

Comments
 (0)