fundingmanager: do not calculate unused policy values

This commit is contained in:
Joost Jager 2019-11-22 10:44:05 +01:00
parent a68144b709
commit dbce59d4e1
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7

@ -2375,30 +2375,13 @@ func (f *fundingManager) annAfterSixConfs(completeChan *channeldb.OpenChannel,
fndgLog.Infof("Announcing ChannelPoint(%v), short_chan_id=%v",
&fundingPoint, shortChanID)
// We'll obtain the min HTLC value we can forward in our
// direction, as we'll use this value within our ChannelUpdate.
// This constraint is originally set by the remote node, as it
// will be the one that will need to determine the smallest
// HTLC it deems economically relevant.
fwdMinHTLC := completeChan.LocalChanCfg.MinHTLC
// We'll obtain the max HTLC value we can forward in our
// direction, as we'll use this value within our ChannelUpdate.
// This value must be <= channel capacity and <= the maximum
// in-flight msats set by the peer.
fwdMaxHTLC := completeChan.LocalChanCfg.MaxPendingAmount
capacityMSat := lnwire.NewMSatFromSatoshis(completeChan.Capacity)
if fwdMaxHTLC > capacityMSat {
fwdMaxHTLC = capacityMSat
}
// Create and broadcast the proofs required to make this channel
// public and usable for other nodes for routing.
err = f.announceChannel(
f.cfg.IDKey, completeChan.IdentityPub,
completeChan.LocalChanCfg.MultiSigKey.PubKey,
completeChan.RemoteChanCfg.MultiSigKey.PubKey,
*shortChanID, chanID, fwdMinHTLC, fwdMaxHTLC,
*shortChanID, chanID,
)
if err != nil {
return fmt.Errorf("channel announcement failed: %v", err)
@ -2690,15 +2673,18 @@ func (f *fundingManager) newChanAnnouncement(localPubKey, remotePubKey,
// finish, either successfully or with an error.
func (f *fundingManager) announceChannel(localIDKey, remoteIDKey, localFundingKey,
remoteFundingKey *btcec.PublicKey, shortChanID lnwire.ShortChannelID,
chanID lnwire.ChannelID, fwdMinHTLC, fwdMaxHTLC lnwire.MilliSatoshi) error {
chanID lnwire.ChannelID) error {
// First, we'll create the batch of announcements to be sent upon
// initial channel creation. This includes the channel announcement
// itself, the channel update announcement, and our half of the channel
// proof needed to fully authenticate the channel.
//
// We can pass in zeroes for the min and max htlc policy, because we
// only use the channel announcement message from the returned struct.
ann, err := f.newChanAnnouncement(localIDKey, remoteIDKey,
localFundingKey, remoteFundingKey, shortChanID, chanID,
fwdMinHTLC, fwdMaxHTLC,
0, 0,
)
if err != nil {
fndgLog.Errorf("can't generate channel announcement: %v", err)