rpcserver: populate features on lnrpc invoices

In the process, we also move the feature serialization into the
invoicesrpc package, so that it can be shared between the invoicesrpc
and main rpcserver.
This commit is contained in:
Conner Fromknecht committed 2019-12-12 00:12:51 -08:00
1 parent 7446495b6d
commit aba49c9a5a
2 files changed
+19 -15

No files matched your search

+1 -15
View File
@@ -4632,20 +4632,6 @@ 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),
@@ -4660,7 +4646,7 @@ func (r *rpcServer) DecodePayReq(ctx context.Context,
CltvExpiry: int64(payReq.MinFinalCLTVExpiry()),
RouteHints: routeHints,
PaymentAddr: paymentAddr,
Features: features,
Features: invoicesrpc.CreateRPCFeatures(payReq.Features),
}, nil
}