lnrpc+rpcserver: add payment_addr field to PayReq

This commit is contained in:
Conner Fromknecht committed 2019-12-05 07:59:47 -08:00
1 parent cd27ee7cfc
commit abb7f4fa9e
4 files changed
+560 -540

No files matched your search

+548 -540
View File
File diff suppressed because it is too large. Load diff
+1
View File
@@ -2615,6 +2615,7 @@ message PayReq {
string fallback_addr = 8 [json_name = "fallback_addr"]; string fallback_addr = 8 [json_name = "fallback_addr"];
int64 cltv_expiry = 9 [json_name = "cltv_expiry"]; int64 cltv_expiry = 9 [json_name = "cltv_expiry"];
repeated RouteHint route_hints = 10 [json_name = "route_hints"]; repeated RouteHint route_hints = 10 [json_name = "route_hints"];
bytes payment_addr = 11 [json_name = "payment_addr"];
} }
message FeeReportRequest {} message FeeReportRequest {}
+4
View File
@@ -3248,6 +3248,10 @@
"items": { "items": {
"$ref": "#/definitions/lnrpcRouteHint" "$ref": "#/definitions/lnrpcRouteHint"
} }
},
"payment_addr": {
"type": "string",
"format": "byte"
} }
} }
}, },
+7
View File
@@ -4593,6 +4593,12 @@ func (r *rpcServer) DecodePayReq(ctx context.Context,
amt = int64(payReq.MilliSat.ToSatoshis()) amt = int64(payReq.MilliSat.ToSatoshis())
} }
// Extract the payment address from the payment request, if present.
var paymentAddr []byte
if payReq.PaymentAddr != nil {
paymentAddr = payReq.PaymentAddr[:]
}
dest := payReq.Destination.SerializeCompressed() dest := payReq.Destination.SerializeCompressed()
return &lnrpc.PayReq{ return &lnrpc.PayReq{
Destination: hex.EncodeToString(dest), Destination: hex.EncodeToString(dest),
@@ -4605,6 +4611,7 @@ func (r *rpcServer) DecodePayReq(ctx context.Context,
Expiry: expiry, Expiry: expiry,
CltvExpiry: int64(payReq.MinFinalCLTVExpiry()), CltvExpiry: int64(payReq.MinFinalCLTVExpiry()),
RouteHints: routeHints, RouteHints: routeHints,
PaymentAddr: paymentAddr,
}, nil }, nil
} }