-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
lncli: new command wallet estimatefeerate
#8730
lncli: new command wallet estimatefeerate
#8730
Conversation
Important Review skippedAuto reviews are limited to specific labels. Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
34cfecb
to
dbe3c2a
Compare
cmd/lncli/walletrpc_active.go
Outdated
@@ -124,6 +126,45 @@ func getWalletClient(ctx *cli.Context) (walletrpc.WalletKitClient, func()) { | |||
return walletrpc.NewWalletKitClient(conn), cleanUp | |||
} | |||
|
|||
var estimateOnchainFeeCommand = cli.Command{ | |||
Name: "estimatefee", |
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.
Since this will return a fee rate (not an absolute fee), I think we should rename the command to estimatefeerate
(which will also help to differentiate it from the existing top-level estimatefee
command.
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.
tACK! Looking good - a couple of nits & also think the estimatefeerate
name would still work better
dbe3c2a
to
95dd44d
Compare
@ellemouton @guggero: Thanks for the fast review. I have added all your comments to the code. |
@feelancer21 - I dont think all the comments were addressed (referring to the s/feerate/fee rate comments) |
wallet estimatefee
wallet estimatefeerate
95dd44d
to
c3792dc
Compare
Sorry, my brain read "s/fee/feerate/" and skipped it. Is added now. |
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.
looking good - last comment is about instead moving this out of the wallet
commands and to instead add it to the On-chain command sent since this isnt wallet related
EDIT: let me check with @guggero first to see if he agrees though
EDIT: never mind - i see it depends on wallet rpc
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!
Great. Yes, the dependency to walletrpc was the reason to make it a subcommand for |
@feelancer21, remember to re-request review from reviewers when ready |
c3792dc
to
5ffb5a0
Compare
rebased for 0.18.1 |
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.
Thanks for rebasing. Almost there, one nit and one suggestion.
cmd/lncli/walletrpc_active.go
Outdated
} | ||
|
||
resp, err := client.EstimateFee(ctxc, &walletrpc.EstimateFeeRequest{ | ||
ConfTarget: int32(confTarget)}) |
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.
nit: closing bracket and parenthesis need to be on new line.
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.
Wondering if there is a setting in vscode that the go fromatter can do it for me?
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.
Unfortunately, the tooling support here isn't great. I wish something like prettier
existed for Golang.
cmd/lncli/walletrpc_active.go
Outdated
return err | ||
} | ||
|
||
printJSON(resp) |
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.
We could also offer this as sat_per_vbyte
for the user's convenience.
So something like this (untested):
rateKW := chainfee.SatPerKWeight(resp.SatPerKw)
rateVB := rateKW.FeePerVByte()
printJSON(struct {
SatPerKw int64 `json:"sat_per_kw"`
SatPerVByte int64 `json:"sat_per_vbyte"`
}{
SatPerKw: int64(rateKW),
SatPerVByte: int64(rateVB),
})
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.
Thanks for the suggestion. I had the same idea at some point, but didn't follow it up. I took the snippet and tested it once.
5ffb5a0
to
4d6e01a
Compare
@feelancer21 - could you rebase onto latest master pls? |
`lncli wallet estimatefeerate` returns the fee rate estimate for on-chain transactions in sat/kw and sat/vb to achieve a given confirmation target.
4d6e01a
to
fc90bc9
Compare
@ellemouton done |
lncli wallet estimatefee
returns the fee estimation of the onchain backend to achieve a given confirmation target.fixes #8726