fundingmanager: do not calculate unused policy values
This commit is contained in:
parent
a68144b709
commit
dbce59d4e1
@ -2375,30 +2375,13 @@ func (f *fundingManager) annAfterSixConfs(completeChan *channeldb.OpenChannel,
|
|||||||
fndgLog.Infof("Announcing ChannelPoint(%v), short_chan_id=%v",
|
fndgLog.Infof("Announcing ChannelPoint(%v), short_chan_id=%v",
|
||||||
&fundingPoint, shortChanID)
|
&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
|
// Create and broadcast the proofs required to make this channel
|
||||||
// public and usable for other nodes for routing.
|
// public and usable for other nodes for routing.
|
||||||
err = f.announceChannel(
|
err = f.announceChannel(
|
||||||
f.cfg.IDKey, completeChan.IdentityPub,
|
f.cfg.IDKey, completeChan.IdentityPub,
|
||||||
completeChan.LocalChanCfg.MultiSigKey.PubKey,
|
completeChan.LocalChanCfg.MultiSigKey.PubKey,
|
||||||
completeChan.RemoteChanCfg.MultiSigKey.PubKey,
|
completeChan.RemoteChanCfg.MultiSigKey.PubKey,
|
||||||
*shortChanID, chanID, fwdMinHTLC, fwdMaxHTLC,
|
*shortChanID, chanID,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("channel announcement failed: %v", err)
|
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.
|
// finish, either successfully or with an error.
|
||||||
func (f *fundingManager) announceChannel(localIDKey, remoteIDKey, localFundingKey,
|
func (f *fundingManager) announceChannel(localIDKey, remoteIDKey, localFundingKey,
|
||||||
remoteFundingKey *btcec.PublicKey, shortChanID lnwire.ShortChannelID,
|
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
|
// First, we'll create the batch of announcements to be sent upon
|
||||||
// initial channel creation. This includes the channel announcement
|
// initial channel creation. This includes the channel announcement
|
||||||
// itself, the channel update announcement, and our half of the channel
|
// itself, the channel update announcement, and our half of the channel
|
||||||
// proof needed to fully authenticate 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,
|
ann, err := f.newChanAnnouncement(localIDKey, remoteIDKey,
|
||||||
localFundingKey, remoteFundingKey, shortChanID, chanID,
|
localFundingKey, remoteFundingKey, shortChanID, chanID,
|
||||||
fwdMinHTLC, fwdMaxHTLC,
|
0, 0,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fndgLog.Errorf("can't generate channel announcement: %v", err)
|
fndgLog.Errorf("can't generate channel announcement: %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user