@@ -460,20 +460,7 @@ func genInfo(t *testing.T) (*PaymentCreationInfo, lntypes.Preimage, error) {
460460func TestDeleteFailedAttempts (t * testing.T ) {
461461 t .Parallel ()
462462
463- t .Run ("keep failed payment attempts" , func (t * testing.T ) {
464- testDeleteFailedAttempts (t , true )
465- })
466- t .Run ("remove failed payment attempts" , func (t * testing.T ) {
467- testDeleteFailedAttempts (t , false )
468- })
469- }
470-
471- // testDeleteFailedAttempts tests the DeleteFailedAttempts method with the
472- // given keepFailedPaymentAttempts flag as argument.
473- func testDeleteFailedAttempts (t * testing.T , keepFailedPaymentAttempts bool ) {
474- paymentDB , _ := NewTestDB (
475- t , WithKeepFailedPaymentAttempts (keepFailedPaymentAttempts ),
476- )
463+ paymentDB , _ := NewTestDB (t )
477464
478465 // Register three payments:
479466 // All payments will have one failed HTLC attempt and one HTLC attempt
@@ -507,29 +494,16 @@ func testDeleteFailedAttempts(t *testing.T, keepFailedPaymentAttempts bool) {
507494 t .Context (), payments [0 ].id ,
508495 ))
509496
510- // Expect all HTLCs to be deleted if the config is set to delete them.
511- if ! keepFailedPaymentAttempts {
512- payments [0 ].htlcs = 0
513- }
497+ // Expect all HTLCs to be deleted.
498+ payments [0 ].htlcs = 0
514499 assertDBPayments (t , paymentDB , payments )
515500
516501 // Calling DeleteFailedAttempts on an in-flight payment should return
517502 // an error.
518- //
519- // NOTE: In case the option keepFailedPaymentAttempts is set no delete
520- // operation are performed in general therefore we do NOT expect an
521- // error in this case.
522- if keepFailedPaymentAttempts {
523- err := paymentDB .DeleteFailedAttempts (
524- t .Context (), payments [1 ].id ,
525- )
526- require .NoError (t , err )
527- } else {
528- err := paymentDB .DeleteFailedAttempts (
529- t .Context (), payments [1 ].id ,
530- )
531- require .Error (t , err )
532- }
503+ err := paymentDB .DeleteFailedAttempts (
504+ t .Context (), payments [1 ].id ,
505+ )
506+ require .Error (t , err )
533507
534508 // Since DeleteFailedAttempts returned an error, we should expect the
535509 // payment to be unchanged.
@@ -540,34 +514,16 @@ func testDeleteFailedAttempts(t *testing.T, keepFailedPaymentAttempts bool) {
540514 t .Context (), payments [2 ].id ,
541515 ))
542516
543- // Expect all HTLCs except for the settled one to be deleted if the
544- // config is set to delete them.
545- if ! keepFailedPaymentAttempts {
546- payments [2 ].htlcs = 1
547- }
517+ // Expect all HTLCs except for the settled one to be deleted.
518+ payments [2 ].htlcs = 1
548519 assertDBPayments (t , paymentDB , payments )
549520
550- // NOTE: In case the option keepFailedPaymentAttempts is set no delete
551- // operation are performed in general therefore we do NOT expect an
552- // error in this case.
553- if keepFailedPaymentAttempts {
554- // DeleteFailedAttempts is ignored, even for non-existent
555- // payments, if the control tower is configured to keep failed
556- // HTLCs.
557- require .NoError (
558- t , paymentDB .DeleteFailedAttempts (
559- t .Context (), lntypes .ZeroHash ,
560- ),
561- )
562- } else {
563- // Attempting to cleanup a non-existent payment returns an
564- // error.
565- require .Error (
566- t , paymentDB .DeleteFailedAttempts (
567- t .Context (), lntypes .ZeroHash ,
568- ),
569- )
570- }
521+ // Attempting to cleanup a non-existent payment returns an error.
522+ require .Error (
523+ t , paymentDB .DeleteFailedAttempts (
524+ t .Context (), lntypes .ZeroHash ,
525+ ),
526+ )
571527}
572528
573529// TestMPPRecordValidation tests MPP record validation.
0 commit comments