lnwire+rpcserver: populate feature bits on decodepayreq

This commit is contained in:
Conner Fromknecht committed 2019-12-10 13:09:36 -08:00
1 parent 5defa425e1
commit a168f37b9c
3 files changed
+94

No files matched your search

+15
View File
@@ -4620,6 +4620,20 @@ func (r *rpcServer) DecodePayReq(ctx context.Context,
paymentAddr = payReq.PaymentAddr[:]
}
// Convert any features on the payment request into a descriptive format
// for the rpc.
invFeatures := payReq.Features.Features()
features := make([]*lnrpc.Feature, 0, len(invFeatures))
for bit := range invFeatures {
name := payReq.Features.Name(bit)
features = append(features, &lnrpc.Feature{
Bit: uint32(bit),
Name: name,
IsRequired: bit.IsRequired(),
IsKnown: name != "unknown",
})
}
dest := payReq.Destination.SerializeCompressed()
return &lnrpc.PayReq{
Destination: hex.EncodeToString(dest),
@@ -4634,6 +4648,7 @@ func (r *rpcServer) DecodePayReq(ctx context.Context,
CltvExpiry: int64(payReq.MinFinalCLTVExpiry()),
RouteHints: routeHints,
PaymentAddr: paymentAddr,
Features: features,
}, nil
}