@@ -368,7 +368,9 @@ func (p *paymentLifecycle) checkContext(ctx context.Context) error {
368368 // inflight HTLCs or not, its status will now either be
369369 // `StatusInflight` or `StatusFailed`. In either case, no more
370370 // HTLCs will be attempted.
371- err := p .router .cfg .Control .FailPayment (p .identifier , reason )
371+ err := p .router .cfg .Control .FailPayment (
372+ ctx , p .identifier , reason ,
373+ )
372374 if err != nil {
373375 return fmt .Errorf ("FailPayment got %w" , err )
374376 }
@@ -389,6 +391,8 @@ func (p *paymentLifecycle) checkContext(ctx context.Context) error {
389391func (p * paymentLifecycle ) requestRoute (
390392 ps * paymentsdb.MPPaymentState ) (* route.Route , error ) {
391393
394+ ctx := context .TODO ()
395+
392396 remainingFees := p .calcFeeBudget (ps .FeesPaid )
393397
394398 // Query our payment session to construct a route.
@@ -430,7 +434,9 @@ func (p *paymentLifecycle) requestRoute(
430434 log .Warnf ("Marking payment %v permanently failed with no route: %v" ,
431435 p .identifier , failureCode )
432436
433- err = p .router .cfg .Control .FailPayment (p .identifier , failureCode )
437+ err = p .router .cfg .Control .FailPayment (
438+ ctx , p .identifier , failureCode ,
439+ )
434440 if err != nil {
435441 return nil , fmt .Errorf ("FailPayment got: %w" , err )
436442 }
@@ -800,6 +806,8 @@ func (p *paymentLifecycle) failPaymentAndAttempt(
800806 attemptID uint64 , reason * paymentsdb.FailureReason ,
801807 sendErr error ) (* attemptResult , error ) {
802808
809+ ctx := context .TODO ()
810+
803811 log .Errorf ("Payment %v failed: final_outcome=%v, raw_err=%v" ,
804812 p .identifier , * reason , sendErr )
805813
@@ -808,7 +816,9 @@ func (p *paymentLifecycle) failPaymentAndAttempt(
808816 // NOTE: we must fail the payment first before failing the attempt.
809817 // Otherwise, once the attempt is marked as failed, another goroutine
810818 // might make another attempt while we are failing the payment.
811- err := p .router .cfg .Control .FailPayment (p .identifier , * reason )
819+ err := p .router .cfg .Control .FailPayment (
820+ ctx , p .identifier , * reason ,
821+ )
812822 if err != nil {
813823 log .Errorf ("Unable to fail payment: %v" , err )
814824 return nil , err
0 commit comments