Add constant and percentage-based fee limits to payments

- Extend SendRequest and QueryRoutesRequest protos
- newRoute function takes fee limit and cuts off routes that exceed it
- queryRoutes, payInvoice and sendPayment commands take the feeLimit inputs and pass them down to newRoute
- When no feeLimit is included, don't enforce any feeLimits at all (by setting feeLimit to maxValue)
This commit is contained in:
Sebastian Delgado authored and Wilmer Paulino committed 2018-06-12 18:14:43 -07:00
1 parent 80b531db62
commit 6746609ec6
10 files changed
+537 -402

No files matched your search

+1
View File
@@ -3047,6 +3047,7 @@ func (r *rpcServer) QueryRoutes(ctx context.Context,
// largest payment size allotted to (2^32) - 1 mSAT or 4.29 million
// satoshis.
amt := btcutil.Amount(in.Amt)
feeLimit := btcutil.Amount(in.FeeLimit)
amtMSat := lnwire.NewMSatFromSatoshis(amt)
if amtMSat > maxPaymentMSat {
return nil, fmt.Errorf("payment of %v is too large, max payment "+