peer: clamp a link's max HTLC forwarding policy to current max HTLC pay size
In this commit, we start to clamp the max HTLC forwarding policy to the current register max HTLC payment size. By doing this, we ensure that any links that have a advertised max HTLC transit size above the max payment size will reject any incoming or outgoing attempts for such large payments.
This commit is contained in:
1 file changed
+6
@@ -535,6 +535,9 @@ func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) (
|
||||
FeeRate: selfPolicy.FeeProportionalMillionths,
|
||||
TimeLockDelta: uint32(selfPolicy.TimeLockDelta),
|
||||
}
|
||||
if forwardingPolicy.MaxHTLC > MaxPaymentMSat {
|
||||
forwardingPolicy.MaxHTLC = MaxPaymentMSat
|
||||
}
|
||||
} else {
|
||||
peerLog.Warnf("Unable to find our forwarding policy "+
|
||||
"for channel %v, using default values",
|
||||
@@ -1866,6 +1869,9 @@ out:
|
||||
FeeRate: defaultPolicy.FeeRate,
|
||||
TimeLockDelta: defaultPolicy.TimeLockDelta,
|
||||
}
|
||||
if forwardingPolicy.MaxHTLC > MaxPaymentMSat {
|
||||
forwardingPolicy.MaxHTLC = MaxPaymentMSat
|
||||
}
|
||||
|
||||
// Create the link and add it to the switch.
|
||||
err = p.addLink(
|
||||
|
||||
Reference in new issue
Block a user