mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 22:25:24 +01:00
htlcswitch: bounce downstream adds when flushing
This commit is contained in:
parent
5ab69aedc7
commit
a9d5235c62
1 changed files with 11 additions and 0 deletions
|
@ -1457,6 +1457,17 @@ func (l *channelLink) handleDownstreamUpdateAdd(pkt *htlcPacket) error {
|
|||
return errors.New("not an UpdateAddHTLC packet")
|
||||
}
|
||||
|
||||
// If we are flushing the link in the outgoing direction we can't add
|
||||
// new htlcs to the link and we need to bounce it
|
||||
if l.IsFlushing(Outgoing) {
|
||||
l.mailBox.FailAdd(pkt)
|
||||
|
||||
return NewDetailedLinkError(
|
||||
&lnwire.FailPermanentChannelFailure{},
|
||||
OutgoingFailureLinkNotEligible,
|
||||
)
|
||||
}
|
||||
|
||||
// If hodl.AddOutgoing mode is active, we exit early to simulate
|
||||
// arbitrary delays between the switch adding an ADD to the
|
||||
// mailbox, and the HTLC being added to the commitment state.
|
||||
|
|
Loading…
Add table
Reference in a new issue