routerrpc: validate DestFeatures from RPC

This commit is contained in:
Johan T. Halseth 2021-03-31 12:42:02 +02:00
parent 0b9137cdac
commit 8f57dcf28f
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -13,6 +13,7 @@ import (
"github.com/btcsuite/btcd/wire" "github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil" "github.com/btcsuite/btcutil"
"github.com/lightningnetwork/lnd/channeldb" "github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/feature"
"github.com/lightningnetwork/lnd/htlcswitch" "github.com/lightningnetwork/lnd/htlcswitch"
"github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/lntypes" "github.com/lightningnetwork/lnd/lntypes"
@ -757,6 +758,14 @@ func (r *RouterBackend) extractIntentFromSendRequest(
return nil, err return nil, err
} }
// Validate the features if any was specified.
if features != nil {
err = feature.ValidateDeps(features)
if err != nil {
return nil, err
}
}
// If the payment addresses is specified, then we'll also // If the payment addresses is specified, then we'll also
// populate that now as well. // populate that now as well.
if len(rpcPayReq.PaymentAddr) != 0 { if len(rpcPayReq.PaymentAddr) != 0 {