Skip to content

Commit 54341c6

Browse files
committed
routing: add context to reloadInflightAttempts
1 parent 03c6ed7 commit 54341c6

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

routing/payment_lifecycle.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ func (p *paymentLifecycle) resumePayment(ctx context.Context) ([32]byte,
198198
// If we had any existing attempts outstanding, we'll start by spinning
199199
// up goroutines that'll collect their results and deliver them to the
200200
// lifecycle loop below.
201-
payment, err := p.reloadInflightAttempts()
201+
payment, err := p.reloadInflightAttempts(ctx)
202202
if err != nil {
203203
return [32]byte{}, nil, err
204204
}
@@ -1118,10 +1118,8 @@ func (p *paymentLifecycle) patchLegacyPaymentHash(
11181118
// reloadInflightAttempts is called when the payment lifecycle is resumed after
11191119
// a restart. It reloads all inflight attempts from the control tower and
11201120
// collects the results of the attempts that have been sent before.
1121-
func (p *paymentLifecycle) reloadInflightAttempts() (paymentsdb.DBMPPayment,
1122-
error) {
1123-
1124-
ctx := context.TODO()
1121+
func (p *paymentLifecycle) reloadInflightAttempts(
1122+
ctx context.Context) (paymentsdb.DBMPPayment, error) {
11251123

11261124
payment, err := p.router.cfg.Control.FetchPayment(ctx, p.identifier)
11271125
if err != nil {

routing/payment_lifecycle_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1850,7 +1850,7 @@ func TestReloadInflightAttemptsLegacy(t *testing.T) {
18501850
})
18511851

18521852
// Now call the method under test.
1853-
payment, err := p.reloadInflightAttempts()
1853+
payment, err := p.reloadInflightAttempts(t.Context())
18541854
require.NoError(t, err)
18551855
require.Equal(t, m.payment, payment)
18561856

0 commit comments

Comments
 (0)