Merge pull request #3806 from Roasbeef/payreq-msat

lnrpc: add msats to return value of DecodePayReq
This commit is contained in:
Olaoluwa Osuntokun 2019-12-09 16:37:18 -08:00 committed by GitHub
commit 1ab3107df4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 572 additions and 557 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2616,6 +2616,7 @@ message PayReq {
int64 cltv_expiry = 9 [json_name = "cltv_expiry"];
repeated RouteHint route_hints = 10 [json_name = "route_hints"];
bytes payment_addr = 11 [json_name = "payment_addr"];
int64 num_msat = 12 [json_name = "num_msat"];
}
message FeeReportRequest {}

View File

@ -3252,6 +3252,10 @@
"payment_addr": {
"type": "string",
"format": "byte"
},
"num_msat": {
"type": "string",
"format": "int64"
}
}
},

View File

@ -4588,9 +4588,10 @@ func (r *rpcServer) DecodePayReq(ctx context.Context,
// Convert between the `lnrpc` and `routing` types.
routeHints := invoicesrpc.CreateRPCRouteHints(payReq.RouteHints)
amt := int64(0)
var amtSat, amtMsat int64
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.
@ -4603,7 +4604,8 @@ func (r *rpcServer) DecodePayReq(ctx context.Context,
return &lnrpc.PayReq{
Destination: hex.EncodeToString(dest),
PaymentHash: hex.EncodeToString(payReq.PaymentHash[:]),
NumSatoshis: amt,
NumSatoshis: amtSat,
NumMsat: amtMsat,
Timestamp: payReq.Timestamp.Unix(),
Description: desc,
DescriptionHash: hex.EncodeToString(descHash[:]),