@@ -143,7 +143,7 @@ func createTestPayments(t *testing.T, p DB, payments []*payment) {
143143 require .NoError (t , err , "unable to send htlc message" )
144144
145145 // Register and fail the first attempt for all payments.
146- _ , err = p .RegisterAttempt (info .PaymentIdentifier , attempt )
146+ _ , err = p .RegisterAttempt (ctx , info .PaymentIdentifier , attempt )
147147 require .NoError (t , err , "unable to send htlc message" )
148148
149149 htlcFailure := HTLCFailUnreadable
@@ -167,7 +167,7 @@ func createTestPayments(t *testing.T, p DB, payments []*payment) {
167167 require .NoError (t , err )
168168 attemptID ++
169169
170- _ , err = p .RegisterAttempt (info .PaymentIdentifier , attempt )
170+ _ , err = p .RegisterAttempt (ctx , info .PaymentIdentifier , attempt )
171171 require .NoError (t , err , "unable to send htlc message" )
172172
173173 switch payments [i ].status {
@@ -584,7 +584,7 @@ func TestMPPRecordValidation(t *testing.T) {
584584 info .Value , [32 ]byte {1 },
585585 )
586586
587- _ , err = paymentDB .RegisterAttempt (info .PaymentIdentifier , attempt )
587+ _ , err = paymentDB .RegisterAttempt (ctx , info .PaymentIdentifier , attempt )
588588 require .NoError (t , err , "unable to send htlc message" )
589589
590590 // Now try to register a non-MPP attempt, which should fail.
@@ -596,21 +596,27 @@ func TestMPPRecordValidation(t *testing.T) {
596596
597597 attempt2 .Route .FinalHop ().MPP = nil
598598
599- _ , err = paymentDB .RegisterAttempt (info .PaymentIdentifier , attempt2 )
599+ _ , err = paymentDB .RegisterAttempt (
600+ ctx , info .PaymentIdentifier , attempt2 ,
601+ )
600602 require .ErrorIs (t , err , ErrMPPayment )
601603
602604 // Try to register attempt one with a different payment address.
603605 attempt2 .Route .FinalHop ().MPP = record .NewMPP (
604606 info .Value , [32 ]byte {2 },
605607 )
606- _ , err = paymentDB .RegisterAttempt (info .PaymentIdentifier , attempt2 )
608+ _ , err = paymentDB .RegisterAttempt (
609+ ctx , info .PaymentIdentifier , attempt2 ,
610+ )
607611 require .ErrorIs (t , err , ErrMPPPaymentAddrMismatch )
608612
609613 // Try registering one with a different total amount.
610614 attempt2 .Route .FinalHop ().MPP = record .NewMPP (
611615 info .Value / 2 , [32 ]byte {1 },
612616 )
613- _ , err = paymentDB .RegisterAttempt (info .PaymentIdentifier , attempt2 )
617+ _ , err = paymentDB .RegisterAttempt (
618+ ctx , info .PaymentIdentifier , attempt2 ,
619+ )
614620 require .ErrorIs (t , err , ErrMPPTotalAmountMismatch )
615621
616622 // Create and init a new payment. This time we'll check that we cannot
@@ -633,7 +639,9 @@ func TestMPPRecordValidation(t *testing.T) {
633639 require .NoError (t , err , "unable to send htlc message" )
634640
635641 attempt .Route .FinalHop ().MPP = nil
636- _ , err = paymentDB .RegisterAttempt (info .PaymentIdentifier , attempt )
642+ _ , err = paymentDB .RegisterAttempt (
643+ ctx , info .PaymentIdentifier , attempt ,
644+ )
637645 require .NoError (t , err , "unable to send htlc message" )
638646
639647 // Attempt to register an MPP attempt, which should fail.
@@ -647,7 +655,9 @@ func TestMPPRecordValidation(t *testing.T) {
647655 info .Value , [32 ]byte {1 },
648656 )
649657
650- _ , err = paymentDB .RegisterAttempt (info .PaymentIdentifier , attempt2 )
658+ _ , err = paymentDB .RegisterAttempt (
659+ ctx , info .PaymentIdentifier , attempt2 ,
660+ )
651661 require .ErrorIs (t , err , ErrNonMPPayment )
652662}
653663
@@ -1452,7 +1462,7 @@ func TestSwitchDoubleSend(t *testing.T) {
14521462 require .ErrorIs (t , err , ErrPaymentExists )
14531463
14541464 // Record an attempt.
1455- _ , err = paymentDB .RegisterAttempt (info .PaymentIdentifier , attempt )
1465+ _ , err = paymentDB .RegisterAttempt (ctx , info .PaymentIdentifier , attempt )
14561466 require .NoError (t , err , "unable to send htlc message" )
14571467 assertDBPaymentstatus (
14581468 t , paymentDB , info .PaymentIdentifier , StatusInFlight ,
@@ -1563,7 +1573,7 @@ func TestSwitchFail(t *testing.T) {
15631573 // Record a new attempt. In this test scenario, the attempt fails.
15641574 // However, this is not communicated to control tower in the current
15651575 // implementation. It only registers the initiation of the attempt.
1566- _ , err = paymentDB .RegisterAttempt (info .PaymentIdentifier , attempt )
1576+ _ , err = paymentDB .RegisterAttempt (ctx , info .PaymentIdentifier , attempt )
15671577 require .NoError (t , err , "unable to register attempt" )
15681578
15691579 htlcReason := HTLCFailUnreadable
@@ -1593,7 +1603,7 @@ func TestSwitchFail(t *testing.T) {
15931603 )
15941604 require .NoError (t , err )
15951605
1596- _ , err = paymentDB .RegisterAttempt (info .PaymentIdentifier , attempt )
1606+ _ , err = paymentDB .RegisterAttempt (ctx , info .PaymentIdentifier , attempt )
15971607 require .NoError (t , err , "unable to send htlc message" )
15981608 assertDBPaymentstatus (
15991609 t , paymentDB , info .PaymentIdentifier , StatusInFlight ,
@@ -1711,7 +1721,7 @@ func TestMultiShard(t *testing.T) {
17111721 attempts = append (attempts , a )
17121722
17131723 _ , err = paymentDB .RegisterAttempt (
1714- info .PaymentIdentifier , a ,
1724+ ctx , info .PaymentIdentifier , a ,
17151725 )
17161726 if err != nil {
17171727 t .Fatalf ("unable to send htlc message: %v" , err )
@@ -1743,7 +1753,9 @@ func TestMultiShard(t *testing.T) {
17431753 info .Value , [32 ]byte {1 },
17441754 )
17451755
1746- _ , err = paymentDB .RegisterAttempt (info .PaymentIdentifier , b )
1756+ _ , err = paymentDB .RegisterAttempt (
1757+ ctx , info .PaymentIdentifier , b ,
1758+ )
17471759 require .ErrorIs (t , err , ErrValueExceedsAmt )
17481760
17491761 // Fail the second attempt.
@@ -1850,7 +1862,9 @@ func TestMultiShard(t *testing.T) {
18501862 info .Value , [32 ]byte {1 },
18511863 )
18521864
1853- _ , err = paymentDB .RegisterAttempt (info .PaymentIdentifier , b )
1865+ _ , err = paymentDB .RegisterAttempt (
1866+ ctx , info .PaymentIdentifier , b ,
1867+ )
18541868 if test .settleFirst {
18551869 require .ErrorIs (
18561870 t , err , ErrPaymentPendingSettled ,
@@ -1949,7 +1963,9 @@ func TestMultiShard(t *testing.T) {
19491963 )
19501964
19511965 // Finally assert we cannot register more attempts.
1952- _ , err = paymentDB .RegisterAttempt (info .PaymentIdentifier , b )
1966+ _ , err = paymentDB .RegisterAttempt (
1967+ ctx , info .PaymentIdentifier , b ,
1968+ )
19531969 require .ErrorIs (t , err , registerErr )
19541970 }
19551971
@@ -2352,7 +2368,7 @@ func TestQueryPayments(t *testing.T) {
23522368 require .NoError (t , err )
23532369
23542370 _ , err = paymentDB .RegisterAttempt (
2355- lastPaymentInfo .PaymentIdentifier ,
2371+ ctx , lastPaymentInfo .PaymentIdentifier ,
23562372 & attempt .HTLCAttemptInfo ,
23572373 )
23582374 require .NoError (t , err )
0 commit comments