diff --git a/itest/lntest/lnd_node.go b/itest/lntest/lnd_node.go index 4b376329..d2d6dafe 100644 --- a/itest/lntest/lnd_node.go +++ b/itest/lntest/lnd_node.go @@ -639,7 +639,30 @@ func (n *LndNode) PayViaRoute(amountMsat uint64, paymentHash []byte, paymentSecr } if resp.PaymentRoute == nil { - n.harness.T.Fatal(fmt.Errorf("missing payment route after pay")) + payments, err := n.runtime.rpc.ListPayments(n.harness.Ctx, &lnd.ListPaymentsRequest{ + IncludeIncomplete: true, + }) + CheckError(n.harness.T, err) + + paymentHashStr := hex.EncodeToString(paymentHash) + for _, payment := range payments.Payments { + if payment.PaymentHash != paymentHashStr { + continue + } + + switch payment.Htlcs[0].Failure.Code { + case lnd.Failure_TEMPORARY_CHANNEL_FAILURE: + return nil, fmt.Errorf("WIRE_TEMPORARY_CHANNEL_FAILURE") + case lnd.Failure_UNKNOWN_NEXT_PEER: + return nil, fmt.Errorf("WIRE_UNKNOWN_NEXT_PEER") + case lnd.Failure_UNKNOWN_FAILURE: + return nil, fmt.Errorf("WIRE_TEMPORARY_CHANNEL_FAILURE") + case lnd.Failure_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS + return nil, fmt.Errorf("WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS") + } + } + + return nil, fmt.Errorf("missing payment route after pay") } lastHop := resp.PaymentRoute.Hops[len(resp.PaymentRoute.Hops)-1]