lnd icon indicating copy to clipboard operation
lnd copied to clipboard

walletrpc: add raw_tx field to BumpFee response

Open federicociro opened this issue 3 months ago • 5 comments

Change Description

This PR adds an optional include_raw_tx field to BumpFeeRequest and a corresponding raw_tx field to BumpFeeResponse. When include_raw_tx is set to true, the RPC will wait for the sweep transaction to be created and return its hex-encoded raw transaction in the response.

This addresses issue #8470, allowing users to manually broadcast transactions in cases where they don't propagate automatically through the network.

Changes Made:

  • Add include_raw_tx bool field to BumpFeeRequest proto (lnrpc/walletrpc/walletkit.proto:3145)
  • Add raw_tx string field to BumpFeeResponse proto (lnrpc/walletrpc/walletkit.proto:3255)
  • Modify BumpFee implementation to optionally wait for sweep result (lnrpc/walletrpc/walletkit_server.go:1157)
  • Update sweepNewInput to return result channel for transaction tracking (lnrpc/walletrpc/walletkit_server.go:1292)
  • Add --include_raw_tx flag to lncli wallet bumpfee command (cmd/commands/walletrpc_active.go:319)
  • Regenerate protobuf definitions and gRPC stubs

Closes #8470

Steps to Test

Prerequisites:

  • Build debug binaries: make build
  • Have a pending sweep transaction (can be created via anchor channel closing or CPFP bumping)

Testing the new functionality:

  1. Test with include_raw_tx flag:

    ./lncli-debug wallet bumpfee --outpoint <txid>:<index> \
      --sat_per_vbyte 10 \
      --include_raw_tx
    Verify that the response includes the raw_tx field with hex-encoded transaction data.
    
    
  2. Test without include_raw_tx flag (backward compatibility): ./lncli-debug wallet bumpfee --outpoint :
    --sat_per_vbyte 10

  3. Verify that the response returns immediately with status only (no raw_tx field).

  4. Test via gRPC: Use the gRPC API directly with include_raw_tx: true and verify the response contains the raw transaction.

  5. Verify transaction broadcast: Use the returned raw transaction hex to manually broadcast via: bitcoin-cli sendrawtransaction <raw_tx_hex>

Expected behavior:

  • When include_raw_tx=false (or omitted): Response returns immediately with status
  • When include_raw_tx=true: Response waits for sweep tx creation and includes raw transaction hex
  • Backward compatibility: Existing calls without the flag continue to work as before

Pull Request Checklist

Testing

  • [x] Your PR passes all CI checks.
  • [x] Tests covering the positive and negative (error paths) are included.
  • [x] Bug fixes contain tests triggering the bug to prevent regressions.

Code Style and Documentation

📝 Please see our Contribution Guidelines for further guidance.

federicociro avatar Oct 25 '25 17:10 federicociro

Summary of Changes

Hello @federicociro, I'm Gemini Code Assist[^1]! 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 introduces a significant enhancement to the BumpFee RPC functionality, allowing for greater control over transaction broadcasting. By adding an optional parameter to request the raw, hex-encoded sweep transaction, it provides a crucial fallback mechanism for users encountering network propagation issues. This change directly addresses a known problem by empowering users to manually broadcast their fee-bumped transactions, ensuring their timely inclusion on the blockchain.

Highlights

  • RPC Enhancement: The BumpFee RPC now supports an optional include_raw_tx field in its request and returns a raw_tx field in its response.
  • Manual Broadcast Support: Users can now retrieve the hex-encoded raw sweep transaction, enabling manual broadcasting in cases where transactions do not propagate automatically through the network.
  • CLI Integration: The lncli wallet bumpfee command has been updated with a new --include_raw_tx flag to expose this functionality to command-line users.
  • Protobuf Updates: The walletkit.proto definition and its generated Go files (walletkit.pb.go, walletkit.swagger.json) have been updated to include the new include_raw_tx and raw_tx fields.
  • Sweeper Logic Refinement: The internal BumpFee and sweepNewInput functions were modified to handle the optional raw transaction retrieval, including waiting for the sweep result before returning the response.
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 :thumbsup: and :thumbsdown: 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.

[^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.

gemini-code-assist[bot] avatar Oct 25 '25 17:10 gemini-code-assist[bot]

Hi @yyforyongyu! I've added the timeout fix commit to address the flaky tests. Could you approve the workflow run when you have a chance? Thanks!

federicociro avatar Oct 27 '25 15:10 federicociro

Gentle ping @yyforyongyu when you have time 🙂

federicociro avatar Nov 03 '25 21:11 federicociro

Hi Yong @yyforyongyu, could you please review it?

federicociro avatar Nov 18 '25 21:11 federicociro

@federicociro, remember to re-request review from reviewers when ready

lightninglabs-deploy avatar Dec 10 '25 15:12 lightninglabs-deploy