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:
parent
392c1a9a1b
commit
c943d85019
6
peer.go
6
peer.go
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user