-
Notifications
You must be signed in to change notification settings - Fork 398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prune channels if either not updated + track pruning time #1735
Prune channels if either not updated + track pruning time #1735
Conversation
Marking this draft until #1649 is merged. |
Alright, sorry for the delay...#1649 has landed so we should be good for a rebase and then good to go here! It did end up with a nice solution for no-std and std using the explicit numbers like you had here, so that should reduce the diff size here. |
b613883
to
ac1c21f
Compare
ac1c21f
to
1769e34
Compare
Codecov ReportBase: 90.72% // Head: 90.73% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1735 +/- ##
==========================================
+ Coverage 90.72% 90.73% +0.01%
==========================================
Files 87 87
Lines 47364 47374 +10
Branches 47364 47374 +10
==========================================
+ Hits 42970 42984 +14
+ Misses 4394 4390 -4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 1769e34
Does what it says on the tin.
Please be attentive to the first commit btw, this is the thing I'm least confident in :) |
Hmm. Right, I didn't really look into why that test would have had a problem with the following commit. Was more checking the removal logic. Maybe someone has an idea otherwise I'll try debug. |
So the issue for the first commit is that the test only fills in one direction of the channel, rather than two. You should consider swapping the first commit with this instead (but maybe with a comment in the function that explains that diff --git a/lightning/src/routing/gossip.rs b/lightning/src/routing/gossip.rs
index 1706e0692..36fe9c135 100644
--- a/lightning/src/routing/gossip.rs
+++ b/lightning/src/routing/gossip.rs
@@ -2573,6 +2573,10 @@ mod tests {
assert!(gossip_sync.handle_channel_update(&valid_channel_update).is_ok());
assert!(network_graph.read_only().channels().get(&short_channel_id).unwrap().one_to_two.is_some());
+ let valid_channel_update_2 = get_signed_channel_update(|update| {update.flags |=1;}, node_2_privkey, &secp_ctx);
+ gossip_sync.handle_channel_update(&valid_channel_update_2).unwrap();
+ assert!(network_graph.read_only().channels().get(&short_channel_id).unwrap().two_to_one.is_some());
+
network_graph.remove_stale_channels_and_tracking_with_time(100 + STALE_CHANNEL_UPDATE_AGE_LIMIT_SECS);
assert_eq!(network_graph.read_only().channels().len(), 1);
assert_eq!(network_graph.read_only().nodes().len(), 2); |
Further, once this and #1815 lands, we should adapt the check in #1815 to check for both directional updates being filled in rather than just one - what will end up happening here is, because we don't persist the removed set, on startup we'll re-sync the channels that only have one directional update filled in, then keep it around until the |
1769e34
to
a2fe5b1
Compare
I pushed a broken code, nvm, fixing. Alright fixed the code but will fix the tests a bit later. |
a2fe5b1
to
1618be5
Compare
lightning/src/routing/router.rs
Outdated
$next_hops_path_htlc_minimum_msat, | ||
$next_hops_path_penalty_msat, | ||
$next_hops_cltv_delta, $next_hops_path_length); | ||
// We consider channels with only one direction filled useless, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to do this at the router
level, but rather directly in as_directed_from/to. This is gonna need a bunch of test updates, though, so may be worth waiting for a followup pr.
1618be5
to
080c70f
Compare
Closes #1671