-
Notifications
You must be signed in to change notification settings - Fork 364
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
Deduplicate PendingHTLCsForwardable
events on generation
#2026
Deduplicate PendingHTLCsForwardable
events on generation
#2026
Conversation
On second glance this needs more work. Will update soon. |
9644d2c
to
6074e8a
Compare
Codecov ReportBase: 87.22% // Head: 87.20% // Decreases project coverage by
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## main #2026 +/- ##
==========================================
- Coverage 87.22% 87.20% -0.02%
==========================================
Files 100 101 +1
Lines 44051 44175 +124
Branches 44051 44175 +124
==========================================
+ Hits 38424 38524 +100
- Misses 5627 5651 +24
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. |
6074e8a
to
6e7c91e
Compare
Ended up having to pull in some changes from #2008 so I based it on that. |
6e7c91e
to
2dcb379
Compare
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.
Tentative LGTM, but I need to do more digging on the retry stuff to understand abandoning in 2dcb379
fn push_pending_forwards_ev(&self) { | ||
let mut pending_events = self.pending_events.lock().unwrap(); | ||
let forward_ev_exists = pending_events.iter() | ||
.find(|ev| if let events::Event::PendingHTLCsForwardable { .. } = ev { true } else { false }) |
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.
Lol if our MSRV was just one minor version up (1.42) we could just
.find(|ev| matches!(ev, events::Event::PendingHTLCsForwardable))
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.
Soclose 🥲
Needs rebase. |
2dcb379
to
91be2cc
Compare
// We only want to push a PendingHTLCsForwardable event if no others are queued. | ||
fn push_pending_forwards_ev(&self) { | ||
let mut pending_events = self.pending_events.lock().unwrap(); | ||
let forward_ev_exists = pending_events.iter() |
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.
Oh, oops, this check isn't sufficient - I mean it reduces duplication, but the issue is we send the user a PendingHTLCsForwardable
event, then they wait (during which time we don't have one lying around here) and then they call pending_htlcs_forwardable
. Avoiding duplicating entirely is gonna be a bit hard, but I think we could at least only have two in-flight ones at once by filtering the outbound_payment
-generated one on needs_abandon
(but under the same lock as the update in fail_htlc).
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.
Ok I see the case we're not covering. I don't think we'd want needs_abandon
, though, seems we'd want a new needs_retry
check IIUC. Will add this. (Note that needs_abandon
should only apply to restart since we set all payments as non-retryable on deser.)
91be2cc
to
a2489b1
Compare
Thanks, LGTM, I think. |
Ensure that when we generate a
PendingHTLCsForwardable
event, there isn't one already queued.Completes the follow-ups from #1916.
Partially addresses #1932.