Skip to content
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

Merged
merged 3 commits into from
Feb 17, 2025
Merged

Conversation

starius
Copy link
Contributor

@starius starius commented Feb 11, 2025

Use new fields instead of deprecated

'force' -> 'immediate'
'sat_per_byte' -> 'sat_per_vbyte'

New options added: 'immediate', 'target_conf', 'budget'.

Pull Request Checklist

  • PR is opened against correct version branch.
  • Version compatibility matrix in the README and minimal required version
    in lnd_services.go are updated.
  • Update macaroon_recipes.go if your PR adds a new method that is called
    differently than the RPC method it invokes.

@starius starius marked this pull request as ready for review February 11, 2025 15:13
Copy link

@ziggie1984 ziggie1984 left a 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.

Comment on lines 752 to 759
// 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.

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:

lightningnetwork/lnd#9470

Copy link
Contributor Author

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.


// We unset sat_per_vbyte, because if it is specified, it is
// used instead of target_conf.
r.SatPerVbyte = 0

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.

Copy link
Contributor Author

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).

Comment on lines +766 to +771
// 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.

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 ?

Copy link
Contributor Author

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.

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.

Copy link
Contributor Author

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?

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.

https://github.com/lightningnetwork/lnd/blob/68105be1ebbd8cae18c74f112d85382702477d80/lnrpc/walletrpc/walletkit_server.go#L1022-L1023

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.

Copy link
Contributor Author

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'
@starius starius force-pushed the bump-fee branch 2 times, most recently from cc6a0fa to db58130 Compare February 15, 2025 14:58
@starius
Copy link
Contributor Author

starius commented Feb 15, 2025

I'll test the options manually to make sure the checks actually work.

@starius
Copy link
Contributor Author

starius commented Feb 16, 2025

Tested. Works as expected!

@starius starius requested a review from ziggie1984 February 16, 2025 03:08
Copy link

@ziggie1984 ziggie1984 left a 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.

},
)
SatPerVbyte: uint64(feeRate.FeePerKVByte() / 1000),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SatPerVbyte: uint64(feeRate.FeePerKVByte() / 1000),
SatPerVbyte: uint64(feeRate.FeePerVByte()),

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied. Thanks!

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.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Thanks!

Copy link
Contributor Author

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

Copy link
Contributor Author

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

Comment on lines +766 to +771
// 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.

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.
Copy link

@ziggie1984 ziggie1984 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@guggero guggero merged commit 3e177ef into lightninglabs:lnd-18-4 Feb 17, 2025
1 check passed
@guggero
Copy link
Member

guggero commented Feb 17, 2025

Pushed a new tag with this: v0.18.4-11

@starius starius deleted the bump-fee branch February 17, 2025 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants