Merge pull request #4335 from joostjager/queryroutes-limit
rpcserver+routerrpc: remove payment limit
This commit is contained in:
commit
6b3c2c1ac5
@ -756,7 +756,6 @@ func ValidateConfig(cfg Config, usageMessage string) (*Config, error) {
|
|||||||
// primary chain.
|
// primary chain.
|
||||||
cfg.registeredChains.RegisterPrimaryChain(litecoinChain)
|
cfg.registeredChains.RegisterPrimaryChain(litecoinChain)
|
||||||
MaxFundingAmount = maxLtcFundingAmount
|
MaxFundingAmount = maxLtcFundingAmount
|
||||||
MaxPaymentMSat = maxLtcPaymentMSat
|
|
||||||
|
|
||||||
case cfg.Bitcoin.Active:
|
case cfg.Bitcoin.Active:
|
||||||
// Multiple networks can't be selected simultaneously. Count
|
// Multiple networks can't be selected simultaneously. Count
|
||||||
|
@ -27,9 +27,6 @@ import (
|
|||||||
// RouterBackend contains the backend implementation of the router rpc sub
|
// RouterBackend contains the backend implementation of the router rpc sub
|
||||||
// server calls.
|
// server calls.
|
||||||
type RouterBackend struct {
|
type RouterBackend struct {
|
||||||
// MaxPaymentMSat is the largest payment permitted by the backend.
|
|
||||||
MaxPaymentMSat lnwire.MilliSatoshi
|
|
||||||
|
|
||||||
// SelfNode is the vertex of the node sending the payment.
|
// SelfNode is the vertex of the node sending the payment.
|
||||||
SelfNode route.Vertex
|
SelfNode route.Vertex
|
||||||
|
|
||||||
@ -143,10 +140,6 @@ func (r *RouterBackend) QueryRoutes(ctx context.Context,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if amt > r.MaxPaymentMSat {
|
|
||||||
return nil, fmt.Errorf("payment of %v is too large, max payment "+
|
|
||||||
"allowed is %v", amt, r.MaxPaymentMSat.ToSatoshis())
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unmarshall restrictions from request.
|
// Unmarshall restrictions from request.
|
||||||
feeLimit := lnrpc.CalculateFeeLimit(in.FeeLimit, amt)
|
feeLimit := lnrpc.CalculateFeeLimit(in.FeeLimit, amt)
|
||||||
@ -489,13 +482,6 @@ func (r *RouterBackend) UnmarshallRoute(rpcroute *lnrpc.Route) (
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if routeHop.AmtToForward > r.MaxPaymentMSat {
|
|
||||||
return nil, fmt.Errorf("payment of %v is too large, "+
|
|
||||||
"max payment allowed is %v",
|
|
||||||
routeHop.AmtToForward,
|
|
||||||
r.MaxPaymentMSat.ToSatoshis())
|
|
||||||
}
|
|
||||||
|
|
||||||
hops[i] = routeHop
|
hops[i] = routeHop
|
||||||
|
|
||||||
prevNodePubKey = routeHop.PubKeyBytes
|
prevNodePubKey = routeHop.PubKeyBytes
|
||||||
|
@ -186,9 +186,8 @@ func testQueryRoutes(t *testing.T, useMissionControl bool, useMsat bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
backend := &RouterBackend{
|
backend := &RouterBackend{
|
||||||
MaxPaymentMSat: lnwire.NewMSatFromSatoshis(1000000),
|
FindRoute: findRoute,
|
||||||
FindRoute: findRoute,
|
SelfNode: route.Vertex{1, 2, 3},
|
||||||
SelfNode: route.Vertex{1, 2, 3},
|
|
||||||
FetchChannelCapacity: func(chanID uint64) (
|
FetchChannelCapacity: func(chanID uint64) (
|
||||||
btcutil.Amount, error) {
|
btcutil.Amount, error) {
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ package itest
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"math"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -260,7 +261,7 @@ out:
|
|||||||
// We'll send in chunks of the max payment amount. If we're
|
// We'll send in chunks of the max payment amount. If we're
|
||||||
// about to send too much, then we'll only send the amount
|
// about to send too much, then we'll only send the amount
|
||||||
// remaining.
|
// remaining.
|
||||||
toSend := int64(lnd.MaxPaymentMSat.ToSatoshis())
|
toSend := int64(math.MaxUint32)
|
||||||
if toSend+amtSent > amtToSend {
|
if toSend+amtSent > amtToSend {
|
||||||
toSend = amtToSend - amtSent
|
toSend = amtToSend - amtSent
|
||||||
}
|
}
|
||||||
|
31
rpcserver.go
31
rpcserver.go
@ -70,23 +70,7 @@ import (
|
|||||||
"gopkg.in/macaroon-bakery.v2/bakery"
|
"gopkg.in/macaroon-bakery.v2/bakery"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
// maxBtcPaymentMSat is the maximum allowed Bitcoin payment currently
|
|
||||||
// permitted as defined in BOLT-0002.
|
|
||||||
maxBtcPaymentMSat = lnwire.MilliSatoshi(math.MaxUint32)
|
|
||||||
|
|
||||||
// maxLtcPaymentMSat is the maximum allowed Litecoin payment currently
|
|
||||||
// permitted.
|
|
||||||
maxLtcPaymentMSat = lnwire.MilliSatoshi(math.MaxUint32) *
|
|
||||||
btcToLtcConversionRate
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// MaxPaymentMSat is the maximum allowed payment currently permitted as
|
|
||||||
// defined in BOLT-002. This value depends on which chain is active.
|
|
||||||
// It is set to the value under the Bitcoin chain as default.
|
|
||||||
MaxPaymentMSat = maxBtcPaymentMSat
|
|
||||||
|
|
||||||
// readPermissions is a slice of all entities that allow read
|
// readPermissions is a slice of all entities that allow read
|
||||||
// permissions for authorization purposes, all lowercase.
|
// permissions for authorization purposes, all lowercase.
|
||||||
readPermissions = []bakery.Op{
|
readPermissions = []bakery.Op{
|
||||||
@ -540,8 +524,7 @@ func newRPCServer(cfg *Config, s *server, macService *macaroons.Service,
|
|||||||
}
|
}
|
||||||
graph := s.chanDB.ChannelGraph()
|
graph := s.chanDB.ChannelGraph()
|
||||||
routerBackend := &routerrpc.RouterBackend{
|
routerBackend := &routerrpc.RouterBackend{
|
||||||
MaxPaymentMSat: MaxPaymentMSat,
|
SelfNode: selfNode.PubKeyBytes,
|
||||||
SelfNode: selfNode.PubKeyBytes,
|
|
||||||
FetchChannelCapacity: func(chanID uint64) (btcutil.Amount,
|
FetchChannelCapacity: func(chanID uint64) (btcutil.Amount,
|
||||||
error) {
|
error) {
|
||||||
|
|
||||||
@ -3987,18 +3970,6 @@ func (r *rpcServer) extractPaymentIntent(rpcPayReq *rpcPaymentRequest) (rpcPayme
|
|||||||
return payIntent, err
|
return payIntent, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.msat > 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.msat,
|
|
||||||
MaxPaymentMSat)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return payIntent, nil
|
return payIntent, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user