@@ -2215,13 +2215,6 @@ func TestSendToRouteSkipTempErrSuccess(t *testing.T) {
2215
2215
mock .Anything , rt ,
2216
2216
).Return (nil )
2217
2217
2218
- // Mock the control tower to return the mocked payment.
2219
- payment := & mockMPPayment {}
2220
- controlTower .On ("FetchPayment" , payHash ).Return (payment , nil ).Once ()
2221
-
2222
- // Mock the payment to return nil failure reason.
2223
- payment .On ("TerminalInfo" ).Return (nil , nil )
2224
-
2225
2218
// Expect a successful send to route.
2226
2219
attempt , err := router .SendToRouteSkipTempErr (payHash , rt , nil )
2227
2220
require .NoError (t , err )
@@ -2231,7 +2224,6 @@ func TestSendToRouteSkipTempErrSuccess(t *testing.T) {
2231
2224
controlTower .AssertExpectations (t )
2232
2225
payer .AssertExpectations (t )
2233
2226
missionControl .AssertExpectations (t )
2234
- payment .AssertExpectations (t )
2235
2227
}
2236
2228
2237
2229
// TestSendToRouteSkipTempErrNonMPP checks that an error is return when
@@ -2352,19 +2344,12 @@ func TestSendToRouteSkipTempErrTempFailure(t *testing.T) {
2352
2344
mock .Anything , mock .Anything , mock .Anything ,
2353
2345
).Return (tempErr )
2354
2346
2355
- // Mock the control tower to return the mocked payment.
2356
- payment := & mockMPPayment {}
2357
- controlTower .On ("FetchPayment" , payHash ).Return (payment , nil ).Once ()
2358
-
2359
2347
// Mock the mission control to return a nil reason from reporting the
2360
2348
// attempt failure.
2361
2349
missionControl .On ("ReportPaymentFail" ,
2362
2350
mock .Anything , rt , mock .Anything , mock .Anything ,
2363
2351
).Return (nil , nil )
2364
2352
2365
- // Mock the payment to return nil failure reason.
2366
- payment .On ("TerminalInfo" ).Return (nil , nil )
2367
-
2368
2353
// Expect a failed send to route.
2369
2354
attempt , err := router .SendToRouteSkipTempErr (payHash , rt , nil )
2370
2355
require .Equal (t , tempErr , err )
@@ -2374,7 +2359,6 @@ func TestSendToRouteSkipTempErrTempFailure(t *testing.T) {
2374
2359
controlTower .AssertExpectations (t )
2375
2360
payer .AssertExpectations (t )
2376
2361
missionControl .AssertExpectations (t )
2377
- payment .AssertExpectations (t )
2378
2362
}
2379
2363
2380
2364
// TestSendToRouteSkipTempErrPermanentFailure validates a permanent failure
@@ -2436,7 +2420,9 @@ func TestSendToRouteSkipTempErrPermanentFailure(t *testing.T) {
2436
2420
).Return (testAttempt , nil )
2437
2421
2438
2422
// Expect the payment to be failed.
2439
- controlTower .On ("FailPayment" , payHash , mock .Anything ).Return (nil )
2423
+ controlTower .On (
2424
+ "FailPayment" , payHash , mock .Anything ,
2425
+ ).Return (nil ).Once ()
2440
2426
2441
2427
// Mock an error to be returned from sending the htlc.
2442
2428
payer .On ("SendHTLC" ,
@@ -2448,13 +2434,6 @@ func TestSendToRouteSkipTempErrPermanentFailure(t *testing.T) {
2448
2434
mock .Anything , rt , mock .Anything , mock .Anything ,
2449
2435
).Return (& failureReason , nil )
2450
2436
2451
- // Mock the control tower to return the mocked payment.
2452
- payment := & mockMPPayment {}
2453
- controlTower .On ("FetchPayment" , payHash ).Return (payment , nil ).Once ()
2454
-
2455
- // Mock the payment to return a failure reason.
2456
- payment .On ("TerminalInfo" ).Return (nil , & failureReason )
2457
-
2458
2437
// Expect a failed send to route.
2459
2438
attempt , err := router .SendToRouteSkipTempErr (payHash , rt , nil )
2460
2439
require .Equal (t , permErr , err )
@@ -2464,7 +2443,6 @@ func TestSendToRouteSkipTempErrPermanentFailure(t *testing.T) {
2464
2443
controlTower .AssertExpectations (t )
2465
2444
payer .AssertExpectations (t )
2466
2445
missionControl .AssertExpectations (t )
2467
- payment .AssertExpectations (t )
2468
2446
}
2469
2447
2470
2448
// TestSendToRouteTempFailure validates a temporary failure will cause the
@@ -2525,7 +2503,9 @@ func TestSendToRouteTempFailure(t *testing.T) {
2525
2503
).Return (testAttempt , nil )
2526
2504
2527
2505
// Expect the payment to be failed.
2528
- controlTower .On ("FailPayment" , payHash , mock .Anything ).Return (nil )
2506
+ controlTower .On (
2507
+ "FailPayment" , payHash , mock .Anything ,
2508
+ ).Return (nil ).Once ()
2529
2509
2530
2510
payer .On ("SendHTLC" ,
2531
2511
mock .Anything , mock .Anything , mock .Anything ,
@@ -2536,7 +2516,7 @@ func TestSendToRouteTempFailure(t *testing.T) {
2536
2516
controlTower .On ("FetchPayment" , payHash ).Return (payment , nil ).Once ()
2537
2517
2538
2518
// Mock the payment to return nil failure reason.
2539
- payment .On ("TerminalInfo" ).Return (nil , nil )
2519
+ payment .On ("TerminalInfo" ).Return (nil , nil ). Once ()
2540
2520
2541
2521
// Return a nil reason to mock a temporary failure.
2542
2522
missionControl .On ("ReportPaymentFail" ,
0 commit comments