diff --git a/htlcswitch/link.go b/htlcswitch/link.go index 8ef618b02..76293fd7a 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -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.