From e00840e2ab19274c0d941590f385477e2adf00f2 Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Wed, 6 May 2020 16:28:22 +0200 Subject: [PATCH] htlcswitch: return local add failure to caller Fixes a pre-existing issue where nil was returned when a failure had occurred during commiting of the circuit. --- htlcswitch/switch.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htlcswitch/switch.go b/htlcswitch/switch.go index 1d232374..57c3be67 100644 --- a/htlcswitch/switch.go +++ b/htlcswitch/switch.go @@ -67,6 +67,10 @@ var ( // ErrUnreadableFailureMessage is returned when the failure message // cannot be decrypted. ErrUnreadableFailureMessage = errors.New("unreadable failure message") + + // ErrLocalAddFailed signals that the ADD htlc for a local payment + // failed to be processed. + ErrLocalAddFailed = errors.New("local add HTLC failed") ) // plexPacket encapsulates switch packet and adds error channel to receive @@ -464,7 +468,7 @@ func (s *Switch) SendHTLC(firstHop lnwire.ShortChannelID, paymentID uint64, return ErrDuplicateAdd case len(actions.Fails) == 1: - return err + return ErrLocalAddFailed } // Send packet to link.