@@ -466,9 +466,9 @@ func TestChannelZeroAddLocalHeight(t *testing.T) {
466
466
467
467
// Now Bob should fail the htlc back to Alice.
468
468
// <----fail-----
469
- err = bobChannel .FailHTLC (0 , []byte ("failreason" ), nil , nil , nil )
469
+ err = bobChannel .FailHTLC (0 , []byte ("failreason" ), nil , nil , nil , nil )
470
470
require .NoError (t , err )
471
- err = aliceChannel .ReceiveFailHTLC (0 , []byte ("bad" ))
471
+ err = aliceChannel .ReceiveFailHTLC (0 , []byte ("bad" ), nil )
472
472
require .NoError (t , err )
473
473
474
474
// Bob should send a commitment signature to Alice.
@@ -2222,9 +2222,11 @@ func TestCancelHTLC(t *testing.T) {
2222
2222
2223
2223
// Now, with the HTLC committed on both sides, trigger a cancellation
2224
2224
// from Bob to Alice, removing the HTLC.
2225
- err = bobChannel .FailHTLC (bobHtlcIndex , []byte ("failreason" ), nil , nil , nil )
2225
+ err = bobChannel .FailHTLC (
2226
+ bobHtlcIndex , []byte ("failreason" ), nil , nil , nil , nil ,
2227
+ )
2226
2228
require .NoError (t , err , "unable to cancel HTLC" )
2227
- err = aliceChannel .ReceiveFailHTLC (aliceHtlcIndex , []byte ("bad" ))
2229
+ err = aliceChannel .ReceiveFailHTLC (aliceHtlcIndex , []byte ("bad" ), nil )
2228
2230
require .NoError (t , err , "unable to recv htlc cancel" )
2229
2231
2230
2232
// Now trigger another state transition, the HTLC should now be removed
@@ -5481,9 +5483,9 @@ func TestChanAvailableBandwidth(t *testing.T) {
5481
5483
}
5482
5484
5483
5485
htlcIndex := uint64 ((numHtlcs * 2 ) - 1 )
5484
- err = bobChannel .FailHTLC (htlcIndex , []byte ("f" ), nil , nil , nil )
5486
+ err = bobChannel .FailHTLC (htlcIndex , []byte ("f" ), nil , nil , nil , nil )
5485
5487
require .NoError (t , err , "unable to cancel HTLC" )
5486
- err = aliceChannel .ReceiveFailHTLC (htlcIndex , []byte ("bad" ))
5488
+ err = aliceChannel .ReceiveFailHTLC (htlcIndex , []byte ("bad" ), nil )
5487
5489
require .NoError (t , err , "unable to recv htlc cancel" )
5488
5490
5489
5491
// We must do a state transition before the balance is available
@@ -5937,9 +5939,11 @@ func TestLockedInHtlcForwardingSkipAfterRestart(t *testing.T) {
5937
5939
5938
5940
// With both nodes restarted, Bob will now attempt to cancel one of
5939
5941
// Alice's HTLC's.
5940
- err = bobChannel .FailHTLC (htlc .ID , []byte ("failreason" ), nil , nil , nil )
5942
+ err = bobChannel .FailHTLC (
5943
+ htlc .ID , []byte ("failreason" ), nil , nil , nil , nil ,
5944
+ )
5941
5945
require .NoError (t , err , "unable to cancel HTLC" )
5942
- err = aliceChannel .ReceiveFailHTLC (htlc .ID , []byte ("bad" ))
5946
+ err = aliceChannel .ReceiveFailHTLC (htlc .ID , []byte ("bad" ), nil )
5943
5947
require .NoError (t , err , "unable to recv htlc cancel" )
5944
5948
5945
5949
// We'll now initiate another state transition, but this time Bob will
@@ -5990,9 +5994,11 @@ func TestLockedInHtlcForwardingSkipAfterRestart(t *testing.T) {
5990
5994
5991
5995
// Failing the HTLC here will cause the update to be included in Alice's
5992
5996
// remote log, but it should not be committed by this transition.
5993
- err = bobChannel .FailHTLC (htlc2 .ID , []byte ("failreason" ), nil , nil , nil )
5997
+ err = bobChannel .FailHTLC (
5998
+ htlc2 .ID , []byte ("failreason" ), nil , nil , nil , nil ,
5999
+ )
5994
6000
require .NoError (t , err , "unable to cancel HTLC" )
5995
- err = aliceChannel .ReceiveFailHTLC (htlc2 .ID , []byte ("bad" ))
6001
+ err = aliceChannel .ReceiveFailHTLC (htlc2 .ID , []byte ("bad" ), nil )
5996
6002
require .NoError (t , err , "unable to recv htlc cancel" )
5997
6003
5998
6004
bobRevocation , _ , finalHtlcs , err := bobChannel .
@@ -6045,9 +6051,11 @@ func TestLockedInHtlcForwardingSkipAfterRestart(t *testing.T) {
6045
6051
6046
6052
// Re-add the Fail to both Alice and Bob's channels, as the non-committed
6047
6053
// update will not have survived the restart.
6048
- err = bobChannel .FailHTLC (htlc2 .ID , []byte ("failreason" ), nil , nil , nil )
6054
+ err = bobChannel .FailHTLC (
6055
+ htlc2 .ID , []byte ("failreason" ), nil , nil , nil , nil ,
6056
+ )
6049
6057
require .NoError (t , err , "unable to cancel HTLC" )
6050
- err = aliceChannel .ReceiveFailHTLC (htlc2 .ID , []byte ("bad" ))
6058
+ err = aliceChannel .ReceiveFailHTLC (htlc2 .ID , []byte ("bad" ), nil )
6051
6059
require .NoError (t , err , "unable to recv htlc cancel" )
6052
6060
6053
6061
// Have Alice initiate a state transition, which does not include the
@@ -6492,9 +6500,13 @@ func TestDesyncHTLCs(t *testing.T) {
6492
6500
}
6493
6501
6494
6502
// Now let Bob fail this HTLC.
6495
- err = bobChannel .FailHTLC (bobIndex , []byte ("failreason" ), nil , nil , nil )
6503
+ err = bobChannel .FailHTLC (
6504
+ bobIndex , []byte ("failreason" ), nil , nil , nil , nil ,
6505
+ )
6496
6506
require .NoError (t , err , "unable to cancel HTLC" )
6497
- if err := aliceChannel .ReceiveFailHTLC (aliceIndex , []byte ("bad" )); err != nil {
6507
+ if err := aliceChannel .ReceiveFailHTLC (
6508
+ aliceIndex , []byte ("bad" ), nil ,
6509
+ ); err != nil {
6498
6510
t .Fatalf ("unable to recv htlc cancel: %v" , err )
6499
6511
}
6500
6512
@@ -6584,10 +6596,12 @@ func TestMaxAcceptedHTLCs(t *testing.T) {
6584
6596
6585
6597
// Bob will fail the htlc specified by htlcID and then force a state
6586
6598
// transition.
6587
- err = bobChannel .FailHTLC (htlcID , []byte {}, nil , nil , nil )
6599
+ err = bobChannel .FailHTLC (htlcID , []byte {}, nil , nil , nil , nil )
6588
6600
require .NoError (t , err , "unable to fail htlc" )
6589
6601
6590
- if err := aliceChannel .ReceiveFailHTLC (htlcID , []byte {}); err != nil {
6602
+ if err := aliceChannel .ReceiveFailHTLC (
6603
+ htlcID , []byte {}, nil ,
6604
+ ); err != nil {
6591
6605
t .Fatalf ("unable to receive fail htlc: %v" , err )
6592
6606
}
6593
6607
@@ -6690,10 +6704,12 @@ func TestMaxAsynchronousHtlcs(t *testing.T) {
6690
6704
addAndReceiveHTLC (t , aliceChannel , bobChannel , htlc , nil )
6691
6705
6692
6706
// Fail back an HTLC and sign a commitment as in steps 1 & 2.
6693
- err = bobChannel .FailHTLC (htlcID , []byte {}, nil , nil , nil )
6707
+ err = bobChannel .FailHTLC (htlcID , []byte {}, nil , nil , nil , nil )
6694
6708
require .NoError (t , err , "unable to fail htlc" )
6695
6709
6696
- if err := aliceChannel .ReceiveFailHTLC (htlcID , []byte {}); err != nil {
6710
+ if err := aliceChannel .ReceiveFailHTLC (
6711
+ htlcID , []byte {}, nil ,
6712
+ ); err != nil {
6697
6713
t .Fatalf ("unable to receive fail htlc: %v" , err )
6698
6714
}
6699
6715
@@ -7518,10 +7534,10 @@ func TestChannelRestoreUpdateLogsFailedHTLC(t *testing.T) {
7518
7534
restoreAndAssert (t , aliceChannel , 1 , 0 , 0 , 0 )
7519
7535
7520
7536
// Now we make Bob fail this HTLC.
7521
- err = bobChannel .FailHTLC (0 , []byte ("failreason" ), nil , nil , nil )
7537
+ err = bobChannel .FailHTLC (0 , []byte ("failreason" ), nil , nil , nil , nil )
7522
7538
require .NoError (t , err , "unable to cancel HTLC" )
7523
7539
7524
- err = aliceChannel .ReceiveFailHTLC (0 , []byte ("failreason" ))
7540
+ err = aliceChannel .ReceiveFailHTLC (0 , []byte ("failreason" ), nil )
7525
7541
require .NoError (t , err , "unable to recv htlc cancel" )
7526
7542
7527
7543
// This Fail update should have been added to Alice's remote update log.
@@ -7604,19 +7620,23 @@ func TestDuplicateFailRejection(t *testing.T) {
7604
7620
7605
7621
// With the HTLC locked in, we'll now have Bob fail the HTLC back to
7606
7622
// Alice.
7607
- err = bobChannel .FailHTLC (0 , []byte ("failreason" ), nil , nil , nil )
7623
+ err = bobChannel .FailHTLC (0 , []byte ("failreason" ), nil , nil , nil , nil )
7608
7624
require .NoError (t , err , "unable to cancel HTLC" )
7609
- if err := aliceChannel .ReceiveFailHTLC (0 , []byte ("bad" )); err != nil {
7625
+ if err := aliceChannel .ReceiveFailHTLC (
7626
+ 0 , []byte ("bad" ), nil ,
7627
+ ); err != nil {
7610
7628
t .Fatalf ("unable to recv htlc cancel: %v" , err )
7611
7629
}
7612
7630
7613
7631
// If we attempt to fail it AGAIN, then both sides should reject this
7614
7632
// second failure attempt.
7615
- err = bobChannel .FailHTLC (0 , []byte ("failreason" ), nil , nil , nil )
7633
+ err = bobChannel .FailHTLC (0 , []byte ("failreason" ), nil , nil , nil , nil )
7616
7634
if err == nil {
7617
7635
t .Fatalf ("duplicate HTLC failure attempt should have failed" )
7618
7636
}
7619
- if err := aliceChannel .ReceiveFailHTLC (0 , []byte ("bad" )); err == nil {
7637
+ if err := aliceChannel .ReceiveFailHTLC (
7638
+ 0 , []byte ("bad" ), nil ,
7639
+ ); err == nil {
7620
7640
t .Fatalf ("duplicate HTLC failure attempt should have failed" )
7621
7641
}
7622
7642
@@ -7633,14 +7653,16 @@ func TestDuplicateFailRejection(t *testing.T) {
7633
7653
require .NoError (t , err , "unable to restart channel" )
7634
7654
7635
7655
// If we try to fail the same HTLC again, then we should get an error.
7636
- err = bobChannel .FailHTLC (0 , []byte ("failreason" ), nil , nil , nil )
7656
+ err = bobChannel .FailHTLC (0 , []byte ("failreason" ), nil , nil , nil , nil )
7637
7657
if err == nil {
7638
7658
t .Fatalf ("duplicate HTLC failure attempt should have failed" )
7639
7659
}
7640
7660
7641
7661
// Alice on the other hand should accept the failure again, as she
7642
7662
// dropped all items in the logs which weren't committed.
7643
- if err := aliceChannel .ReceiveFailHTLC (0 , []byte ("bad" )); err != nil {
7663
+ if err := aliceChannel .ReceiveFailHTLC (
7664
+ 0 , []byte ("bad" ), nil ,
7665
+ ); err != nil {
7644
7666
t .Fatalf ("unable to recv htlc cancel: %v" , err )
7645
7667
}
7646
7668
}
@@ -7901,9 +7923,9 @@ func TestChannelRestoreCommitHeight(t *testing.T) {
7901
7923
bobChannel = restoreAndAssertCommitHeights (t , bobChannel , true , 1 , 2 , 2 )
7902
7924
7903
7925
// Bob now fails back the htlc that was just locked in.
7904
- err = bobChannel .FailHTLC (0 , []byte ("failreason" ), nil , nil , nil )
7926
+ err = bobChannel .FailHTLC (0 , []byte ("failreason" ), nil , nil , nil , nil )
7905
7927
require .NoError (t , err , "unable to cancel HTLC" )
7906
- err = aliceChannel .ReceiveFailHTLC (0 , []byte ("bad" ))
7928
+ err = aliceChannel .ReceiveFailHTLC (0 , []byte ("bad" ), nil )
7907
7929
require .NoError (t , err , "unable to recv htlc cancel" )
7908
7930
7909
7931
// Now Bob signs for the fail update.
@@ -9224,9 +9246,9 @@ func TestChannelUnsignedAckedFailure(t *testing.T) {
9224
9246
9225
9247
// Now Bob should fail the htlc back to Alice.
9226
9248
// <----fail-----
9227
- err = bobChannel .FailHTLC (0 , []byte ("failreason" ), nil , nil , nil )
9249
+ err = bobChannel .FailHTLC (0 , []byte ("failreason" ), nil , nil , nil , nil )
9228
9250
require .NoError (t , err )
9229
- err = aliceChannel .ReceiveFailHTLC (0 , []byte ("bad" ))
9251
+ err = aliceChannel .ReceiveFailHTLC (0 , []byte ("bad" ), nil )
9230
9252
require .NoError (t , err )
9231
9253
9232
9254
// Bob should send a commitment signature to Alice.
@@ -9328,9 +9350,9 @@ func TestChannelLocalUnsignedUpdatesFailure(t *testing.T) {
9328
9350
9329
9351
// Now Alice should fail the htlc back to Bob.
9330
9352
// -----fail--->
9331
- err = aliceChannel .FailHTLC (0 , []byte ("failreason" ), nil , nil , nil )
9353
+ err = aliceChannel .FailHTLC (0 , []byte ("failreason" ), nil , nil , nil , nil )
9332
9354
require .NoError (t , err )
9333
- err = bobChannel .ReceiveFailHTLC (0 , []byte ("bad" ))
9355
+ err = bobChannel .ReceiveFailHTLC (0 , []byte ("bad" ), nil )
9334
9356
require .NoError (t , err )
9335
9357
9336
9358
// Alice should send a commitment signature to Bob.
@@ -10773,10 +10795,10 @@ func TestAsynchronousSendingWithFeeBuffer(t *testing.T) {
10773
10795
// <----rev------- |---------------
10774
10796
// <----sig------- |---------------
10775
10797
// --------------- |-----rev------>
10776
- err = aliceChannel .FailHTLC (0 , []byte {}, nil , nil , nil )
10798
+ err = aliceChannel .FailHTLC (0 , []byte {}, nil , nil , nil , nil )
10777
10799
require .NoError (t , err )
10778
10800
10779
- err = bobChannel .ReceiveFailHTLC (0 , []byte {})
10801
+ err = bobChannel .ReceiveFailHTLC (0 , []byte {}, nil )
10780
10802
require .NoError (t , err )
10781
10803
10782
10804
err = ForceStateTransition (aliceChannel , bobChannel )
0 commit comments