From aa6395874df8da159294b25ff1116717c33b427b Mon Sep 17 00:00:00 2001 From: nsa Date: Fri, 6 Oct 2017 18:12:49 -0400 Subject: [PATCH] wallet: channel test fee fix for added HTLC This commit fixes the TestChannelBalanceDustLimit unit test in channel_test.go. The unit test does not account for the fees required by adding an HTLC. As a result, Alice's balance according to her local and remote commitment chains drops below 0 at certain points. By using the correct fee, this is avoided. --- lnwallet/channel_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lnwallet/channel_test.go b/lnwallet/channel_test.go index f7c55726..2e594083 100644 --- a/lnwallet/channel_test.go +++ b/lnwallet/channel_test.go @@ -1289,10 +1289,10 @@ func TestChannelBalanceDustLimit(t *testing.T) { // This amount should leave an amount larger than Alice's dust limit // once fees have been subtracted, but smaller than Bob's dust limit. - defaultFee := calcStaticFee(0) - dustLimit := aliceChannel.channelState.LocalChanCfg.DustLimit + // We account in fees for the HTLC we will be adding. + defaultFee := calcStaticFee(1) aliceBalance := aliceChannel.channelState.LocalBalance.ToSatoshis() - htlcSat := aliceBalance - (defaultFee + dustLimit + 100) + htlcSat := aliceBalance - defaultFee htlcSat += htlcSuccessFee(aliceChannel.channelState.FeePerKw) htlcAmount := lnwire.NewMSatFromSatoshis(htlcSat)