htlcswitch: Only send UpdateFee message when channel is eligible

This commit adds a check to `updateChannelFee` which skipssending the
`update_fee` message when the channel is not eligable for forwarding
messages (likely due to the channel's `RemoteNextRevocation` not yet
being set).

This addresses #470.
This commit is contained in:
Ben Congdon 2017-12-10 12:46:30 -06:00 committed by Olaoluwa Osuntokun
parent 0f3ff119e8
commit 720a8c7e96

@ -1140,6 +1140,14 @@ func (l *channelLink) updateChannelFee(feePerKw btcutil.Amount) error {
return err 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 // We'll then attempt to send a new UpdateFee message, and also lock it
// in immediately by triggering a commitment update. // in immediately by triggering a commitment update.
msg := lnwire.NewUpdateFee(l.ChanID(), uint32(feePerKw)) msg := lnwire.NewUpdateFee(l.ChanID(), uint32(feePerKw))