mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-18 13:27:56 +01:00
blindedpath: minHTLC for blinded path change.
We will not add a buffer to the chan policy for blinded paths in case the sender amount violates the minHTLC restriction in the first place. Moreover we disgard a route fast if the payment amount is smaller than the minHTLC along the route.
This commit is contained in:
parent
73984964a8
commit
25f7b1c362
@ -437,11 +437,27 @@ func collectRelayInfo(cfg *BuildBlindedPathCfg, path *candidatePath) (
|
||||
}
|
||||
}
|
||||
|
||||
policy, err = cfg.AddPolicyBuffer(policy)
|
||||
if policy.MinHTLCMsat > cfg.ValueMsat {
|
||||
return nil, 0, 0, fmt.Errorf("%w: minHTLC of hop "+
|
||||
"policy larger than payment amt: sentAmt(%v), "+
|
||||
"minHTLC(%v)", errInvalidBlindedPath,
|
||||
cfg.ValueMsat, policy.MinHTLCMsat)
|
||||
}
|
||||
|
||||
bufferPolicy, err := cfg.AddPolicyBuffer(policy)
|
||||
if err != nil {
|
||||
return nil, 0, 0, err
|
||||
}
|
||||
|
||||
// We only use the new buffered policy if the new minHTLC value
|
||||
// does not violate the sender amount.
|
||||
//
|
||||
// NOTE: We don't check this for maxHTLC, because the payment
|
||||
// amount can always be splitted using MPP.
|
||||
if bufferPolicy.MinHTLCMsat <= cfg.ValueMsat {
|
||||
policy = bufferPolicy
|
||||
}
|
||||
|
||||
// If this is the first policy we are collecting, then use this
|
||||
// policy to set the base values for min/max htlc.
|
||||
if len(hops) == 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user