@@ -30,19 +30,20 @@ func testCoopCloseRbf(ht *lntest.HarnessTest) {
3030 // off the test.
3131 //
3232 // To start, we'll have Alice try to close the channel, with a fee rate
33- // of 5 sat/byte .
34- aliceFeeRate := chainfee .SatPerVByte ( 5 )
33+ // of 1250 sat/kw .
34+ aliceFeeRate := chainfee .SatPerKWeight ( 1250 )
3535 aliceCloseStream , aliceCloseUpdate := ht .CloseChannelAssertPending (
3636 alice , chanPoint , false ,
3737 lntest .WithCoopCloseFeeRate (aliceFeeRate ),
3838 lntest .WithLocalTxNotify (),
3939 )
4040
41- // Confirm that this new update was at 5 sat/vb .
41+ // Confirm that this new update was at 1250 sat/kw .
4242 alicePendingUpdate := aliceCloseUpdate .GetClosePending ()
4343 require .NotNil (ht , aliceCloseUpdate )
4444 require .Equal (
45- ht , int64 (aliceFeeRate ), alicePendingUpdate .FeePerVbyte ,
45+ ht , int64 (aliceFeeRate ),
46+ int64 (alicePendingUpdate .FeePerKw ),
4647 )
4748 require .True (ht , alicePendingUpdate .LocalCloseTx )
4849
@@ -54,28 +55,38 @@ func testCoopCloseRbf(ht *lntest.HarnessTest) {
5455 lntest .WithLocalTxNotify (),
5556 )
5657
57- // Confirm that this new update was at 10 sat/vb .
58+ // Confirm that this new update was at 2500 sat/kw .
5859 bobPendingUpdate := bobCloseUpdate .GetClosePending ()
5960 require .NotNil (ht , bobCloseUpdate )
60- require .Equal (ht , bobPendingUpdate .FeePerVbyte , int64 (bobFeeRate ))
61+ require .Equal (
62+ ht , int64 (bobPendingUpdate .FeePerKw ),
63+ int64 (bobFeeRate ),
64+ )
6165 require .True (ht , bobPendingUpdate .LocalCloseTx )
6266
6367 var err error
6468
6569 // Alice should've also received a similar update that Bob has
66- // increased the closing fee rate to 10 sat/vb with his settled funds.
70+ // increased the closing fee rate to 2500 sat/kw with his settled
71+ // funds.
6772 aliceCloseUpdate , err = ht .ReceiveCloseChannelUpdate (aliceCloseStream )
6873 require .NoError (ht , err )
6974 alicePendingUpdate = aliceCloseUpdate .GetClosePending ()
7075 require .NotNil (ht , aliceCloseUpdate )
71- require .Equal (ht , alicePendingUpdate .FeePerVbyte , int64 (bobFeeRate ))
76+ // Using InDelta as fee rate calc might differ due to weight estimation
77+ // versuns actual tx weight.
78+ require .InDelta (
79+ ht , int64 (alicePendingUpdate .FeePerKw ),
80+ int64 (bobFeeRate ),
81+ 15 ,
82+ )
7283 require .False (ht , alicePendingUpdate .LocalCloseTx )
7384
7485 // We'll now attempt to make a fee update that increases Alice's fee
75- // rate by 6 sat/vb , which should be rejected as it is too small of an
76- // increase for the RBF rules. The RPC API however will return the new
77- // fee. We'll skip the mempool check here as it won't make it in.
78- aliceRejectedFeeRate := aliceFeeRate + 1
86+ // rate by 1500 sat/kw , which should be rejected as it is too small of
87+ // an increase for the RBF rules. The RPC API however will return the
88+ // new fee. We'll skip the mempool check here as it won't make it in.
89+ aliceRejectedFeeRate := aliceFeeRate + 250
7990 _ , aliceCloseUpdate = ht .CloseChannelAssertPending (
8091 alice , chanPoint , false ,
8192 lntest .WithCoopCloseFeeRate (aliceRejectedFeeRate ),
@@ -84,7 +95,7 @@ func testCoopCloseRbf(ht *lntest.HarnessTest) {
8495 alicePendingUpdate = aliceCloseUpdate .GetClosePending ()
8596 require .NotNil (ht , aliceCloseUpdate )
8697 require .Equal (
87- ht , alicePendingUpdate .FeePerVbyte ,
98+ ht , int64 ( alicePendingUpdate .FeePerKw ) ,
8899 int64 (aliceRejectedFeeRate ),
89100 )
90101 require .True (ht , alicePendingUpdate .LocalCloseTx )
@@ -108,7 +119,7 @@ func testCoopCloseRbf(ht *lntest.HarnessTest) {
108119 ht .DisconnectNodes (alice , bob )
109120 ht .ConnectNodes (alice , bob )
110121
111- // Next, we'll have Alice double that fee rate again to 20 sat/vb .
122+ // Next, we'll have Alice double that fee rate again to 5000 sat/kw .
112123 aliceFeeRate = bobFeeRate * 2
113124 aliceCloseStream , aliceCloseUpdate = ht .CloseChannelAssertPending (
114125 alice , chanPoint , false ,
@@ -119,7 +130,8 @@ func testCoopCloseRbf(ht *lntest.HarnessTest) {
119130 alicePendingUpdate = aliceCloseUpdate .GetClosePending ()
120131 require .NotNil (ht , aliceCloseUpdate )
121132 require .Equal (
122- ht , alicePendingUpdate .FeePerVbyte , int64 (aliceFeeRate ),
133+ ht , int64 (alicePendingUpdate .FeePerKw ),
134+ int64 (aliceFeeRate ),
123135 )
124136 require .True (ht , alicePendingUpdate .LocalCloseTx )
125137
0 commit comments