lnwallet+walletrpc: add WalletKit.SubmitPackage for v3 CPFP package relay#10900
lnwallet+walletrpc: add WalletKit.SubmitPackage for v3 CPFP package relay#10900ellemouton wants to merge 3 commits into
Conversation
|
PR Severity: CRITICAL. Files in lnwallet/* (lnwallet/interface.go, lnwallet/btcwallet/btcwallet.go, lnwallet/mock.go) drive the CRITICAL classification. Also touches lnrpc/* (HIGH) and proto/other files (MEDIUM). 10 non-excluded files, ~250 non-excluded lines - no bump needed. <!-- pr-severity-bot --> |
Summary of ChangesHello, 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 introduces a new SubmitPackage RPC method to the WalletKit service, allowing clients to submit topologically sorted transaction packages to the chain backend. This capability is essential for supporting v3/TRUC package relay, which allows zero-fee parent transactions to be accepted when paired with a fee-paying CPFP child. The changes include updates to the wallet interface, backend implementations, and necessary gRPC/protobuf infrastructure. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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 the 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 counterproductive. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new SubmitPackage RPC endpoint to the WalletKit service, enabling the submission of a package of related transactions for atomic validation and acceptance. This feature is implemented across the wallet controller interface, mock implementations, and the btcwallet backend. The review feedback suggests several important improvements: adding a defensive nil check on the backend's returned result in walletkit_server.go to prevent a potential panic, documenting the stub implementation in no_chain_backend.go to comply with the repository style guide, and marking the max_fee_rate field as optional in the protobuf definition to safely distinguish between an omitted field and an explicit zero limit.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
65de675 to
d290c19
Compare
|
Thanks for the review — addressed all three:
Also fixed up the CI failures: added the missing REST annotation for the new RPC ( |
d290c19 to
630cb0e
Compare
| func testSubmitPackage(ht *lntest.HarnessTest) { | ||
| // submitpackage is a bitcoind RPC: btcd has no equivalent and neutrino | ||
| // has no mempool, so this test only applies to the bitcoind backend. | ||
| if ht.ChainBackendName() != "bitcoind" { |
There was a problem hiding this comment.
could we also run it with neutrino? as the implementation would suggest it works there
There was a problem hiding this comment.
good point — it does work on neutrino, but only against a package-aware miner. neutrino has no mempool, so SubmitPackage just broadcasts parent+child and leans on the peer's 1p1c relay — that needs the bitcoind miner (minerbackend=bitcoind, v28+); against the default btcd miner the zero-fee parent is simply rejected and never assembles. so a neutrino row would have to be gated on minerbackend=bitcoind and assert confirmation (the neutrino result itself is a synthetic best-effort one). afaict there's no backend=neutrino+minerbackend=bitcoind combo in CI today, so it'd be skipped everywhere unless we add that job. happy to add the gated test (+ the CI combo) if you think it's worth it — wdyt?
2428104 to
bfabceb
Compare
bfabceb to
a928b90
Compare
Add SubmitPackage to the lnwallet.WalletController interface and a new WalletKit.SubmitPackage RPC, so a client of lnd can relay a package of related transactions (parents first, child last) through lnd's own chain connection. This lets a zero-fee v3/TRUC parent be accepted via its fee-paying CPFP child without the caller needing a separate connection to the chain backend. BtcWallet.SubmitPackage forwards to the chain backend's submitpackage for bitcoind/btcd, and broadcasts each transaction individually for neutrino (no mempool; relies on the peer's 1p1c package relay). The WalletKit handler maps the proto request/response to the btcjson result and is gated by the onchain:write macaroon permission. Mock controllers and the no-chain backend gain trivial implementations.
Add a `wallet submitpackage` command that takes one or more hex-encoded raw transactions (topologically sorted, parents first and the child last) and an optional --max_fee_rate, and submits them as a package via the WalletKit.SubmitPackage RPC.
Add an integration test that exercises WalletKit.SubmitPackage: it builds a zero-fee v3 (TRUC) parent that a standalone broadcast would reject, pairs it with a fee-paying v3 CPFP child, and asserts the package is accepted. A zero-fee transaction can only enter the mempool via package evaluation, so this proves the CPFP package path end to end. submitpackage is a bitcoind RPC, so the test skips on the btcd and neutrino backends. Also adds the SubmitPackage wrapper to the integration-test RPC harness.
a928b90 to
3983397
Compare
Summary
Adds a
WalletKit.SubmitPackageRPC, letting a client submit a package ofrelated transactions (topologically sorted, unconfirmed parents first and the
child last) to lnd's chain backend for atomic validation and acceptance.
This is what allows a v3/TRUC package to relay: a zero-fee parent carrying
an ephemeral (P2A) anchor is below the minimum relay fee and is rejected by a
standalone broadcast, but is accepted when submitted together with a
fee-paying CPFP child whose combined feerate clears policy.
TestMempoolAcceptalready exposes Core's
testmempoolacceptthis way;SubmitPackageis thebroadcasting counterpart for
submitpackage.Details
SubmitPackagemethod on thelnwallet.WalletControllerinterface.BtcWalletforwards it to the chain backend'ssubmitpackageforbitcoind/btcd; for neutrino (no mempool) it broadcasts each transaction over
P2P and relies on the peer's 1p1c package relay.
WalletKit.SubmitPackagehandler decodes the raw transactions, forwardsan optional per-transaction max fee rate (negative = node default;
0= nolimit, which a high-feerate CPFP child needs), and maps the node result back
to the proto response. It is gated by the
onchain:writemacaroonpermission.
wallet submitpackagelnclicommand.implementations.
Testing
make rpcreproduces the generated stubs cleanly andcmd/lndbuilds. Adds anintegration test (
testSubmitPackage) that submits a zero-fee v3 parent plus afee-paying CPFP child and asserts the package is accepted — a zero-fee
transaction can only enter the mempool via package evaluation, so this
exercises the CPFP path end to end.
submitpackageis a bitcoind RPC, so thetest runs on the bitcoind backend and skips on btcd/neutrino.
TODO before un-drafting
go.modfrom the forkreplaceto areleased btcwallet version.