mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-30 10:35:32 +02:00
multi: introduce BlindedPaymentPathSet
This commit introduces a new type, `BlindedPaymentPathSet`. For now, it holds only a single `BlindedPayment` but eventually it will hold and manage a set of blinded payments provided for a specific payment. To make the PR easier to follow though, we start off just letting it hold a single one and do some basic replacements.
This commit is contained in:
28
rpcserver.go
28
rpcserver.go
@ -5242,28 +5242,24 @@ func (r *rpcServer) extractPaymentIntent(rpcPayReq *rpcPaymentRequest) (rpcPayme
|
||||
payIntent.metadata = payReq.Metadata
|
||||
|
||||
if len(payReq.BlindedPaymentPaths) > 0 {
|
||||
// NOTE: Currently we only choose a single payment path.
|
||||
// This will be updated in a future PR to handle
|
||||
// multiple blinded payment paths.
|
||||
path := payReq.BlindedPaymentPaths[0]
|
||||
if len(path.Hops) == 0 {
|
||||
return payIntent, fmt.Errorf("a blinded " +
|
||||
"payment must have at least 1 hop")
|
||||
pathSet, err := routerrpc.BuildBlindedPathSet(
|
||||
payReq.BlindedPaymentPaths,
|
||||
)
|
||||
if err != nil {
|
||||
return payIntent, err
|
||||
}
|
||||
payIntent.blindedPayment = pathSet.GetPath()
|
||||
|
||||
finalHop := path.Hops[len(path.Hops)-1]
|
||||
payIntent.blindedPayment =
|
||||
routerrpc.MarshalBlindedPayment(path)
|
||||
|
||||
// Replace the target node with the blinded public key
|
||||
// of the blinded path's final node.
|
||||
// Replace the destination node with the target public
|
||||
// key of the blinded path set.
|
||||
copy(
|
||||
payIntent.dest[:],
|
||||
finalHop.BlindedNodePub.SerializeCompressed(),
|
||||
pathSet.TargetPubKey().SerializeCompressed(),
|
||||
)
|
||||
|
||||
if !payReq.BlindedPaymentPaths[0].Features.IsEmpty() {
|
||||
payIntent.destFeatures = path.Features.Clone()
|
||||
pathFeatures := pathSet.Features()
|
||||
if !pathFeatures.IsEmpty() {
|
||||
payIntent.destFeatures = pathFeatures.Clone()
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user