Skip to content

Commit 6696ccc

Browse files
committed
Merge branch 'v0.5.2-beta-rc6-2563' into v0.5.2-beta-rc6
2 parents 56cb4cf + 5bef4de commit 6696ccc

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

fundingmanager.go

+13-8
Original file line numberDiff line numberDiff line change
@@ -2111,10 +2111,12 @@ func (f *fundingManager) addToRouterGraph(completeChan *channeldb.OpenChannel,
21112111

21122112
// We'll obtain the max HTLC value we can forward in our direction, as
21132113
// we'll use this value within our ChannelUpdate. This value must be <=
2114-
// channel capacity and <= the maximum in-flight msats set by the peer, so
2115-
// we default to max in-flight msats as this value will always be <=
2116-
// channel capacity.
2114+
// channel capacity and <= the maximum in-flight msats set by the peer.
21172115
fwdMaxHTLC := completeChan.LocalChanCfg.MaxPendingAmount
2116+
capacityMSat := lnwire.NewMSatFromSatoshis(completeChan.Capacity)
2117+
if fwdMaxHTLC > capacityMSat {
2118+
fwdMaxHTLC = capacityMSat
2119+
}
21182120

21192121
ann, err := f.newChanAnnouncement(
21202122
f.cfg.IDKey, completeChan.IdentityPub,
@@ -2285,12 +2287,15 @@ func (f *fundingManager) annAfterSixConfs(completeChan *channeldb.OpenChannel,
22852287
// HTLC it deems economically relevant.
22862288
fwdMinHTLC := completeChan.LocalChanCfg.MinHTLC
22872289

2288-
// We'll obtain the max HTLC value we can forward in our direction, as
2289-
// we'll use this value within our ChannelUpdate. This value must be <=
2290-
// channel capacity and <= the maximum in-flight msats set by the peer,
2291-
// so we default to max in-flight msats as this value will always be <=
2292-
// channel capacity.
2290+
// We'll obtain the max HTLC value we can forward in our
2291+
// direction, as we'll use this value within our ChannelUpdate.
2292+
// This value must be <= channel capacity and <= the maximum
2293+
// in-flight msats set by the peer.
22932294
fwdMaxHTLC := completeChan.LocalChanCfg.MaxPendingAmount
2295+
capacityMSat := lnwire.NewMSatFromSatoshis(completeChan.Capacity)
2296+
if fwdMaxHTLC > capacityMSat {
2297+
fwdMaxHTLC = capacityMSat
2298+
}
22942299

22952300
// Create and broadcast the proofs required to make this channel
22962301
// public and usable for other nodes for routing.

0 commit comments

Comments
 (0)