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.
//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
//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"`
//
//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.
//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
//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"`
//
//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.
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
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;
@ -2574,7 +2575,8 @@ message QueryRoutesRequest {
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
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;

View file

@ -6238,7 +6238,7 @@
},
"fee_limit": {
"$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": {
"type": "string",

View file

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