-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bumpfee: add more flags as options #206
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make LND release 18.5 min requirement.
walletkit_client.go
Outdated
// WithTargetConf is an option for setting the target_conf of BumpFee. If set, | ||
// the underlying fee estimator will use the target_conf to estimate the | ||
// starting fee rate for the fee function. The value of feeRate passed to | ||
// BumpFee will be ignored. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conf-target only reflects this behaviour for the 18.5 release, before the conf target had a different meaning:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a check that LND is at least 0.18.5 only if WithTargetConf is used. This commit can be undone after minimalCompatibleVersion is bumbed to 0.18.5.
walletkit_client.go
Outdated
|
||
// We unset sat_per_vbyte, because if it is specified, it is | ||
// used instead of target_conf. | ||
r.SatPerVbyte = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that should not be done here, but its already done in LND that it's not allowed to set both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this code and added a check that if WithTargetConf is used, feeRate is 0. If both are specified, it is not clear, what the user wants and it is better to fail than to risk doing a wrong thing (e.g. overpay).
// WithBudget is an option for setting the budget of BumpFee. It is the max | ||
// amount in sats that can be used as the fees. Setting this value greater than | ||
// the input's value may result in CPFP - one or more wallet utxos will be used | ||
// to pay the fees specified by the budget. If not set, for new inputs, by | ||
// default 50% of the input's value will be treated as the budget for fee | ||
// bumping; for existing inputs, their current budgets will be retained. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe just let the descripiton of the RPC speak for itself and do not require these extensive comments ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copy-pasted this from https://lightning.engineering/api-docs/api/lnd/wallet-kit/bump-fee/
All parts of this description seem to be important since they define the behavior. IMHO better to keep this in the documentation as well so it is easier to access this information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also specify that since 18.5 if the budget is set, the deadline has to be set too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently there is no way to set the deadline. The field is missing in lnrpc of 0.18.4.
What happens if budget is provided without the deadline in a request against LND 0.18.5?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was a bit confused, if you select the deadline you need to specify the budget, not the other way around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it would be cool if you'd open a PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this version there is no deadline setting, since it is not supported by 0.18.4 anyway.
We can add the comment when we add the deadline setting (for lndclient 0.18.5+).
'force' -> 'immediate' 'sat_per_byte' -> 'sat_per_vbyte'
cc6a0fa
to
db58130
Compare
I'll test the options manually to make sure the checks actually work. |
Tested. Works as expected! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending new comments.
walletkit_client.go
Outdated
}, | ||
) | ||
SatPerVbyte: uint64(feeRate.FeePerKVByte() / 1000), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SatPerVbyte: uint64(feeRate.FeePerKVByte() / 1000), | |
SatPerVbyte: uint64(feeRate.FeePerVByte()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applied. Thanks!
walletkit_client.go
Outdated
type BumpFeeOption func(*walletrpc.BumpFeeRequest) | ||
|
||
// WithImmediate is an option for enabling the immediate mode of BumpFee. The | ||
// sweeper will sweep this input without waiting for the next batch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... without waiting for the next block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to fix the description of the field Immediate
as well?
https://pkg.go.dev/github.com/lightningnetwork/[email protected]/lnrpc/walletrpc#BumpFeeRequest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened a PR here to fix the description: lightningnetwork/lnd#9518
// WithBudget is an option for setting the budget of BumpFee. It is the max | ||
// amount in sats that can be used as the fees. Setting this value greater than | ||
// the input's value may result in CPFP - one or more wallet utxos will be used | ||
// to pay the fees specified by the budget. If not set, for new inputs, by | ||
// default 50% of the input's value will be treated as the budget for fee | ||
// bumping; for existing inputs, their current budgets will be retained. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also specify that since 18.5 if the budget is set, the deadline has to be set too.
New options added: 'immediate', 'target_conf', 'budget'.
The conf-target only reflects this behaviour for the 0.18.5 release, before the conf target had a different meaning: lightningnetwork/lnd#9470 This commit can be undone after minimalCompatibleVersion is bumbed to 0.18.5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Pushed a new tag with this: |
Use new fields instead of deprecated
'force' -> 'immediate'
'sat_per_byte' -> 'sat_per_vbyte'
New options added: 'immediate', 'target_conf', 'budget'.
Pull Request Checklist
in
lnd_services.go
are updated.macaroon_recipes.go
if your PR adds a new method that is calleddifferently than the RPC method it invokes.