From c3d345b57565c781248b98039ffa41499e7467f7 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 10 Dec 2017 16:19:13 -0800 Subject: [PATCH] htlcswitch: don't add UpdateFee to channel if not able to forward MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit is a follow up to a prior commit which skipped sending the commitment sig message (and sending out the update fee) message if the channel wasn’t yet able to forward any HTLC’s. We’ll modify the prior commit to not add the fee update to the channel at all. Otherwise, we risk a state desynchronization. --- htlcswitch/link.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htlcswitch/link.go b/htlcswitch/link.go index 6b10a175e..e5a4c5d62 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -1135,19 +1135,19 @@ func (l *channelLink) updateChannelFee(feePerKw btcutil.Amount) error { log.Infof("ChannelPoint(%v): updating commit fee to %v sat/kw", l, feePerKw) + // We skip sending the UpdateFee message if the channel is not + // currently eligable to forward messages. + if !l.EligibleToForward() { + log.Debugf("ChannelPoint(%v): skipping fee update for " + + "inactive channel") + return nil + } + // First, we'll update the local fee on our commitment. if err := l.channel.UpdateFee(feePerKw); err != nil { return err } - // We skip sending the update_fee message if the channel is not currently - // eligable to forward messages - if !l.EligibleToForward() { - log.Infof("ChannelPoint(%v): skipping transmission of update_fee. " + - "channel is not eligable for forwarding messages") - return nil - } - // We'll then attempt to send a new UpdateFee message, and also lock it // in immediately by triggering a commitment update. msg := lnwire.NewUpdateFee(l.ChanID(), uint32(feePerKw))