mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-19 05:45:21 +01:00
Merge pull request #2563 from halseth/funding-ensure-max-value-less-than-cap
funding: cap the max_htlc value at channel capacity
This commit is contained in:
commit
6a3addbeda
@ -2112,10 +2112,12 @@ func (f *fundingManager) addToRouterGraph(completeChan *channeldb.OpenChannel,
|
|||||||
|
|
||||||
// We'll obtain the max HTLC value we can forward in our direction, as
|
// 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 <=
|
// we'll use this value within our ChannelUpdate. This value must be <=
|
||||||
// channel capacity and <= the maximum in-flight msats set by the peer, so
|
// channel capacity and <= the maximum in-flight msats set by the peer.
|
||||||
// we default to max in-flight msats as this value will always be <=
|
|
||||||
// channel capacity.
|
|
||||||
fwdMaxHTLC := completeChan.LocalChanCfg.MaxPendingAmount
|
fwdMaxHTLC := completeChan.LocalChanCfg.MaxPendingAmount
|
||||||
|
capacityMSat := lnwire.NewMSatFromSatoshis(completeChan.Capacity)
|
||||||
|
if fwdMaxHTLC > capacityMSat {
|
||||||
|
fwdMaxHTLC = capacityMSat
|
||||||
|
}
|
||||||
|
|
||||||
ann, err := f.newChanAnnouncement(
|
ann, err := f.newChanAnnouncement(
|
||||||
f.cfg.IDKey, completeChan.IdentityPub,
|
f.cfg.IDKey, completeChan.IdentityPub,
|
||||||
@ -2286,12 +2288,15 @@ func (f *fundingManager) annAfterSixConfs(completeChan *channeldb.OpenChannel,
|
|||||||
// HTLC it deems economically relevant.
|
// HTLC it deems economically relevant.
|
||||||
fwdMinHTLC := completeChan.LocalChanCfg.MinHTLC
|
fwdMinHTLC := completeChan.LocalChanCfg.MinHTLC
|
||||||
|
|
||||||
// We'll obtain the max HTLC value we can forward in our direction, as
|
// We'll obtain the max HTLC value we can forward in our
|
||||||
// we'll use this value within our ChannelUpdate. This value must be <=
|
// direction, as we'll use this value within our ChannelUpdate.
|
||||||
// channel capacity and <= the maximum in-flight msats set by the peer,
|
// This value must be <= channel capacity and <= the maximum
|
||||||
// so we default to max in-flight msats as this value will always be <=
|
// in-flight msats set by the peer.
|
||||||
// channel capacity.
|
|
||||||
fwdMaxHTLC := completeChan.LocalChanCfg.MaxPendingAmount
|
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.
|
||||||
|
Loading…
Reference in New Issue
Block a user