Skip to content

Commit de4c0a4

Browse files
authored
Merge branch 'lightningdevkit:main' into issue438
2 parents 53b6738 + 8e5cf75 commit de4c0a4

31 files changed

+1051
-682
lines changed

ARCH.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ receive `ChannelMonitorUpdate`s from `ChannelManager` and persist them to disk b
1111
channel steps forward.
1212

1313
There are two additional important structures that you may use either on the same device
14-
as the `ChannelManager` or on a separate one. `NetGraphMsgHandler` handles receiving channel
15-
and node announcements, which are then used to calculate routes by `get_route` for sending payments.
16-
`PeerManager` handles the authenticated and encrypted communication protocol,
17-
monitoring for liveness of peers, routing messages to `ChannelManager` and `NetGraphMsgHandler`
14+
as the `ChannelManager` or on a separate one. `P2PGossipSync` handles receiving channel
15+
and node announcements, which are then used to calculate routes by `find_route` for sending
16+
payments. `PeerManager` handles the authenticated and encrypted communication protocol,
17+
monitoring for liveness of peers, routing messages to `ChannelManager` and `P2PGossipSync`
1818
instances directly, and receiving messages from them via the `EventsProvider` interface.
1919

2020
These structs communicate with each other using a public API, so that you can easily add
@@ -56,7 +56,7 @@ At a high level, some of the common interfaces fit together as follows:
5656
| ----------------- \ / ----------------
5757
| ^ \ / |
5858
(as RoutingMessageHandler) | v v
59-
\ ---------------------- --------- -----------------
60-
-----------------> | NetGraphMsgHandler | | Event | | chain::Filter |
61-
---------------------- --------- -----------------
59+
\ ----------------- --------- -----------------
60+
-----------------> | P2PGossipSync | | Event | | chain::Filter |
61+
----------------- --------- -----------------
6262
```

CONTRIBUTING.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ be covered by functional tests.
7575
When refactoring, structure your PR to make it easy to review and don't
7676
hesitate to split it into multiple small, focused PRs.
7777

78-
The Minimum Supported Rust Version is 1.41.1 (enforced by our GitHub Actions).
78+
The Minimum Supported Rust Version (MSRV) currently is 1.41.1 (enforced by
79+
our GitHub Actions). Also, the compatibility for LDK object serialization is
80+
currently ensured back to and including crate version 0.0.99 (see the
81+
[changelog](CHANGELOG.md)).
7982

8083
Commits should cover both the issue fixed and the solution's rationale.
8184
These [guidelines](https://chris.beams.io/posts/git-commit/) should be kept in mind.

fuzz/src/full_stack.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use lightning::ln::channelmanager::{ChainParameters, ChannelManager};
3737
use lightning::ln::peer_handler::{MessageHandler,PeerManager,SocketDescriptor,IgnoringMessageHandler};
3838
use lightning::ln::msgs::DecodeError;
3939
use lightning::ln::script::ShutdownScript;
40-
use lightning::routing::network_graph::{NetGraphMsgHandler, NetworkGraph};
40+
use lightning::routing::gossip::{P2PGossipSync, NetworkGraph};
4141
use lightning::routing::router::{find_route, PaymentParameters, RouteParameters};
4242
use lightning::routing::scoring::FixedPenaltyScorer;
4343
use lightning::util::config::UserConfig;
@@ -163,7 +163,7 @@ type ChannelMan = ChannelManager<
163163
EnforcingSigner,
164164
Arc<chainmonitor::ChainMonitor<EnforcingSigner, Arc<dyn chain::Filter>, Arc<TestBroadcaster>, Arc<FuzzEstimator>, Arc<dyn Logger>, Arc<TestPersister>>>,
165165
Arc<TestBroadcaster>, Arc<KeyProvider>, Arc<FuzzEstimator>, Arc<dyn Logger>>;
166-
type PeerMan<'a> = PeerManager<Peer<'a>, Arc<ChannelMan>, Arc<NetGraphMsgHandler<Arc<NetworkGraph>, Arc<dyn chain::Access>, Arc<dyn Logger>>>, Arc<dyn Logger>, IgnoringMessageHandler>;
166+
type PeerMan<'a> = PeerManager<Peer<'a>, Arc<ChannelMan>, Arc<P2PGossipSync<Arc<NetworkGraph>, Arc<dyn chain::Access>, Arc<dyn Logger>>>, Arc<dyn Logger>, IgnoringMessageHandler>;
167167

168168
struct MoneyLossDetector<'a> {
169169
manager: Arc<ChannelMan>,
@@ -396,13 +396,13 @@ pub fn do_test(data: &[u8], logger: &Arc<dyn Logger>) {
396396
keys_manager.counter.fetch_sub(1, Ordering::AcqRel);
397397
let our_id = PublicKey::from_secret_key(&Secp256k1::signing_only(), &keys_manager.get_node_secret(Recipient::Node).unwrap());
398398
let network_graph = Arc::new(NetworkGraph::new(genesis_block(network).block_hash()));
399-
let net_graph_msg_handler = Arc::new(NetGraphMsgHandler::new(Arc::clone(&network_graph), None, Arc::clone(&logger)));
399+
let gossip_sync = Arc::new(P2PGossipSync::new(Arc::clone(&network_graph), None, Arc::clone(&logger)));
400400
let scorer = FixedPenaltyScorer::with_penalty(0);
401401

402402
let peers = RefCell::new([false; 256]);
403403
let mut loss_detector = MoneyLossDetector::new(&peers, channelmanager.clone(), monitor.clone(), PeerManager::new(MessageHandler {
404404
chan_handler: channelmanager.clone(),
405-
route_handler: net_graph_msg_handler.clone(),
405+
route_handler: gossip_sync.clone(),
406406
}, our_network_key, &[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0], Arc::clone(&logger), IgnoringMessageHandler{}));
407407

408408
let mut should_forward = false;

fuzz/src/process_network_graph.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
// Import that needs to be added manually
1+
// Imports that need to be added manually
2+
use lightning_rapid_gossip_sync::RapidGossipSync;
23
use utils::test_logger;
34

45
/// Actual fuzz test, method signature and name are fixed
56
fn do_test(data: &[u8]) {
67
let block_hash = bitcoin::BlockHash::default();
7-
let network_graph = lightning::routing::network_graph::NetworkGraph::new(block_hash);
8-
lightning_rapid_gossip_sync::processing::update_network_graph(&network_graph, data);
8+
let network_graph = lightning::routing::gossip::NetworkGraph::new(block_hash);
9+
let rapid_sync = RapidGossipSync::new(&network_graph);
10+
let _ = rapid_sync.update_network_graph(data);
911
}
1012

1113
/// Method that needs to be added manually, {name}_test

fuzz/src/router.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ use lightning::chain::transaction::OutPoint;
1616
use lightning::ln::channelmanager::{ChannelDetails, ChannelCounterparty};
1717
use lightning::ln::features::InitFeatures;
1818
use lightning::ln::msgs;
19+
use lightning::routing::gossip::{NetworkGraph, RoutingFees};
1920
use lightning::routing::router::{find_route, PaymentParameters, RouteHint, RouteHintHop, RouteParameters};
2021
use lightning::routing::scoring::FixedPenaltyScorer;
2122
use lightning::util::logger::Logger;
2223
use lightning::util::ser::Readable;
23-
use lightning::routing::network_graph::{NetworkGraph, RoutingFees};
2424

2525
use bitcoin::hashes::Hash;
2626
use bitcoin::secp256k1::PublicKey;
@@ -196,7 +196,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
196196
},
197197
4 => {
198198
let short_channel_id = slice_to_be64(get_slice!(8));
199-
net_graph.close_channel_from_update(short_channel_id, false);
199+
net_graph.channel_failed(short_channel_id, false);
200200
},
201201
_ if node_pks.is_empty() => {},
202202
_ => {

lightning-background-processor/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ rustdoc-args = ["--cfg", "docsrs"]
1616
[dependencies]
1717
bitcoin = "0.28.1"
1818
lightning = { version = "0.0.106", path = "../lightning", features = ["std"] }
19+
lightning-rapid-gossip-sync = { version = "0.0.106", path = "../lightning-rapid-gossip-sync" }
1920

2021
[dev-dependencies]
2122
lightning = { version = "0.0.106", path = "../lightning", features = ["_test_utils"] }

0 commit comments

Comments
 (0)