routerrpc: extend payment request parameters

Add missing parameters to routerrpc version of SendPayment.
This commit is contained in:
Joost Jager 2019-04-18 09:34:28 +02:00
parent 19d5f8f82c
commit eb700d35e1
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7
7 changed files with 376 additions and 215 deletions

View File

@ -5,10 +5,9 @@ package routerrpc
import ( import (
"time" "time"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcutil" "github.com/btcsuite/btcutil"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/macaroons" "github.com/lightningnetwork/lnd/macaroons"
"github.com/lightningnetwork/lnd/routing" "github.com/lightningnetwork/lnd/routing"
) )
@ -45,12 +44,6 @@ type Config struct {
// server will find the macaroon named DefaultRouterMacFilename. // server will find the macaroon named DefaultRouterMacFilename.
NetworkDir string NetworkDir string
// ActiveNetParams are the network parameters of the primary network
// that the route is operating on. This is necessary so we can ensure
// that we receive payment requests that send to destinations on our
// network.
ActiveNetParams *chaincfg.Params
// MacService is the main macaroon service that we'll use to handle // MacService is the main macaroon service that we'll use to handle
// authentication for the Router rpc server. // authentication for the Router rpc server.
MacService *macaroons.Service MacService *macaroons.Service

View File

@ -113,32 +113,43 @@ func (Failure_FailureCode) EnumDescriptor() ([]byte, []int) {
} }
type PaymentRequest struct { type PaymentRequest struct {
/// The identity pubkey of the payment recipient
Dest []byte `protobuf:"bytes,1,opt,name=dest,proto3" json:"dest,omitempty"`
/// Number of satoshis to send.
Amt int64 `protobuf:"varint,2,opt,name=amt,proto3" json:"amt,omitempty"`
/// The hash to use within the payment's HTLC
PaymentHash []byte `protobuf:"bytes,3,opt,name=payment_hash,json=paymentHash,proto3" json:"payment_hash,omitempty"`
//* //*
//A serialized BOLT-11 payment request that contains all information //The CLTV delta from the current height that should be used to set the
//required to dispatch the payment. If the pay req is invalid, or expired, //timelock for the final hop.
//an error will be returned. FinalCltvDelta int32 `protobuf:"varint,4,opt,name=final_cltv_delta,json=finalCltvDelta,proto3" json:"final_cltv_delta,omitempty"`
PayReq string `protobuf:"bytes,1,opt,name=pay_req,json=payReq,proto3" json:"pay_req,omitempty"`
//* //*
//An absolute limit on the highest fee we should pay when looking for a route //A bare-bones invoice for a payment within the Lightning Network. With the
//to the destination. Routes with fees higher than this will be ignored, if //details of the invoice, the sender has all the data necessary to send a
//there are no routes with a fee below this amount, an error will be //payment to the recipient. The amount in the payment request may be zero. In
//returned. //that case it is required to set the amt field as well. If no payment request
FeeLimitSat int64 `protobuf:"varint,2,opt,name=fee_limit_sat,json=feeLimitSat,proto3" json:"fee_limit_sat,omitempty"` //is specified, the following fields are required: dest, amt and payment_hash.
//* PaymentRequest string `protobuf:"bytes,5,opt,name=payment_request,json=paymentRequest,proto3" json:"payment_request,omitempty"`
//An absolute limit on the cumulative CLTV value along the route for this
//payment. Routes with total CLTV values higher than this will be ignored,
//if there are no routes with a CLTV value below this amount, an error will
//be returned.
CltvLimit int32 `protobuf:"varint,3,opt,name=cltv_limit,json=cltvLimit,proto3" json:"cltv_limit,omitempty"`
//* //*
//An upper limit on the amount of time we should spend when attempting to //An upper limit on the amount of time we should spend when attempting to
//fulfill the payment. This is expressed in seconds. If we cannot make a //fulfill the payment. This is expressed in seconds. If we cannot make a
//successful payment within this time frame, an error will be returned. //successful payment within this time frame, an error will be returned.
TimeoutSeconds int32 `protobuf:"varint,4,opt,name=timeout_seconds,json=timeoutSeconds,proto3" json:"timeout_seconds,omitempty"` //This field must be non-zero.
TimeoutSeconds int32 `protobuf:"varint,6,opt,name=timeout_seconds,json=timeoutSeconds,proto3" json:"timeout_seconds,omitempty"`
//*
//The maximum number of satoshis that will be paid as a fee of the payment.
//If this field is left to the default value of 0, only zero-fee routes will
//be considered. This usually means single hop routes connecting directly to
//the destination. To send the payment without a fee limit, use max int here.
FeeLimitSat int64 `protobuf:"varint,7,opt,name=fee_limit_sat,json=feeLimitSat,proto3" json:"fee_limit_sat,omitempty"`
//* //*
//The channel id of the channel that must be taken to the first hop. If zero, //The channel id of the channel that must be taken to the first hop. If zero,
//any channel may be used. //any channel may be used.
OutgoingChannelId int64 `protobuf:"varint,5,opt,name=outgoing_channel_id,json=outgoingChannelId,proto3" json:"outgoing_channel_id,omitempty"` OutgoingChanId uint64 `protobuf:"varint,8,opt,name=outgoing_chan_id,json=outgoingChanId,proto3" json:"outgoing_chan_id,omitempty"`
//*
//An optional maximum total time lock for the route. If zero, there is no
//maximum enforced.
CltvLimit int32 `protobuf:"varint,9,opt,name=cltv_limit,json=cltvLimit,proto3" json:"cltv_limit,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
@ -169,27 +180,41 @@ func (m *PaymentRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_PaymentRequest proto.InternalMessageInfo var xxx_messageInfo_PaymentRequest proto.InternalMessageInfo
func (m *PaymentRequest) GetPayReq() string { func (m *PaymentRequest) GetDest() []byte {
if m != nil { if m != nil {
return m.PayReq return m.Dest
}
return nil
}
func (m *PaymentRequest) GetAmt() int64 {
if m != nil {
return m.Amt
}
return 0
}
func (m *PaymentRequest) GetPaymentHash() []byte {
if m != nil {
return m.PaymentHash
}
return nil
}
func (m *PaymentRequest) GetFinalCltvDelta() int32 {
if m != nil {
return m.FinalCltvDelta
}
return 0
}
func (m *PaymentRequest) GetPaymentRequest() string {
if m != nil {
return m.PaymentRequest
} }
return "" return ""
} }
func (m *PaymentRequest) GetFeeLimitSat() int64 {
if m != nil {
return m.FeeLimitSat
}
return 0
}
func (m *PaymentRequest) GetCltvLimit() int32 {
if m != nil {
return m.CltvLimit
}
return 0
}
func (m *PaymentRequest) GetTimeoutSeconds() int32 { func (m *PaymentRequest) GetTimeoutSeconds() int32 {
if m != nil { if m != nil {
return m.TimeoutSeconds return m.TimeoutSeconds
@ -197,9 +222,23 @@ func (m *PaymentRequest) GetTimeoutSeconds() int32 {
return 0 return 0
} }
func (m *PaymentRequest) GetOutgoingChannelId() int64 { func (m *PaymentRequest) GetFeeLimitSat() int64 {
if m != nil { if m != nil {
return m.OutgoingChannelId return m.FeeLimitSat
}
return 0
}
func (m *PaymentRequest) GetOutgoingChanId() uint64 {
if m != nil {
return m.OutgoingChanId
}
return 0
}
func (m *PaymentRequest) GetCltvLimit() int32 {
if m != nil {
return m.CltvLimit
} }
return 0 return 0
} }
@ -1027,98 +1066,101 @@ func init() {
func init() { proto.RegisterFile("routerrpc/router.proto", fileDescriptor_7a0613f69d37b0a5) } func init() { proto.RegisterFile("routerrpc/router.proto", fileDescriptor_7a0613f69d37b0a5) }
var fileDescriptor_7a0613f69d37b0a5 = []byte{ var fileDescriptor_7a0613f69d37b0a5 = []byte{
// 1456 bytes of a gzipped FileDescriptorProto // 1503 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xdb, 0x72, 0x1a, 0x47, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x57, 0xdd, 0x72, 0xda, 0xce,
0x13, 0xfe, 0x31, 0x12, 0x87, 0xe6, 0xa0, 0xd5, 0xe8, 0x60, 0x84, 0x2c, 0x5b, 0xde, 0xff, 0xff, 0x15, 0x2f, 0x06, 0x1b, 0x38, 0x7c, 0xc9, 0xeb, 0x8f, 0x60, 0x6c, 0xe7, 0xef, 0xa8, 0x6d, 0xc2,
0x1d, 0x95, 0xcb, 0x25, 0x55, 0x48, 0xd9, 0x95, 0xab, 0xa4, 0x30, 0x2c, 0xd1, 0x96, 0x60, 0xc1, 0x64, 0x32, 0xf6, 0x94, 0x4e, 0x32, 0xbd, 0x6a, 0x87, 0x80, 0xa8, 0x35, 0x06, 0xe1, 0x2c, 0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0x54, 0x5e, 0xff, 0x3f, 0xda, 0xd2, 0xca, 0x86, 0x91, 0x58, 0xb3, 0xf2, 0xfc, 0x40,
0xf8, 0x5f, 0xfc, 0x15, 0x00, 0x00, 0xff, 0xff, 0xe1, 0x3e, 0x2a, 0xde, 0x10, 0x0c, 0x00, 0x00, 0xad, 0x59, 0xf9, 0xc1, 0x64, 0x7d, 0xfc, 0xcd, 0x9f, 0x2e, 0x46, 0x0e, 0x1f, 0x4f, 0xef, 0xce,
0x87, 0xfe, 0xe4, 0xc2, 0x75, 0x46, 0x63, 0xee, 0x39, 0xde, 0xc8, 0x63, 0xfc, 0xaf, 0x7e, 0xf8,
0x70, 0xe1, 0x7a, 0xf6, 0x85, 0x7c, 0xa5, 0x5d, 0x2c, 0xd4, 0xdd, 0xed, 0xc8, 0xff, 0x2e, 0x7e,
0xfb, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x15, 0x95, 0x7d, 0xcd, 0x8d, 0x0c, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.

View File

@ -7,41 +7,57 @@ package routerrpc;
option go_package = "github.com/lightningnetwork/lnd/lnrpc/routerrpc"; option go_package = "github.com/lightningnetwork/lnd/lnrpc/routerrpc";
message PaymentRequest { message PaymentRequest {
/** /// The identity pubkey of the payment recipient
A serialized BOLT-11 payment request that contains all information bytes dest = 1;
required to dispatch the payment. If the pay req is invalid, or expired,
an error will be returned. /// Number of satoshis to send.
*/ int64 amt = 2;
string pay_req = 1;
/// The hash to use within the payment's HTLC
bytes payment_hash = 3;
/** /**
An absolute limit on the highest fee we should pay when looking for a route The CLTV delta from the current height that should be used to set the
to the destination. Routes with fees higher than this will be ignored, if timelock for the final hop.
there are no routes with a fee below this amount, an error will be
returned.
*/ */
int64 fee_limit_sat = 2; int32 final_cltv_delta = 4;
/** /**
An absolute limit on the cumulative CLTV value along the route for this A bare-bones invoice for a payment within the Lightning Network. With the
payment. Routes with total CLTV values higher than this will be ignored, details of the invoice, the sender has all the data necessary to send a
if there are no routes with a CLTV value below this amount, an error will payment to the recipient. The amount in the payment request may be zero. In
be returned. that case it is required to set the amt field as well. If no payment request
is specified, the following fields are required: dest, amt and payment_hash.
*/ */
int32 cltv_limit = 3; string payment_request = 5;
/** /**
An upper limit on the amount of time we should spend when attempting to An upper limit on the amount of time we should spend when attempting to
fulfill the payment. This is expressed in seconds. If we cannot make a fulfill the payment. This is expressed in seconds. If we cannot make a
successful payment within this time frame, an error will be returned. successful payment within this time frame, an error will be returned.
This field must be non-zero.
*/ */
int32 timeout_seconds = 4; int32 timeout_seconds = 6;
/**
The maximum number of satoshis that will be paid as a fee of the payment.
If this field is left to the default value of 0, only zero-fee routes will
be considered. This usually means single hop routes connecting directly to
the destination. To send the payment without a fee limit, use max int here.
*/
int64 fee_limit_sat = 7;
/** /**
The channel id of the channel that must be taken to the first hop. If zero, The channel id of the channel that must be taken to the first hop. If zero,
any channel may be used. any channel may be used.
*/ */
int64 outgoing_channel_id = 5; uint64 outgoing_chan_id = 8;
/**
An optional maximum total time lock for the route. If zero, there is no
maximum enforced.
*/
int32 cltv_limit = 9;
} }
message PaymentResponse { message PaymentResponse {

View File

@ -4,12 +4,15 @@ import (
"encoding/hex" "encoding/hex"
"errors" "errors"
"fmt" "fmt"
"time"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcutil" "github.com/btcsuite/btcutil"
"github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnrpc"
"github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/routing" "github.com/lightningnetwork/lnd/routing"
"github.com/lightningnetwork/lnd/routing/route" "github.com/lightningnetwork/lnd/routing/route"
"github.com/lightningnetwork/lnd/zpay32"
context "golang.org/x/net/context" context "golang.org/x/net/context"
) )
@ -38,6 +41,12 @@ type RouterBackend struct {
finalExpiry ...uint16) (*route.Route, error) finalExpiry ...uint16) (*route.Route, error)
MissionControl *routing.MissionControl MissionControl *routing.MissionControl
// ActiveNetParams are the network parameters of the primary network
// that the route is operating on. This is necessary so we can ensure
// that we receive payment requests that send to destinations on our
// network.
ActiveNetParams *chaincfg.Params
} }
// QueryRoutes attempts to query the daemons' Channel Router for a possible // QueryRoutes attempts to query the daemons' Channel Router for a possible
@ -336,3 +345,158 @@ func (r *RouterBackend) UnmarshallRoute(rpcroute *lnrpc.Route) (
return route, nil return route, nil
} }
// extractIntentFromSendRequest attempts to parse the SendRequest details
// required to dispatch a client from the information presented by an RPC
// client.
func (r *RouterBackend) extractIntentFromSendRequest(rpcPayReq *PaymentRequest) (
*routing.LightningPayment, error) {
payIntent := &routing.LightningPayment{}
// Pass along an outgoing channel restriction if specified.
if rpcPayReq.OutgoingChanId != 0 {
payIntent.OutgoingChannelID = &rpcPayReq.OutgoingChanId
}
// Take cltv limit from request if set.
if rpcPayReq.CltvLimit != 0 {
cltvLimit := uint32(rpcPayReq.CltvLimit)
payIntent.CltvLimit = &cltvLimit
}
// Take fee limit from request.
payIntent.FeeLimit = lnwire.NewMSatFromSatoshis(
btcutil.Amount(rpcPayReq.FeeLimitSat),
)
// Set payment attempt timeout.
if rpcPayReq.TimeoutSeconds == 0 {
return nil, errors.New("timeout_seconds must be specified")
}
payIntent.PayAttemptTimeout = time.Second *
time.Duration(rpcPayReq.TimeoutSeconds)
// If the payment request field isn't blank, then the details of the
// invoice are encoded entirely within the encoded payReq. So we'll
// attempt to decode it, populating the payment accordingly.
if rpcPayReq.PaymentRequest != "" {
switch {
case len(rpcPayReq.Dest) > 0:
return nil, errors.New("dest and payment_request " +
"cannot appear together")
case len(rpcPayReq.PaymentHash) > 0:
return nil, errors.New("dest and payment_hash " +
"cannot appear together")
case rpcPayReq.FinalCltvDelta != 0:
return nil, errors.New("dest and final_cltv_delta " +
"cannot appear together")
}
payReq, err := zpay32.Decode(
rpcPayReq.PaymentRequest, r.ActiveNetParams,
)
if err != nil {
return nil, err
}
// Next, we'll ensure that this payreq hasn't already expired.
err = ValidatePayReqExpiry(payReq)
if err != nil {
return nil, err
}
// If the amount was not included in the invoice, then we let
// the payee specify the amount of satoshis they wish to send.
// We override the amount to pay with the amount provided from
// the payment request.
if payReq.MilliSat == nil {
if rpcPayReq.Amt == 0 {
return nil, errors.New("amount must be " +
"specified when paying a zero amount " +
"invoice")
}
payIntent.Amount = lnwire.NewMSatFromSatoshis(
btcutil.Amount(rpcPayReq.Amt),
)
} else {
if rpcPayReq.Amt != 0 {
return nil, errors.New("amount must not be " +
"specified when paying a non-zero " +
" amount invoice")
}
payIntent.Amount = *payReq.MilliSat
}
copy(payIntent.PaymentHash[:], payReq.PaymentHash[:])
destKey := payReq.Destination.SerializeCompressed()
copy(payIntent.Target[:], destKey)
payIntent.FinalCLTVDelta = uint16(payReq.MinFinalCLTVExpiry())
payIntent.RouteHints = payReq.RouteHints
} else {
// Otherwise, If the payment request field was not specified
// (and a custom route wasn't specified), construct the payment
// from the other fields.
// Payment destination.
if len(rpcPayReq.Dest) != 33 {
return nil, errors.New("invalid key length")
}
pubBytes := rpcPayReq.Dest
copy(payIntent.Target[:], pubBytes)
// Final payment CLTV delta.
if rpcPayReq.FinalCltvDelta != 0 {
payIntent.FinalCLTVDelta =
uint16(rpcPayReq.FinalCltvDelta)
} else {
payIntent.FinalCLTVDelta = zpay32.DefaultFinalCLTVDelta
}
// Amount.
if rpcPayReq.Amt == 0 {
return nil, errors.New("amount must be specified")
}
payIntent.Amount = lnwire.NewMSatFromSatoshis(
btcutil.Amount(rpcPayReq.Amt),
)
// Payment hash.
copy(payIntent.PaymentHash[:], rpcPayReq.PaymentHash)
}
// Currently, within the bootstrap phase of the network, we limit the
// largest payment size allotted to (2^32) - 1 mSAT or 4.29 million
// satoshis.
if payIntent.Amount > r.MaxPaymentMSat {
// In this case, we'll send an error to the caller, but
// continue our loop for the next payment.
return payIntent, fmt.Errorf("payment of %v is too large, "+
"max payment allowed is %v", payIntent.Amount,
r.MaxPaymentMSat)
}
return payIntent, nil
}
// ValidatePayReqExpiry checks if the passed payment request has expired. In
// the case it has expired, an error will be returned.
func ValidatePayReqExpiry(payReq *zpay32.Invoice) error {
expiry := payReq.Expiry()
validUntil := payReq.Timestamp.Add(expiry)
if time.Now().After(validUntil) {
return fmt.Errorf("invoice expired. Valid until %v", validUntil)
}
return nil
}

View File

@ -9,7 +9,6 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"time"
"github.com/lightningnetwork/lnd/htlcswitch" "github.com/lightningnetwork/lnd/htlcswitch"
"github.com/lightningnetwork/lnd/lntypes" "github.com/lightningnetwork/lnd/lntypes"
@ -19,7 +18,6 @@ import (
"github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/routing" "github.com/lightningnetwork/lnd/routing"
"github.com/lightningnetwork/lnd/routing/route" "github.com/lightningnetwork/lnd/routing/route"
"github.com/lightningnetwork/lnd/zpay32"
"google.golang.org/grpc" "google.golang.org/grpc"
"gopkg.in/macaroon-bakery.v2/bakery" "gopkg.in/macaroon-bakery.v2/bakery"
) )
@ -190,56 +188,18 @@ func (s *Server) RegisterWithRootServer(grpcServer *grpc.Server) error {
func (s *Server) SendPayment(ctx context.Context, func (s *Server) SendPayment(ctx context.Context,
req *PaymentRequest) (*PaymentResponse, error) { req *PaymentRequest) (*PaymentResponse, error) {
switch { payment, err := s.cfg.RouterBackend.extractIntentFromSendRequest(req)
// If the payment request isn't populated, then we won't be able to
// even attempt a payment.
case req.PayReq == "":
return nil, fmt.Errorf("a valid payment request MUST be specified")
}
// Now that we know the payment request is present, we'll attempt to
// decode it in order to parse out all the parameters for the route.
payReq, err := zpay32.Decode(req.PayReq, s.cfg.ActiveNetParams)
if err != nil { if err != nil {
return nil, err return nil, err
} }
// Atm, this service does not support invoices that don't have their preImage, _, err := s.cfg.Router.SendPayment(payment)
// value fully specified.
if payReq.MilliSat == nil {
return nil, fmt.Errorf("zero value invoices are not supported")
}
var destination route.Vertex
copy(destination[:], payReq.Destination.SerializeCompressed())
// Now that all the information we need has been parsed, we'll map this
// proto request into a proper request that our backing router can
// understand.
finalDelta := uint16(payReq.MinFinalCLTVExpiry())
payment := routing.LightningPayment{
Target: destination,
Amount: *payReq.MilliSat,
FeeLimit: lnwire.MilliSatoshi(req.FeeLimitSat),
PaymentHash: *payReq.PaymentHash,
FinalCLTVDelta: finalDelta,
PayAttemptTimeout: time.Second * time.Duration(req.TimeoutSeconds),
RouteHints: payReq.RouteHints,
}
// Pin to an outgoing channel if specified.
if req.OutgoingChannelId != 0 {
chanID := uint64(req.OutgoingChannelId)
payment.OutgoingChannelID = &chanID
}
preImage, _, err := s.cfg.Router.SendPayment(&payment)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return &PaymentResponse{ return &PaymentResponse{
PayHash: (*payReq.PaymentHash)[:], PayHash: payment.PaymentHash[:],
PreImage: preImage[:], PreImage: preImage[:],
}, nil }, nil
} }

View File

@ -476,6 +476,7 @@ func newRPCServer(s *server, macService *macaroons.Service,
}, },
FindRoute: s.chanRouter.FindRoute, FindRoute: s.chanRouter.FindRoute,
MissionControl: s.missionControl, MissionControl: s.missionControl,
ActiveNetParams: activeNetParams.Params,
} }
var ( var (
@ -2736,18 +2737,6 @@ func (r *rpcServer) SubscribeChannelEvents(req *lnrpc.ChannelEventSubscription,
} }
} }
// validatePayReqExpiry checks if the passed payment request has expired. In
// the case it has expired, an error will be returned.
func validatePayReqExpiry(payReq *zpay32.Invoice) error {
expiry := payReq.Expiry()
validUntil := payReq.Timestamp.Add(expiry)
if time.Now().After(validUntil) {
return fmt.Errorf("invoice expired. Valid until %v", validUntil)
}
return nil
}
// paymentStream enables different types of payment streams, such as: // paymentStream enables different types of payment streams, such as:
// lnrpc.Lightning_SendPaymentServer and lnrpc.Lightning_SendToRouteServer to // lnrpc.Lightning_SendPaymentServer and lnrpc.Lightning_SendToRouteServer to
// execute sendPayment. We use this struct as a sort of bridge to enable code // execute sendPayment. We use this struct as a sort of bridge to enable code
@ -2930,7 +2919,7 @@ func extractPaymentIntent(rpcPayReq *rpcPaymentRequest) (rpcPaymentIntent, error
} }
// Next, we'll ensure that this payreq hasn't already expired. // Next, we'll ensure that this payreq hasn't already expired.
err = validatePayReqExpiry(payReq) err = routerrpc.ValidatePayReqExpiry(payReq)
if err != nil { if err != nil {
return payIntent, err return payIntent, err
} }

View File

@ -191,9 +191,6 @@ func (s *subRPCServerConfigs) PopulateDependencies(cc *chainControl,
subCfgValue.FieldByName("NetworkDir").Set( subCfgValue.FieldByName("NetworkDir").Set(
reflect.ValueOf(networkDir), reflect.ValueOf(networkDir),
) )
subCfgValue.FieldByName("ActiveNetParams").Set(
reflect.ValueOf(activeNetParams),
)
subCfgValue.FieldByName("MacService").Set( subCfgValue.FieldByName("MacService").Set(
reflect.ValueOf(macService), reflect.ValueOf(macService),
) )