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.
This commit is contained in:
parent
c67ca0a329
commit
cdc4aca40f
@ -939,7 +939,7 @@ func (s *Switch) parseFailedPayment(payment *pendingPayment, pkt *htlcPacket,
|
|||||||
// The payment never cleared the link, so we don't need to
|
// The payment never cleared the link, so we don't need to
|
||||||
// decrypt the error, simply decode it them report back to the
|
// decrypt the error, simply decode it them report back to the
|
||||||
// user.
|
// user.
|
||||||
case pkt.localFailure:
|
case pkt.localFailure || pkt.convertedError:
|
||||||
var userErr string
|
var userErr string
|
||||||
r := bytes.NewReader(htlc.Reason)
|
r := bytes.NewReader(htlc.Reason)
|
||||||
failureMsg, err := lnwire.DecodeFailure(r, 0)
|
failureMsg, err := lnwire.DecodeFailure(r, 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user