-
Notifications
You must be signed in to change notification settings - Fork 404
Do not fail to load ChannelManager
when we see claiming payments
#3772
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
base: main
Are you sure you want to change the base?
Do not fail to load ChannelManager
when we see claiming payments
#3772
Conversation
👋 Thanks for assigning @valentinewallace as a reviewer! |
bc1a7d0
to
d24c7a3
Compare
d24c7a3
to
47cccb7
Compare
Thanks for implementing this so quickly! |
47cccb7
to
ce09f6f
Compare
} | ||
} | ||
} | ||
|
||
let mut channels_without_preimage = payment_claim.mpp_parts.iter() | ||
.map(|htlc_info| (htlc_info.counterparty_node_id, htlc_info.funding_txo, htlc_info.channel_id)) | ||
.collect::<Vec<_>>(); |
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.
To confirm, the failure occurred at the debug_assert "Entry was added in begin_claiming_payment" ~20 lines down, right?
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.
Yep!
When we begin claiming a payment, we move the tracking of it from `claimable_payments` to `claiming_payments`. This ensures we only ever have one payment which is in the process of being claimed with a given payment hash at a time and lets us keep track of when all parts have been claimed with their `ChannelMonitor`s. However, on startup, we check that failing to move a payment from `claimable_payments` to `claiming_payments` implies that it is not present in `claiming_payments`. This is fine if the payment doesn't exist, but if the payment has already started being claimed, this will fail and we'll refuse to deserialize the `ChannelManager` (with a `debug_assert` failure in debug mode). Here we resolve this by checking if a payment is already being claimed before we attempt to initiate claiming and skip the failing check in that case.
ce09f6f
to
21f829b
Compare
Tweaked the commit message |
When we begin claiming a payment, we move the tracking of it from
claimable_payments
toclaiming_payments
. This ensures we only ever have one payment which is in the process of being claimed with a given payment hash at a time and lets us keep track of when all parts have been claimed with theirChannelMonitor
s.However, on startup, we check that failing to move a payment from
claimable_payments
toclaiming_payments
we check that it is not present inclaiming_payments
. This is fine if the payment doesn't exist, but if the payment has already started being claimed, this will fail and we'll refuse to deserialize theChannelManager
(with adebug_assert
failure in debug mode).Here we resolve this by checking if a payment is already being claimed before we attempt to initiate claiming and skip the failing check in that case.