lnd
lnd copied to clipboard
lnwallet+peer: properly process update_fee messages sent after a shutdown has been initiated
Today when we receive a shutdown requests, we'll remove the link from the switch entirely also (https://github.com/lightningnetwork/lnd/blob/ddeccf8fcc083c2c0167b6b50a684ab4c8cfd5b3/peer/brontide.go#L2695-L2701). This means that any inbound messages to the link will be dropped from the peer's readHandler
. This was fine when we wanted to not process any further updates, but breaks down given that the spec requires (being updated to make this more clear) that one still process updateFee
messages after a shutdown has been sent (but before the first closing signed).
What we should still remove the link from the switch and send out a disable, but we need to special case for the sig+revoke and UpdateFee
messages when we're in this state. One way to do this (given we already have the channel struct at that point) would be to manually feed in these messages into the channel state machine.
Steps To Completion
- [ ] Update the
readHandler
loop to send any update messages post channel close into the chan closer - [ ] Have the chan close then manually apply only the
UpdateFee
message, generating the corresponding messages needed to fully lock in the change.
I have a partial branch for this that puts the link in shutdown mode where it won't route any htlc's. It still needs to be able to fail existing htlc's and send fee messages, but it always makes progress towards the eventual closing_signed state
prioed for 17