From cdc4aca40f4be75a3ed7a6b37e5c1c84b1b85ecf Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 30 Apr 2019 18:24:52 -0700 Subject: [PATCH] htlcswitch: properly handle direct link malformed HTLC failures In this commit, we fix a bug that caused us to be unable to properly handle malformed HTLC failures from our direct link. Before this commit, we would attempt to decrypt it and fail since it wasn't well formed. In this commit, if its an error for a local payment, and it needed to be converted, then we'll decode it w/o decrypting since it's already plaintext. --- htlcswitch/switch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htlcswitch/switch.go b/htlcswitch/switch.go index f48cbdc9..3e1ad107 100644 --- a/htlcswitch/switch.go +++ b/htlcswitch/switch.go @@ -939,7 +939,7 @@ func (s *Switch) parseFailedPayment(payment *pendingPayment, pkt *htlcPacket, // The payment never cleared the link, so we don't need to // decrypt the error, simply decode it them report back to the // user. - case pkt.localFailure: + case pkt.localFailure || pkt.convertedError: var userErr string r := bytes.NewReader(htlc.Reason) failureMsg, err := lnwire.DecodeFailure(r, 0)