walletrpc: add raw_tx field to BumpFee response
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_txbool field toBumpFeeRequestproto (lnrpc/walletrpc/walletkit.proto:3145) - Add
raw_txstring field toBumpFeeResponseproto (lnrpc/walletrpc/walletkit.proto:3255) - Modify
BumpFeeimplementation to optionally wait for sweep result (lnrpc/walletrpc/walletkit_server.go:1157) - Update
sweepNewInputto return result channel for transaction tracking (lnrpc/walletrpc/walletkit_server.go:1292) - Add
--include_raw_txflag tolncli wallet bumpfeecommand (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:
-
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. -
Test without include_raw_tx flag (backward compatibility): ./lncli-debug wallet bumpfee --outpoint
:
--sat_per_vbyte 10 -
Verify that the response returns immediately with status only (no raw_tx field).
-
Test via gRPC: Use the gRPC API directly with include_raw_tx: true and verify the response contains the raw transaction.
-
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
- [x] The change is not insubstantial. Typo fixes are not accepted to fight bot spam.
- [x] The change obeys the Code Documentation and Commenting guidelines, and lines wrap at 80.
- [x] Commits follow the Ideal Git Commit Structure.
- [x] Any new logging statements use an appropriate subsystem and logging level.
- [x] Any new lncli commands have appropriate tags in the comments for the rpc in the proto file.
- [x] There is a change description in the release notes, or
[skip ci]in the commit message for small changes.
📝 Please see our Contribution Guidelines for further guidance.
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
BumpFeeRPC now supports an optionalinclude_raw_txfield in its request and returns araw_txfield 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 bumpfeecommand has been updated with a new--include_raw_txflag to expose this functionality to command-line users. -
Protobuf Updates: The
walletkit.protodefinition and its generated Go files (walletkit.pb.go,walletkit.swagger.json) have been updated to include the newinclude_raw_txandraw_txfields. -
Sweeper Logic Refinement: The internal
BumpFeeandsweepNewInputfunctions 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.
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!
Gentle ping @yyforyongyu when you have time 🙂
Hi Yong @yyforyongyu, could you please review it?
@federicociro, remember to re-request review from reviewers when ready