Skip to content

Conversation

hieblmi
Copy link
Collaborator

@hieblmi hieblmi commented Oct 15, 2025

EstimateFee now takes optional inputs to give a fee estimate. If --show_outpoints is provided the auto-selected inputs are returned.

Examples:

reg_zane estimatefee '{"bcrt1q7dnuwzl87hunndngmgzs9s8t279jjkrdgkjp4t" : 500600001}' --conf_target 1 --utxo ca1c4fc61331b35adc8032e8b61461986f40c7f97c1e83c27a181defe5a08ee4:1 --utxo d9665f3fe1190098b2bc0836e25e7a1019e2532b2cca4b5acfb974de5d01b90c:0 --utxo 734d2c21da9e95b412bef63c036b7d72f8c365abab05cc1e5973b292a5d976a2:0 --utxo f766ae254d150cd2556efa096503fba86b29674e606b44a8bbf44b504bdd31d0:1
{
    "fee_sat": "8950",
    "feerate_sat_per_byte": "25",
    "sat_per_vbyte": "25"
}
reg_zane estimatefee '{"bcrt1q7dnuwzl87hunndngmgzs9s8t279jjkrdgkjp4t" : 300001}' --conf_target 2 --show_outpoints
{
    "fee_sat": "3825",
    "feerate_sat_per_byte": "25",
    "sat_per_vbyte": "25",
    "outpoints": [
        "ca1c4fc61331b35adc8032e8b61461986f40c7f97c1e83c27a181defe5a08ee4:1"
    ]
}

@hieblmi hieblmi marked this pull request as draft October 15, 2025 14:05
Copy link

Summary of Changes

Hello @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 estimatefee RPC by introducing the ability for users to explicitly define which unspent transaction outputs (UTXOs) should be considered when estimating transaction fees. Additionally, it provides an option to return the exact outpoints used in the estimation, enhancing transparency and control for users who need precise fee calculations based on specific inputs.

Highlights

  • Enhanced estimatefee command: The estimatefee command now supports specifying custom UTXOs for fee estimation using a new --utxo flag.
  • Outpoint visibility: A new --show_outpoints flag has been introduced, allowing users to view the specific outpoints (UTXOs) that were used in the fee estimation process.
  • API and Protocol Updates: The EstimateFeeRequest and EstimateFeeResponse protobuf messages have been extended to accommodate the new outpoints input and show_outpoints output.
  • RPC Server Logic: The RPC server's EstimateFee handler has been updated to parse and validate user-provided outpoints, pass them to the wallet's transaction creation logic, and return the selected outpoints in the response when requested.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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.

Comment on lines +1272 to +1275
if err != nil {
return nil, fmt.Errorf("can't create outpoints "+
"%w", err)
}

Choose a reason for hiding this comment

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

medium

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

  1. Minimize lines for log and error messages, while adhering to the 80-character limit.

Comment on lines +1277 to +1280
if fn.HasDuplicates(wireOutpoints) {
return nil, fmt.Errorf("selected outpoints contain " +
"duplicate values")
}

Choose a reason for hiding this comment

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

medium

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

  1. Minimize lines for log and error messages, while adhering to the 80-character limit.

@saubyk saubyk added this to the v0.21.0 milestone Oct 15, 2025
@saubyk saubyk added this to v0.21 Oct 15, 2025
@saubyk saubyk moved this to In progress in v0.21 Oct 15, 2025
repeated OutPoint outpoints = 6;

// Whether to include the selected outpoints in the response.
bool show_outpoints = 7;
Copy link
Collaborator

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?

Copy link
Collaborator Author

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;
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants