lnrpc+rpcserver: Add blinded payment paths to PayReq

This commit adds a blinded_paths field to the PayReq proto message. A
new helper called `CreateRPCBlindedPayments` is then added to convert
the zpay32 type to the existing `lnrpc.BlindedPaymentPath` type and add
this to the `PayReq` in the `DecodePayReq` rpc method.
This commit is contained in:
Elle Mouton committed 2024-07-10 17:51:55 +02:00
1 parent f6a54c2ede
commit 93f89512ae
5 files changed
+283 -201

No files matched your search

+8
View File
@@ -6971,6 +6971,13 @@ func (r *rpcServer) DecodePayReq(ctx context.Context,
// Convert between the `lnrpc` and `routing` types.
routeHints := invoicesrpc.CreateRPCRouteHints(payReq.RouteHints)
blindedPaymentPaths, err := invoicesrpc.CreateRPCBlindedPayments(
payReq.BlindedPaymentPaths,
)
if err != nil {
return nil, err
}
var amtSat, amtMsat int64
if payReq.MilliSat != nil {
amtSat = int64(payReq.MilliSat.ToSatoshis())
@@ -6996,6 +7003,7 @@ func (r *rpcServer) DecodePayReq(ctx context.Context,
Expiry: expiry,
CltvExpiry: int64(payReq.MinFinalCLTVExpiry()),
RouteHints: routeHints,
BlindedPaths: blindedPaymentPaths,
PaymentAddr: paymentAddr,
Features: invoicesrpc.CreateRPCFeatures(payReq.Features),
}, nil