routing: add context to reloadInflightAttempts
This commit is contained in:
2 files changed
+4
-6
No files matched your search
@@ -209,7 +209,7 @@ func (p *paymentLifecycle) resumePayment(ctx context.Context) ([32]byte,
|
|||||||
// If we had any existing attempts outstanding, we'll start by spinning
|
// If we had any existing attempts outstanding, we'll start by spinning
|
||||||
// up goroutines that'll collect their results and deliver them to the
|
// up goroutines that'll collect their results and deliver them to the
|
||||||
// lifecycle loop below.
|
// lifecycle loop below.
|
||||||
payment, err := p.reloadInflightAttempts()
|
payment, err := p.reloadInflightAttempts(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return [32]byte{}, nil, err
|
return [32]byte{}, nil, err
|
||||||
}
|
}
|
||||||
@@ -1138,10 +1138,8 @@ func (p *paymentLifecycle) patchLegacyPaymentHash(
|
|||||||
// reloadInflightAttempts is called when the payment lifecycle is resumed after
|
// reloadInflightAttempts is called when the payment lifecycle is resumed after
|
||||||
// a restart. It reloads all inflight attempts from the control tower and
|
// a restart. It reloads all inflight attempts from the control tower and
|
||||||
// collects the results of the attempts that have been sent before.
|
// collects the results of the attempts that have been sent before.
|
||||||
func (p *paymentLifecycle) reloadInflightAttempts() (paymentsdb.DBMPPayment,
|
func (p *paymentLifecycle) reloadInflightAttempts(
|
||||||
error) {
|
ctx context.Context) (paymentsdb.DBMPPayment, error) {
|
||||||
|
|
||||||
ctx := context.TODO()
|
|
||||||
|
|
||||||
payment, err := p.router.cfg.Control.FetchPayment(ctx, p.identifier)
|
payment, err := p.router.cfg.Control.FetchPayment(ctx, p.identifier)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -1850,7 +1850,7 @@ func TestReloadInflightAttemptsLegacy(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Now call the method under test.
|
// Now call the method under test.
|
||||||
payment, err := p.reloadInflightAttempts()
|
payment, err := p.reloadInflightAttempts(t.Context())
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, m.payment, payment)
|
require.Equal(t, m.payment, payment)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user