rpcserver+routerrpc: remove payment limit

This commit is contained in:
Joost Jager 2020-05-28 19:28:34 +02:00
parent 24c865450a
commit df7a05da84
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7
5 changed files with 5 additions and 49 deletions

View File

@ -756,7 +756,6 @@ func ValidateConfig(cfg Config, usageMessage string) (*Config, error) {
// primary chain.
cfg.registeredChains.RegisterPrimaryChain(litecoinChain)
MaxFundingAmount = maxLtcFundingAmount
MaxPaymentMSat = maxLtcPaymentMSat
case cfg.Bitcoin.Active:
// Multiple networks can't be selected simultaneously. Count

View File

@ -27,9 +27,6 @@ import (
// RouterBackend contains the backend implementation of the router rpc sub
// server calls.
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 route.Vertex
@ -143,10 +140,6 @@ func (r *RouterBackend) QueryRoutes(ctx context.Context,
if err != nil {
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.
feeLimit := lnrpc.CalculateFeeLimit(in.FeeLimit, amt)
@ -489,13 +482,6 @@ func (r *RouterBackend) UnmarshallRoute(rpcroute *lnrpc.Route) (
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
prevNodePubKey = routeHop.PubKeyBytes

View File

@ -186,9 +186,8 @@ func testQueryRoutes(t *testing.T, useMissionControl bool, useMsat bool) {
}
backend := &RouterBackend{
MaxPaymentMSat: lnwire.NewMSatFromSatoshis(1000000),
FindRoute: findRoute,
SelfNode: route.Vertex{1, 2, 3},
FindRoute: findRoute,
SelfNode: route.Vertex{1, 2, 3},
FetchChannelCapacity: func(chanID uint64) (
btcutil.Amount, error) {

View File

@ -4,6 +4,7 @@ package itest
import (
"context"
"math"
"strings"
"time"
@ -260,7 +261,7 @@ out:
// 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
// remaining.
toSend := int64(lnd.MaxPaymentMSat.ToSatoshis())
toSend := int64(math.MaxUint32)
if toSend+amtSent > amtToSend {
toSend = amtToSend - amtSent
}

View File

@ -70,23 +70,7 @@ import (
"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 (
// 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
// permissions for authorization purposes, all lowercase.
readPermissions = []bakery.Op{
@ -540,8 +524,7 @@ func newRPCServer(cfg *Config, s *server, macService *macaroons.Service,
}
graph := s.chanDB.ChannelGraph()
routerBackend := &routerrpc.RouterBackend{
MaxPaymentMSat: MaxPaymentMSat,
SelfNode: selfNode.PubKeyBytes,
SelfNode: selfNode.PubKeyBytes,
FetchChannelCapacity: func(chanID uint64) (btcutil.Amount,
error) {
@ -3987,18 +3970,6 @@ func (r *rpcServer) extractPaymentIntent(rpcPayReq *rpcPaymentRequest) (rpcPayme
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
}