-
Notifications
You must be signed in to change notification settings - Fork 2.2k
estimatefee: tx fee estimate for selected inputs #10296
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
base: master
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @hieblmi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request enhances the estimatefee
command by allowing users to specify UTXOs for fee estimation and to view the selected outpoints. The implementation is solid, with appropriate changes to the RPC interface, command-line flags, and server-side logic, including validation for duplicate UTXOs. My feedback includes a couple of minor suggestions to improve error messages for better clarity and to align with the repository's style guide.
if err != nil { | ||
return nil, fmt.Errorf("can't create outpoints "+ | ||
"%w", err) | ||
} |
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 error message "can't create outpoints" is a bit vague. A more descriptive message would be helpful for debugging, indicating that the failure occurred during the conversion of outpoints. Also, the style guide suggests minimizing lines for error messages.1
if err != nil {
return nil, fmt.Errorf("failed to convert rpc outpoints to wire outpoints: %w", err)
}
Style Guide References
Footnotes
-
Minimize lines for log and error messages, while adhering to the 80-character limit. ↩
if fn.HasDuplicates(wireOutpoints) { | ||
return nil, fmt.Errorf("selected outpoints contain " + | ||
"duplicate values") | ||
} |
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.
This error message can be simplified to a single line to improve readability, which is preferred by the style guide when the line length allows.1
if fn.HasDuplicates(wireOutpoints) {
return nil, fmt.Errorf("selected outpoints contain duplicate values")
}
Style Guide References
Footnotes
-
Minimize lines for log and error messages, while adhering to the 80-character limit. ↩
repeated OutPoint outpoints = 6; | ||
|
||
// Whether to include the selected outpoints in the response. | ||
bool show_outpoints = 7; |
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.
is there a reason to not show them?
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 your review! In case we provide a list of outpoints manually I thought they don't have to be displayed again in the output. Only if we estimate for an amount would it make sense to show them imo.
uint64 sat_per_vbyte = 3; | ||
|
||
// A list of selected outpoints as inputs for the transaction. | ||
repeated string outpoints = 4; |
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.
There is already an Outpoint message defined. that would make it easier to pass it over to the next call right?
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.
that's a good one, I will change that.
EstimateFee
now takes optional inputs to give a fee estimate. If--show_outpoints
is provided the auto-selected inputs are returned.Examples: