diff --git a/routing/missioncontrol.go b/routing/missioncontrol.go index c4f0157e9..ee6b0c824 100644 --- a/routing/missioncontrol.go +++ b/routing/missioncontrol.go @@ -395,7 +395,7 @@ func (m *MissionControl) GetHistorySnapshot() *MissionControlSnapshot { // returns a bool indicating whether this error is a final error. If it is // final, a failure reason is returned and no further payment attempts need to // be made. -func (m *MissionControl) ReportPaymentFail(rt *route.Route, +func (m *MissionControl) ReportPaymentFail(paymentID uint64, rt *route.Route, failureSourceIdx *int, failure lnwire.FailureMessage) (bool, channeldb.FailureReason) { diff --git a/routing/missioncontrol_test.go b/routing/missioncontrol_test.go index 21c835f1e..1675b044e 100644 --- a/routing/missioncontrol_test.go +++ b/routing/missioncontrol_test.go @@ -37,6 +37,7 @@ type mcTestContext struct { t *testing.T mc *MissionControl now time.Time + pid uint64 } func createMcTestContext(t *testing.T) *mcTestContext { @@ -78,7 +79,7 @@ func (ctx *mcTestContext) reportFailure(t time.Time, errorSourceIdx := 1 ctx.mc.ReportPaymentFail( - mcTestRoute, &errorSourceIdx, failure, + ctx.pid, mcTestRoute, &errorSourceIdx, failure, ) } diff --git a/routing/mock_test.go b/routing/mock_test.go index eae42f6fd..b0444546b 100644 --- a/routing/mock_test.go +++ b/routing/mock_test.go @@ -98,9 +98,9 @@ type mockMissionControl struct { var _ MissionController = (*mockMissionControl)(nil) -func (m *mockMissionControl) ReportPaymentFail(rt *route.Route, - failureSourceIdx *int, failure lnwire.FailureMessage) (bool, - channeldb.FailureReason) { +func (m *mockMissionControl) ReportPaymentFail(paymentID uint64, + rt *route.Route, failureSourceIdx *int, failure lnwire.FailureMessage) ( + bool, channeldb.FailureReason) { return false, 0 } diff --git a/routing/payment_lifecycle.go b/routing/payment_lifecycle.go index 4de85b5dc..db9b9803b 100644 --- a/routing/payment_lifecycle.go +++ b/routing/payment_lifecycle.go @@ -343,7 +343,7 @@ func (p *paymentLifecycle) sendPaymentAttempt(firstHop lnwire.ShortChannelID, func (p *paymentLifecycle) handleSendError(sendErr error) error { final, reason := p.router.processSendError( - &p.attempt.Route, sendErr, + p.attempt.PaymentID, &p.attempt.Route, sendErr, ) if !final { // Save the forwarding error so it can be returned if diff --git a/routing/router.go b/routing/router.go index 8b3143e91..edc3aa3a1 100644 --- a/routing/router.go +++ b/routing/router.go @@ -178,7 +178,7 @@ type MissionController interface { // input for future probability estimates. It returns a bool indicating // whether this error is a final error and no further payment attempts // need to be made. - ReportPaymentFail(rt *route.Route, + ReportPaymentFail(paymentID uint64, rt *route.Route, failureSourceIdx *int, failure lnwire.FailureMessage) (bool, channeldb.FailureReason) @@ -1893,13 +1893,15 @@ func (r *ChannelRouter) tryApplyChannelUpdate(rt *route.Route, // error type, this error is either the final outcome of the payment or we need // to continue with an alternative route. This is indicated by the boolean // return value. -func (r *ChannelRouter) processSendError(rt *route.Route, sendErr error) (bool, - channeldb.FailureReason) { +func (r *ChannelRouter) processSendError(paymentID uint64, rt *route.Route, + sendErr error) (bool, channeldb.FailureReason) { if sendErr == htlcswitch.ErrUnreadableFailureMessage { log.Tracef("Unreadable failure when sending htlc") - return r.cfg.MissionControl.ReportPaymentFail(rt, nil, nil) + return r.cfg.MissionControl.ReportPaymentFail( + paymentID, rt, nil, nil, + ) } // If an internal, non-forwarding error occurred, we can stop // trying. @@ -1926,7 +1928,7 @@ func (r *ChannelRouter) processSendError(rt *route.Route, sendErr error) (bool, failureSourceIdx) return r.cfg.MissionControl.ReportPaymentFail( - rt, &failureSourceIdx, failureMessage, + paymentID, rt, &failureSourceIdx, failureMessage, ) }