-
Notifications
You must be signed in to change notification settings - Fork 410
Add missing pending FundingScope
checks
#3811
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?
Conversation
👋 I see @wpaulino was un-assigned. |
👋 The first review has been submitted! Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer. |
bc3ede2
to
30ac751
Compare
Good to squash |
30ac751
to
c6b2d01
Compare
Oops, sorry more fixups to address lint checks. |
@wpaulino Any thoughts on moving the helpers to |
Hm yeah I guess we could, let's do the move in its own commit then. Feel free to squash also. |
If there are any pending splices when an update_add_htlc message is received, it must be validated against each pending FundingScope. Otherwise, the HTLC could be invalid once the splice is locked.
If there are any pending splices when a revoke_and_ack message is received, FundingScope::value_to_self_msat needs to be updated for each. Otherwise, the promoted FundingScope will be invalid when the splice is locked.
If there are any pending splices when an update_fee message is received, it must be validated against each pending FundingScope. Otherwise, it may be invalid once the splice is locked.
If there are any pending splices when an sending an update_fee message, the new fee rate must be validated against each pending FundingScope. Otherwise, it may be invalid once the splice is locked.
If there are any pending splices when an accepting an incoming HTLC, the HTLC needs to be validated against each pending FundingScope. Otherwise, once the splice is locked, the HTLC could have been failed when it should have been forwarded / claimed, or vice versa, under the promoted FundingScope.
If there are any pending splices when an sending an update_add_htlc message, the HTLC amount must be validated against each pending FundingScope. Otherwise, it may be invalid once the splice is locked.
Previous commits refactored validation checks in FundedChannel to work on a specific FundingScope. However, keeping these helpers in FundedChannel doesn't prevent them from using self.funding inadvertently instead of the passed in FundingScope. Move these helpers to ChannelContext to avoid this problem, as we done with similar helpers.
c6b2d01
to
b6a92da
Compare
Made a separate commit. Squashed fixups except for the last one in case the second reviewer disagrees on dropping that check. |
When sending or receiving
update_add_htlc
,update_fee
, orrevoke_and_ack
messages, check that the messages (or amount or fee rates, as is appropriate) are valid for any pendingFundingScope
. Otherwise, the promotedFundingScope
will be invalid when the splice is locked.This assumes
FundingScope::is_outbound
is the same across allFundingScope
s. This PR does not fix similar issues for funding negotiation and funding confirmation, which should be handled in #3736 and #3741, respectively.