Lower strictness of pending monitor update while awaiting tx_signatures#4748
Conversation
|
👋 Thanks for assigning @jkczyz as a reviewer! |
|
No issues found. I re-reviewed all hunks in this PR (the loosened
No new defects beyond my prior pass. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4748 +/- ##
==========================================
+ Coverage 84.55% 86.94% +2.39%
==========================================
Files 137 161 +24
Lines 77617 111632 +34015
Branches 77617 111632 +34015
==========================================
+ Hits 65627 97064 +31437
- Misses 9948 12060 +2112
- Partials 2042 2508 +466
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| splice_locked: None, | ||
| }; | ||
| if self.is_awaiting_monitor_update() { | ||
| if self.is_awaiting_monitor_update() && holder_tx_signatures.is_some() { |
There was a problem hiding this comment.
Not sure I understand this, isn't it the case that we can get a pending monitor update from a preimage no matter the state, so shouldn't we be able to hit this even if we don't have a holder sigs to send? Shouldn't we instead move the monitor_pending_tx_signatures check into the if here?
| ))); | ||
| } | ||
|
|
||
| if !session.has_received_commitment_signed() { |
There was a problem hiding this comment.
Can you explain this change? Maybe in the commit message?
There was a problem hiding this comment.
At least according to the docs on expecting_peer_commitment_signed, we were using it incorrectly as it's only meant for channel updates. If it was being used as a signal to disconnect if not sent in a timely manner, then it's unnecessary to track this as we're already quiescent within this path and can rely on that signal instead to disconnect.
| splice_locked: None, | ||
| }; | ||
| if self.is_awaiting_monitor_update() { | ||
| if self.is_awaiting_monitor_update() && holder_tx_signatures.is_some() { |
There was a problem hiding this comment.
If holder_tx_signatures is None will we hit the debug_assert in the else clause below on line 9715?
There was a problem hiding this comment.
I don't think that's reachable because we can't process their tx_signatures without processing their initial commitment_signed first, and we only process that after the user has called back with funding_transaction_signed.
The use of `expecting_peer_commitment_signed` was being used as a way to signal that we must disconnect if the message is not sent in a timely manner. This isn't necessary, as we're already quiescent within this flow, and can disconnect via that signal instead.
We previously assumed that no monitor update should ever be pending when receiving `tx_signatures` while quiescent, with the exception of the `RenegotiatedFunding` variant. This was a bit too strict, as we did not consider that if an HTLC was sent via the same channel, its preimage could be received from upstream leading to a monitor update to durably persist it. This commit ensures that if the recipient of a `tx_signatures` has not yet echoed theirs back, and it is awaiting a monitor update completion, then the pending monitor update must be of the `RenegotiatedFunding` variant. If the pending monitor update is of another variant, then we must remain quiescent with no pending updates available to send until after the `tx_signatures` exchange.
c583fa7 to
b8a76c1
Compare
We previously assumed that no monitor update should ever be pending when receiving
tx_signatureswhile quiescent, with the exception of theRenegotiatedFundingvariant. This was a bit too strict, as we did not consider that if an HTLC was sent via the same channel, its preimage could be received from upstream leading to a monitor update to durably persist it.This commit ensures that if the recipient of a
tx_signatureshas not yet echoed theirs back, and it is awaiting a monitor update completion, then the pending monitor update must be of theRenegotiatedFundingvariant. If the pending monitor update is of another variant, then we must remain quiescent with no pending updates available to send until after thetx_signaturesexchange.Fixes #4729.