diff --git a/fundingmanager.go b/fundingmanager.go index 5bc42586..ce6cf46c 100644 --- a/fundingmanager.go +++ b/fundingmanager.go @@ -2072,16 +2072,17 @@ func (f *fundingManager) addToRouterGraph(completeChan *channeldb.OpenChannel, chanID := lnwire.NewChanIDFromOutPoint(&completeChan.FundingOutpoint) - // We'll obtain their min HTLC as we'll use this value within our - // ChannelUpdate. We use this value isn't of ours, as the remote party - // will be the one that's carrying the HTLC towards us. - remoteMinHTLC := completeChan.RemoteChanCfg.MinHTLC + // 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 ann, err := f.newChanAnnouncement( f.cfg.IDKey, completeChan.IdentityPub, completeChan.LocalChanCfg.MultiSigKey.PubKey, completeChan.RemoteChanCfg.MultiSigKey.PubKey, *shortChanID, - chanID, remoteMinHTLC, + chanID, fwdMinHTLC, ) if err != nil { return fmt.Errorf("error generating channel "+ @@ -2192,11 +2193,12 @@ func (f *fundingManager) annAfterSixConfs(completeChan *channeldb.OpenChannel, fndgLog.Infof("Announcing ChannelPoint(%v), short_chan_id=%v", &fundingPoint, spew.Sdump(shortChanID)) - // We'll obtain their min HTLC as we'll use this value within - // our ChannelUpdate. We use this value isn't of ours, as the - // remote party will be the one that's carrying the HTLC towards - // us. - remoteMinHTLC := completeChan.RemoteChanCfg.MinHTLC + // 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 // Create and broadcast the proofs required to make this channel // public and usable for other nodes for routing. @@ -2204,7 +2206,7 @@ func (f *fundingManager) annAfterSixConfs(completeChan *channeldb.OpenChannel, f.cfg.IDKey, completeChan.IdentityPub, completeChan.LocalChanCfg.MultiSigKey.PubKey, completeChan.RemoteChanCfg.MultiSigKey.PubKey, - *shortChanID, chanID, remoteMinHTLC, + *shortChanID, chanID, fwdMinHTLC, ) if err != nil { return fmt.Errorf("channel announcement failed: %v", err) @@ -2371,10 +2373,10 @@ type chanAnnouncement struct { // identity pub keys of both parties to the channel, and the second segment is // authenticated only by us and contains our directional routing policy for the // channel. -func (f *fundingManager) newChanAnnouncement(localPubKey, remotePubKey *btcec.PublicKey, +func (f *fundingManager) newChanAnnouncement(localPubKey, remotePubKey, localFundingKey, remoteFundingKey *btcec.PublicKey, shortChanID lnwire.ShortChannelID, chanID lnwire.ChannelID, - remoteMinHTLC lnwire.MilliSatoshi) (*chanAnnouncement, error) { + fwdMinHTLC lnwire.MilliSatoshi) (*chanAnnouncement, error) { chainHash := *f.cfg.Wallet.Cfg.NetParams.GenesisHash @@ -2428,9 +2430,10 @@ func (f *fundingManager) newChanAnnouncement(localPubKey, remotePubKey *btcec.Pu Flags: chanFlags, TimeLockDelta: uint16(f.cfg.DefaultRoutingPolicy.TimeLockDelta), - // We use the *remote* party's HtlcMinimumMsat, as they'll be - // the ones carrying the HTLC routed *towards* us. - HtlcMinimumMsat: remoteMinHTLC, + // We use the HtlcMinimumMsat that the remote party required us + // to use, as our ChannelUpdate will be used to carry HTLCs + // towards them. + HtlcMinimumMsat: fwdMinHTLC, BaseFee: uint32(f.cfg.DefaultRoutingPolicy.BaseFee), FeeRate: uint32(f.cfg.DefaultRoutingPolicy.FeeRate), @@ -2509,7 +2512,7 @@ func (f *fundingManager) newChanAnnouncement(localPubKey, remotePubKey *btcec.Pu // finish, either successfully or with an error. func (f *fundingManager) announceChannel(localIDKey, remoteIDKey, localFundingKey, remoteFundingKey *btcec.PublicKey, shortChanID lnwire.ShortChannelID, - chanID lnwire.ChannelID, remoteMinHTLC lnwire.MilliSatoshi) error { + chanID lnwire.ChannelID, fwdMinHTLC lnwire.MilliSatoshi) error { // First, we'll create the batch of announcements to be sent upon // initial channel creation. This includes the channel announcement @@ -2517,7 +2520,7 @@ func (f *fundingManager) announceChannel(localIDKey, remoteIDKey, localFundingKe // proof needed to fully authenticate the channel. ann, err := f.newChanAnnouncement(localIDKey, remoteIDKey, localFundingKey, remoteFundingKey, shortChanID, chanID, - remoteMinHTLC, + fwdMinHTLC, ) if err != nil { fndgLog.Errorf("can't generate channel announcement: %v", err)