Repository navigation
channeld: accept retransmits under the pre-splice reserves and keep ours above both - #109
Merged
Merged
Conversation
Author
|
The four new columns made the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A splice's reserves change when channeld starts for the first connection after the lock. Updates the peer first sent before that change were added under the earlier reserves, and when they are retransmitted after it they can fail the new check. After a splice-in raises the reserve, a retransmitted
update_add_htlcgetsBad peer_add_htlc: CHANNEL_ERR_CHANNEL_CAPACITY_EXCEEDED, and the warning and disconnect repeat on every reconnect until the HTLC times out. A retransmittedupdate_feehits the same loop.pre_splice_reserve_*), so a restart between the lock and the next connection no longer loses them, and at the switch it keeps them as the earlier reserves (earlier_reserve_*) and hands them to channeld.update_add_htlc,update_feeas opener, and the opener check on itscommitment_signed) pass if the earlier reserves allow them, from the switch connection until the peer's firstcommitment_signedon a later connection. A new splice ends that window, so earlier reserves never stack. The window spans the whole switch connection because a peer can switch one connection after us (when it completes the lock from ourchannel_reestablish), and until then it is still sending under the earlier reserves. The most it concedes is the difference between the two reserves.This adds four nullable columns to
channels, so a node that has run this cannot go back to an older release without the downgrade tool, which drops them.Known limits:
listpeerchannelsspendable and receivable amounts use the current reserves, so on the switch connection a payment only the new reserve allows fails locally withCapacity exceeded.Changelog-None
Test plan
test_splice_reserve_retransmit(with and without a restart),test_splice_reserve_leniency_ends,test_splice_reserve_leniency_ends_at_splice(a splice on the switch connection and on a later one),test_splice_reserve_floorandtest_splice_reserve_lost_splice_locked.Bad peer_add_htlc: CHANNEL_ERR_CHANNEL_CAPACITY_EXCEEDED. Without the floor,test_splice_reserve_floordoesn't raise.run-full_channelcovers the peer's adds and a remote opener's feerate under the earlier reserves, and the floor on ours.run-walletsaves and reloads both reserve pairs.tests/test_splicing.py,test_splicing_disconnect.py,test_splicing_insane.py,test_db.pyandtest_downgrade.py: 103 passed, 1 skipped. Reserve tests withEXPERIMENTAL_DUAL_FUND=1: 9 passed.make check-unitspasses.