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.
This commit is contained in:
nsa 2017-10-06 18:12:49 -04:00 committed by Olaoluwa Osuntokun
parent cc221b1548
commit aa6395874d

@ -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)