-
Notifications
You must be signed in to change notification settings - Fork 519
Description
This came up in lightningnetwork/lnd#3910. If we have two parties Alice and Bob who exchange the following asynchronous state updates:
Alice Bob
1. ------add----->
2. <--settle/fail--- (covers a locked-in add)
3. <-----sig------
4. ------sig-----> (covers the add in step 1, Bob's commitment has max htlcs now)
5. <-----rev------
6. ------rev----->
7. ------add----->
where the add Alice sends in step 1 gives Bob the max htlcs once locked-in, then is the add that Alice sends in step 7 allowed? My rationale for allowing it is that the settle/fail in step 2 will make room for the add in step 7. Alice's next signature for Bob that covers the add in step 7 must also cover the settle/fail and thus make room on Bob's commitment transaction (in the end Bob will have max htlcs).
There are two places this is mentioned in the spec:
if result would be offering more than the remote's max_accepted_htlcs HTLCs, in the remote commitment transaction:
MUST NOT add an HTLC.
and
if a sending node adds more than receiver max_accepted_htlcs HTLCs to its local commitment transaction [...]:
SHOULD fail the channel.
Since both passages are concerned with the effect on the commitment transaction, which is the hard constraint here, I think allowing the add in step 7 is appropriate and therefore the correct behavior. If an add is sent in step 8, however, that should be rejected as this would overflow Bob's commitment. Thoughts?