Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpc: allow wumbo invoices #4075

Merged
merged 1 commit into from
Apr 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions lnrpc/invoicesrpc/addinvoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ type AddInvoiceConfig struct {
// that's backed by the identity private key of the running lnd node.
NodeSigner *netann.NodeSigner

// MaxPaymentMSat is the maximum allowed payment.
MaxPaymentMSat lnwire.MilliSatoshi

// DefaultCLTVExpiry is the default invoice expiry if no values is
// specified.
DefaultCLTVExpiry uint32
Expand Down Expand Up @@ -167,15 +164,6 @@ func AddInvoice(ctx context.Context, cfg *AddInvoiceConfig,

amtMSat := invoice.Value

// The value of the invoice must also not exceed the current soft-limit
// on the largest payment within the network.
if amtMSat > cfg.MaxPaymentMSat {
return nil, nil, fmt.Errorf("payment of %v is too large, max "+
"payment allowed is %v", invoice.Value,
cfg.MaxPaymentMSat.ToSatoshis(),
)
}

// We also create an encoded payment request which allows the
// caller to compactly send the invoice to the payer. We'll create a
// list of options to be added to the encoded payment request. For now
Expand Down
3 changes: 0 additions & 3 deletions lnrpc/invoicesrpc/config_active.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ type Config struct {
// that's backed by the identity private key of the running lnd node.
NodeSigner *netann.NodeSigner

// MaxPaymentMSat is the maximum allowed payment.
MaxPaymentMSat lnwire.MilliSatoshi

// DefaultCLTVExpiry is the default invoice expiry if no values is
// specified.
DefaultCLTVExpiry uint32
Expand Down
1 change: 0 additions & 1 deletion lnrpc/invoicesrpc/invoices_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ func (s *Server) AddHoldInvoice(ctx context.Context,
IsChannelActive: s.cfg.IsChannelActive,
ChainParams: s.cfg.ChainParams,
NodeSigner: s.cfg.NodeSigner,
MaxPaymentMSat: s.cfg.MaxPaymentMSat,
DefaultCLTVExpiry: s.cfg.DefaultCLTVExpiry,
ChanDB: s.cfg.ChanDB,
GenInvoiceFeatures: s.cfg.GenInvoiceFeatures,
Expand Down
12 changes: 0 additions & 12 deletions lnrpc/routerrpc/router_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -698,18 +698,6 @@ func (r *RouterBackend) extractIntentFromSendRequest(
payIntent.DestFeatures = features
}

// 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)

}

// Check for disallowed payments to self.
if !rpcPayReq.AllowSelfPayment && payIntent.Target == r.SelfNode {
return nil, errors.New("self-payments not allowed")
Expand Down
1 change: 0 additions & 1 deletion rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -4305,7 +4305,6 @@ func (r *rpcServer) AddInvoice(ctx context.Context,
IsChannelActive: r.server.htlcSwitch.HasActiveLink,
ChainParams: activeNetParams.Params,
NodeSigner: r.server.nodeSigner,
MaxPaymentMSat: MaxPaymentMSat,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the MaxPaymentMSat constant shouldn't be in use anymore, can it be removed?

another alternative would be to simply change this constant to rule out non-sensical values, e.g. >21M BTC

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still use it at times to ensure that routes submitted don't have hops which attempt to send more than that value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would we allow a simple payinvoice to send out an htlc of any size, and restrict what gets offered via SendToRoute?

Copy link
Member Author

@Roasbeef Roasbeef Apr 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming payInvoice does payment splitting then it would/should adhere to the max split size of 4.2 mil satoshis. On the other hand, nodes should/will reject an HTLC above that size, so all routes need to always be below that value.

DefaultCLTVExpiry: defaultDelta,
ChanDB: r.server.chanDB,
GenInvoiceFeatures: func() *lnwire.FeatureVector {
Expand Down
3 changes: 0 additions & 3 deletions subrpcserver_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,6 @@ func (s *subRPCServerConfigs) PopulateDependencies(cc *chainControl,
subCfgValue.FieldByName("NodeSigner").Set(
reflect.ValueOf(nodeSigner),
)
subCfgValue.FieldByName("MaxPaymentMSat").Set(
reflect.ValueOf(MaxPaymentMSat),
)
defaultDelta := cfg.Bitcoin.TimeLockDelta
if registeredChains.PrimaryChain() == litecoinChain {
defaultDelta = cfg.Litecoin.TimeLockDelta
Expand Down