routing: remove paymentFailureInfo

We can remove paymentFailureInfo since we can gate the result
interpretation on the source index, meaning that if we don't have a
source index, we deal with an unknown payment outcome because we
couldn't pinpoint the failing hop.
This commit is contained in:
bitromortac
2025-04-30 15:23:21 +02:00
parent e5c541407f
commit 4498a78cb0
2 changed files with 30 additions and 103 deletions

View File

@@ -126,7 +126,9 @@ func (i *interpretedResult) processSuccess(route *mcRoute) {
// processFail processes a failed payment attempt.
func (i *interpretedResult) processFail(rt *mcRoute, failure paymentFailure) {
if failure.info.IsNone() {
// Not having a source index means that we were unable to decrypt the
// error message.
if failure.sourceIdx.IsNone() {
i.processPaymentOutcomeUnknown(rt)
return
}
@@ -136,16 +138,14 @@ func (i *interpretedResult) processFail(rt *mcRoute, failure paymentFailure) {
failMsg lnwire.FailureMessage
)
failure.info.WhenSome(
func(r tlv.RecordT[tlv.TlvType0, paymentFailureInfo]) {
r.Val.sourceIdx.WhenSome(
func(r tlv.RecordT[tlv.TlvType0, uint8]) {
idx = int(r.Val)
},
)
failure.sourceIdx.WhenSome(
func(r tlv.RecordT[tlv.TlvType0, uint8]) {
idx = int(r.Val)
failure.msg.WhenSome(
func(r tlv.RecordT[tlv.TlvType1,
failureMessage]) {
r.Val.msg.WhenSome(
func(r tlv.RecordT[tlv.TlvType1, failureMessage]) {
failMsg = r.Val.FailureMessage
},
)