Merge pull request #3806 from Roasbeef/payreq-msat

lnrpc: add msats to return value of DecodePayReq
This commit is contained in:
Olaoluwa Osuntokun authored and GitHub committed 2019-12-09 16:37:18 -08:00
commit 1ab3107df4
4 files changed
+572 -557

No files matched your search

+562 -554
View File
File diff suppressed because it is too large. Load diff
+1
View File
@@ -2616,6 +2616,7 @@ message PayReq {
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"]; bytes payment_addr = 11 [json_name = "payment_addr"];
int64 num_msat = 12 [json_name = "num_msat"];
} }
message FeeReportRequest {} message FeeReportRequest {}
+4
View File
@@ -3252,6 +3252,10 @@
"payment_addr": { "payment_addr": {
"type": "string", "type": "string",
"format": "byte" "format": "byte"
},
"num_msat": {
"type": "string",
"format": "int64"
} }
} }
}, },
+5 -3
View File
@@ -4588,9 +4588,10 @@ func (r *rpcServer) DecodePayReq(ctx context.Context,
// Convert between the `lnrpc` and `routing` types. // Convert between the `lnrpc` and `routing` types.
routeHints := invoicesrpc.CreateRPCRouteHints(payReq.RouteHints) routeHints := invoicesrpc.CreateRPCRouteHints(payReq.RouteHints)
amt := int64(0) var amtSat, amtMsat int64
if payReq.MilliSat != nil { if payReq.MilliSat != nil {
amt = int64(payReq.MilliSat.ToSatoshis()) amtSat = int64(payReq.MilliSat.ToSatoshis())
amtMsat = int64(*payReq.MilliSat)
} }
// Extract the payment address from the payment request, if present. // Extract the payment address from the payment request, if present.
@@ -4603,7 +4604,8 @@ func (r *rpcServer) DecodePayReq(ctx context.Context,
return &lnrpc.PayReq{ return &lnrpc.PayReq{
Destination: hex.EncodeToString(dest), Destination: hex.EncodeToString(dest),
PaymentHash: hex.EncodeToString(payReq.PaymentHash[:]), PaymentHash: hex.EncodeToString(payReq.PaymentHash[:]),
NumSatoshis: amt, NumSatoshis: amtSat,
NumMsat: amtMsat,
Timestamp: payReq.Timestamp.Unix(), Timestamp: payReq.Timestamp.Unix(),
Description: desc, Description: desc,
DescriptionHash: hex.EncodeToString(descHash[:]), DescriptionHash: hex.EncodeToString(descHash[:]),