lnrpc: use amount based default routing fee

This commit is contained in:
Oliver Gugger 2022-02-02 14:24:53 +01:00
parent bfa1cf17b9
commit d22f543906
No known key found for this signature in database
GPG key ID: 8E4256593F177720
4 changed files with 12 additions and 9 deletions

View file

@ -1938,7 +1938,8 @@ type SendRequest struct {
//The maximum number of satoshis that will be paid as a fee of the payment. //The maximum number of satoshis that will be paid as a fee of the payment.
//This value can be represented either as a percentage of the amount being //This value can be represented either as a percentage of the amount being
//sent, or as a fixed amount of the maximum fee the user is willing the pay to //sent, or as a fixed amount of the maximum fee the user is willing the pay to
//send the payment. //send the payment. If not specified, lnd will use a default value of 100%
//fees for small amounts (<=50 sat) or 5% fees for larger amounts.
FeeLimit *FeeLimit `protobuf:"bytes,8,opt,name=fee_limit,json=feeLimit,proto3" json:"fee_limit,omitempty"` FeeLimit *FeeLimit `protobuf:"bytes,8,opt,name=fee_limit,json=feeLimit,proto3" json:"fee_limit,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,
@ -8517,7 +8518,8 @@ type QueryRoutesRequest struct {
//The maximum number of satoshis that will be paid as a fee of the payment. //The maximum number of satoshis that will be paid as a fee of the payment.
//This value can be represented either as a percentage of the amount being //This value can be represented either as a percentage of the amount being
//sent, or as a fixed amount of the maximum fee the user is willing the pay to //sent, or as a fixed amount of the maximum fee the user is willing the pay to
//send the payment. //send the payment. If not specified, lnd will use a default value of 100%
//fees for small amounts (<=50 sat) or 5% fees for larger amounts.
FeeLimit *FeeLimit `protobuf:"bytes,5,opt,name=fee_limit,json=feeLimit,proto3" json:"fee_limit,omitempty"` FeeLimit *FeeLimit `protobuf:"bytes,5,opt,name=fee_limit,json=feeLimit,proto3" json:"fee_limit,omitempty"`
// //
//A list of nodes to ignore during path finding. When using REST, these fields //A list of nodes to ignore during path finding. When using REST, these fields

View file

@ -753,7 +753,8 @@ message SendRequest {
The maximum number of satoshis that will be paid as a fee of the payment. The maximum number of satoshis that will be paid as a fee of the payment.
This value can be represented either as a percentage of the amount being This value can be represented either as a percentage of the amount being
sent, or as a fixed amount of the maximum fee the user is willing the pay to sent, or as a fixed amount of the maximum fee the user is willing the pay to
send the payment. send the payment. If not specified, lnd will use a default value of 100%
fees for small amounts (<=50 sat) or 5% fees for larger amounts.
*/ */
FeeLimit fee_limit = 8; FeeLimit fee_limit = 8;
@ -2574,7 +2575,8 @@ message QueryRoutesRequest {
The maximum number of satoshis that will be paid as a fee of the payment. The maximum number of satoshis that will be paid as a fee of the payment.
This value can be represented either as a percentage of the amount being This value can be represented either as a percentage of the amount being
sent, or as a fixed amount of the maximum fee the user is willing the pay to sent, or as a fixed amount of the maximum fee the user is willing the pay to
send the payment. send the payment. If not specified, lnd will use a default value of 100%
fees for small amounts (<=50 sat) or 5% fees for larger amounts.
*/ */
FeeLimit fee_limit = 5; FeeLimit fee_limit = 5;

View file

@ -6238,7 +6238,7 @@
}, },
"fee_limit": { "fee_limit": {
"$ref": "#/definitions/lnrpcFeeLimit", "$ref": "#/definitions/lnrpcFeeLimit",
"description": "The maximum number of satoshis that will be paid as a fee of the payment.\nThis value can be represented either as a percentage of the amount being\nsent, or as a fixed amount of the maximum fee the user is willing the pay to\nsend the payment." "description": "The maximum number of satoshis that will be paid as a fee of the payment.\nThis value can be represented either as a percentage of the amount being\nsent, or as a fixed amount of the maximum fee the user is willing the pay to\nsend the payment. If not specified, lnd will use a default value of 100%\nfees for small amounts (\u003c=50 sat) or 5% fees for larger amounts."
}, },
"outgoing_chan_id": { "outgoing_chan_id": {
"type": "string", "type": "string",

View file

@ -40,10 +40,9 @@ func CalculateFeeLimit(feeLimit *FeeLimit,
return amount * lnwire.MilliSatoshi(feeLimit.GetPercent()) / 100 return amount * lnwire.MilliSatoshi(feeLimit.GetPercent()) / 100
default: default:
// If a fee limit was not specified, we'll use the payment's // Fall back to a sane default value that is based on the amount
// amount as an upper bound in order to avoid payment attempts // itself.
// from incurring fees higher than the payment amount itself. return lnwallet.DefaultRoutingFeeLimitForAmount(amount)
return amount
} }
} }