Skip to content

Commit ed1f649

Browse files
committed
Move routing stuff to a separate module
1 parent 301b842 commit ed1f649

File tree

13 files changed

+22
-19
lines changed

13 files changed

+22
-19
lines changed

fuzz/src/chanmon_consistency.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use lightning::chain::keysinterface::{KeysInterface, InMemoryChannelKeys};
2828
use lightning::ln::channelmonitor;
2929
use lightning::ln::channelmonitor::{ChannelMonitor, ChannelMonitorUpdateErr, HTLCUpdate};
3030
use lightning::ln::channelmanager::{ChannelManager, PaymentHash, PaymentPreimage, PaymentSecret, ChannelManagerReadArgs};
31-
use lightning::ln::router::{Route, RouteHop};
31+
use lightning::routing::router::{Route, RouteHop};
3232
use lightning::ln::features::{ChannelFeatures, InitFeatures, NodeFeatures};
3333
use lightning::ln::msgs::{CommitmentUpdate, ChannelMessageHandler, ErrorAction, UpdateAddHTLC, Init};
3434
use lightning::util::enforcing_trait_impls::EnforcingChannelKeys;

fuzz/src/full_stack.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ use lightning::chain::keysinterface::{InMemoryChannelKeys, KeysInterface};
2424
use lightning::ln::channelmonitor;
2525
use lightning::ln::channelmanager::{ChannelManager, PaymentHash, PaymentPreimage, PaymentSecret};
2626
use lightning::ln::peer_handler::{MessageHandler,PeerManager,SocketDescriptor};
27-
use lightning::ln::router::Router;
28-
use lightning::ln::network_graph::NetworkGraph;
27+
use lightning::routing::router::Router;
28+
use lightning::routing::network_graph::NetworkGraph;
2929
use lightning::util::events::{EventsProvider,Event};
3030
use lightning::util::enforcing_trait_impls::EnforcingChannelKeys;
3131
use lightning::util::logger::Logger;

fuzz/src/router.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ use lightning::ln::channelmanager::ChannelDetails;
88
use lightning::ln::features::InitFeatures;
99
use lightning::ln::msgs;
1010
use lightning::ln::msgs::RoutingMessageHandler;
11-
use lightning::ln::router::{Router, RouteHint};
11+
use lightning::routing::router::{Router, RouteHint};
1212
use lightning::util::logger::Logger;
1313
use lightning::util::ser::Readable;
14-
use lightning::ln::network_graph::{NetworkGraph, RoutingFees};
14+
use lightning::routing::network_graph::{NetworkGraph, RoutingFees};
1515

1616
use secp256k1::key::PublicKey;
1717

lightning/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ extern crate secp256k1;
2828
pub mod util;
2929
pub mod chain;
3030
pub mod ln;
31+
pub mod routing;

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use chain::transaction::OutPoint;
3030
use ln::channel::{Channel, ChannelError};
3131
use ln::channelmonitor::{ChannelMonitor, ChannelMonitorUpdate, ChannelMonitorUpdateErr, ManyChannelMonitor, HTLC_FAIL_BACK_BUFFER, CLTV_CLAIM_BUFFER, LATENCY_GRACE_PERIOD_BLOCKS, ANTI_REORG_DELAY};
3232
use ln::features::{InitFeatures, NodeFeatures};
33-
use ln::router::{Route, RouteHop};
33+
use routing::router::{Route, RouteHop};
3434
use ln::msgs;
3535
use ln::onion_utils;
3636
use ln::msgs::{ChannelMessageHandler, DecodeError, LightningError};

lightning/src/ln/functional_test_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ 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};
10-
use ln::network_graph::{NetworkGraph, NetworkGraphReadArgs};
9+
use routing::router::{Route, Router};
10+
use routing::network_graph::{NetworkGraph, NetworkGraphReadArgs};
1111
use ln::features::InitFeatures;
1212
use ln::msgs;
1313
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: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! High level lightning structs and impls live here.
22
//!
3-
//! You probably want to create a channelmanager::ChannelManager, and a router::Router first.
3+
//! You probably want to create a channelmanager::ChannelManager, and a routing::router::Router first.
44
//! Then, you probably want to pass them both on to a peer_handler::PeerManager and use that to
55
//! create/manage connections and call get_and_clear_pending_events after each action, handling
66
//! them appropriately.
@@ -12,8 +12,6 @@
1212
pub mod channelmanager;
1313
pub mod channelmonitor;
1414
pub mod msgs;
15-
pub mod router;
16-
pub mod network_graph;
1715
pub mod peer_handler;
1816
pub mod chan_utils;
1917
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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//! Structs and impls for receiving messages about the network and storing the topology live here.
2+
3+
pub mod router;
4+
pub mod network_graph;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ impl RoutingMessageHandler for NetworkGraph {
756756
mod tests {
757757
use chain::chaininterface;
758758
use ln::features::{ChannelFeatures, NodeFeatures};
759-
use ln::network_graph::{NetworkGraph, NetworkMap, DirectionalChannelInfo, ChannelInfo, NodeInfo, RoutingFees};
759+
use routing::network_graph::{NetworkGraph, NetworkMap, DirectionalChannelInfo, ChannelInfo, NodeInfo, RoutingFees};
760760
use ln::msgs::{RoutingMessageHandler, UnsignedNodeAnnouncement, NodeAnnouncement,
761761
UnsignedChannelAnnouncement, ChannelAnnouncement, UnsignedChannelUpdate, ChannelUpdate, HTLCFailChannelUpdate};
762762
use util::test_utils;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use secp256k1::key::PublicKey;
88
use ln::channelmanager;
99
use ln::features::{ChannelFeatures, NodeFeatures};
1010
use ln::msgs::{DecodeError,ErrorAction,LightningError};
11-
use ln::network_graph::{NetworkGraph, RoutingFees};
11+
use routing::network_graph::{NetworkGraph, RoutingFees};
1212
use util::ser::{Writeable, Readable};
1313
use util::logger::Logger;
1414

@@ -401,8 +401,8 @@ impl Router {
401401
#[cfg(test)]
402402
mod tests {
403403
use chain::chaininterface;
404-
use ln::network_graph::{NetworkGraph, NodeInfo, NetworkMap, ChannelInfo, DirectionalChannelInfo, RoutingFees};
405-
use ln::router::{Router, RouteHint};
404+
use routing::network_graph::{NetworkGraph, NodeInfo, NetworkMap, ChannelInfo, DirectionalChannelInfo, RoutingFees};
405+
use routing::router::{Router, RouteHint};
406406
use ln::features::{ChannelFeatures, InitFeatures, NodeFeatures};
407407
use ln::msgs::{ErrorAction, LightningError};
408408
use ln::channelmanager;

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_hashes::sha256d::Hash as Sha256dHash;
55
use bitcoin::blockdata::transaction::Transaction;
66
use 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)