zpay32: add functional opt to error out on unknown feature bit
This commit adds two functional options to the zpay32.Decode function. `WithKnownFeatureBits` allows the caller to overwrite the default set of known feature bits used by the function. `WithErrorOnUnknownFeatureBit` allows the caller to instruct the function to error out if the invoice that is decoded contaijns unknown feature bits. We then use this new error-out option from the `rpcServer`'s `extractPaymentIntent` method.
This commit is contained in:
3 files changed
+133
-4
No files matched your search
@@ -5210,6 +5210,7 @@ func (r *rpcServer) extractPaymentIntent(rpcPayReq *rpcPaymentRequest) (rpcPayme
|
||||
if rpcPayReq.PaymentRequest != "" {
|
||||
payReq, err := zpay32.Decode(
|
||||
rpcPayReq.PaymentRequest, r.cfg.ActiveNetParams.Params,
|
||||
zpay32.WithErrorOnUnknownFeatureBit(),
|
||||
)
|
||||
if err != nil {
|
||||
return payIntent, err
|
||||
|
||||
Reference in new issue
Block a user