From c393475d39348557194f55178d1bb7571d7e614d Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 4 Apr 2018 17:07:45 -0700 Subject: [PATCH] lnwallet: ensure that we skip dust HTLC's in NewBreachRetribution --- lnwallet/channel.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 2581c165..71fe56e3 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -1976,6 +1976,16 @@ func NewBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64, err error ) + // If the HTLC is dust, then we'll skip it as it doesn't have + // an output on the commitment transaction. + if htlcIsDust( + htlc.Incoming, false, + SatPerKWeight(revokedSnapshot.FeePerKw), + htlc.Amt.ToSatoshis(), chanState.RemoteChanCfg.DustLimit, + ) { + continue + } + // We'll generate the original second level witness script now, // as we'll need it if we're revoking an HTLC output on the // remote commitment transaction, and *they* go to the second