Merge pull request #9127 from MPins/issue-8993

Add the option on path creator to specify the incoming channel on blinded path
This commit is contained in:
Oliver Gugger authored and GitHub committed 2025-06-05 08:47:05 +02:00
commit fc906f2a65
15 files changed
+1694 -1197

No files matched your search

+39
View File
@@ -6199,6 +6199,10 @@ func (r *rpcServer) AddInvoice(ctx context.Context,
blindingRestrictions.NumHops = uint8(*blindCfg.NumHops)
}
if blindCfg.MaxNumPaths != nil {
if *blindCfg.MaxNumPaths == 0 {
return nil, fmt.Errorf("blinded max num " +
"paths cannot be 0")
}
blindingRestrictions.MaxNumPaths =
uint8(*blindCfg.MaxNumPaths)
}
@@ -6211,6 +6215,41 @@ func (r *rpcServer) AddInvoice(ctx context.Context,
blindingRestrictions.NodeOmissionSet.Add(vertex)
}
blindingRestrictions.IncomingChainedChannels = append(
blindingRestrictions.IncomingChainedChannels,
blindCfg.IncomingChannelList...,
)
numChainedChannels :=
uint8(len(blindingRestrictions.IncomingChainedChannels))
// When selecting the blinded incoming channel list parameter
// the maximum number of hops is implictitly set.
if numChainedChannels > blindingRestrictions.NumHops {
rpcsLog.Warnf("Changing the num_blinded_hops "+
"from (%d) to (%d)",
blindingRestrictions.NumHops,
numChainedChannels)
blindingRestrictions.NumHops =
numChainedChannels
}
// The MinDistanceFromIntroNode must be greater than or equal to
// the number of hops specified on the chained channels.
minNumHops := blindingRestrictions.MinDistanceFromIntroNode
if minNumHops < numChainedChannels {
// Ensure MinimumPath is at least the size of the
// chained path to avoid shorter routes being returned
// by the pathfinder.
return nil, fmt.Errorf("minimum number of blinded "+
"path hops (%d) must be greater than or equal "+
"to the number of hops specified on the "+
"chained channels (%d)", minNumHops,
numChainedChannels)
}
}
if blindingRestrictions.MinDistanceFromIntroNode >