Repository navigation
multi: lnd package relay (WalletKit.SubmitPackage) + itest harness support - #873
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces lndsubmitter, which implements chainbackends.PackageSubmitter using lnd's WalletKit.SubmitPackage RPC. This allows a darepod using an lnd wallet to relay zero-fee unilateral-exit v3/TRUC packages through lnd's chain connection without requiring a separate bitcoind RPC or Esplora endpoint. Feedback highlights a critical bug in SubmitPackage where the maxFeeRate (provided in BTC/kvB) is directly cast to sat/vByte without conversion, which would result in an extremely low fee rate and package rejection. A conversion factor of 100,000 needs to be applied, and the corresponding test should be updated.
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.
334cf3d to
9019d29
Compare
|
@claude review |
|
Claude finished @ellemouton's task in 3m 15s —— View job PR Review
Overall this is clean and well-documented — the 🟠 The lnd submitter doesn't disable the fee-rate ceiling like the bitcoind one doesThis is the main thing I'd want to confirm. Look at how the two submitters treat the max-fee-rate ceiling:
The only caller today, result, err := b.packageSubmitter.SubmitPackage(
ctx, parents, child, nil,
)So the two backends handle the same package differently: the bitcoind path removes the ceiling, the lnd path keeps lnd's default. If lnd applies a non-trivial default max fee rate to Worth verifying: what does 🟡 Minor — fee-rate conversion truncates toward zero
satPerVByte := chainfee.SatPerVByte(
*maxFeeRate * satoshiPerBTC / vBytesPerKvB,
)
🟡 Minor —
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the lndsubmitter package, enabling darepod to relay zero-fee unilateral-exit v3/TRUC packages via LND's WalletKit.SubmitPackage RPC. It also updates the test harness to support Neutrino as an LND chain backend. The review feedback suggests adding defensive nil checks for transactions to prevent panics, and rounding the converted fee rate to the nearest integer to avoid precision loss and an unintended lowering of the fee ceiling.
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.
ef1f474 to
eeb3131
Compare
Add chainbackends/lndsubmitter, a PackageSubmitter backed by lndclient's WalletKit.SubmitPackage RPC, and wire it as the default for the lnd chain backend when no explicit (bitcoind) submitter is injected. This lets an lnd-backed darepod relay its zero-fee unilateral-exit v3/TRUC packages through lnd's own chain connection, needing no separate bitcoind RPC or Esplora endpoint (darepo-client#590/#678). The submitter maps lndclient's native SubmitPackageResult back to the btcjson.SubmitPackageResult that chainbackends.PackageSubmitter returns.
Add an optional neutrino chain backend for harness lnd nodes, selected via lndConfig.chainBackend (LNDChainBackendBitcoind default, or LNDChainBackendNeutrino). Neutrino mode runs lnd with --bitcoin.node=neutrino --neutrino.connect=<bitcoind>:18444, syncing and broadcasting over the regtest bitcoind's P2P interface and compact block filters. This lets integration tests exercise lnd's native SPV / 1p1c broadcast path -- broadcasting a zero-fee v3 anchor parent plus its CPFP child over P2P and relying on the peer's 1p1c package relay -- instead of bitcoind's synchronous mempool acceptance. StartAdditionalLNDWithBackend exposes the choice to callers; StartAdditionalLND keeps the bitcoind default.
lndsubmitter became the default lnd package submitter, so an lnd-on-neutrino daemon now routes its exit packages through WalletKit.SubmitPackage. A neutrino-backed lnd has no mempool and cannot return a package-accept verdict; it broadcasts each tx individually over P2P (a peer's 1p1c relay reassembles the package) and reports the "broadcast-unverified" sentinel instead of "success". LNDBackend.SubmitPackage treated any non-"success" PackageMsg as a rejection, so it turned that best-effort broadcast into an error and failed exits that lnd had in fact already broadcast. Recognize the sentinel (with no per-tx errors) as a successful submit and let the confirmation watch decide the outcome.
c461bc9 to
5d3c23d
Compare
| // WalletKit.SubmitPackage RPC, and maps the lndclient-native result back to | ||
| // the btcjson type callers expect. | ||
| func (s *Submitter) SubmitPackage(ctx context.Context, parents []*wire.MsgTx, | ||
| child *wire.MsgTx, maxFeeRate *float64) (*btcjson.SubmitPackageResult, |
There was a problem hiding this comment.
More customary to use fn.Option here
There was a problem hiding this comment.
Agreed it's the more idiomatic shape. The maxFeeRate *float64 here is dictated by the existing chainbackends.PackageSubmitter interface (chainbackends/lnd.go), which the bitcoindrpc submitter also implements and which mirrors bitcoind's optional maxfeerate — so I kept this impl consistent with the interface rather than diverging it. Happy to migrate the whole interface (interface + both submitters + the LNDBackend/btcwbackend call sites, which all currently pass nil) to fn.Option[float64] — I'd prefer a small focused follow-up so this approved PR stays scoped to the lnd submitter. Will open that next unless you'd rather it ride here.
Combines the two client-side package-relay changes into one PR for review
(previously split across #873 and #734). Two commits:
1.
multi: relay v3 packages via lnd WalletKit.SubmitPackageAdds the lnd-backed package submitter — the consumer of the merged
lndclient.WalletKit.SubmitPackage(lndclient #280).chainbackends/lndsubmitteris achainbackends.PackageSubmitterthat assemblesthe parents-first/child-last package, forwards it to lnd, and maps lndclient's
native
SubmitPackageResult→btcjson.SubmitPackageResult. Wired intodarepod/server.goas the lnd chain backend's default submitter when noexplicit (bitcoind) submitter is injected. Lets an lnd-backed darepod relay its
zero-fee unilateral-exit v3/TRUC packages through lnd's own chain connection —
no separate bitcoind RPC or Esplora endpoint (darepo-client #590 / #678). Unit
tests cover assembly order, result mapping, and fee-rate forwarding.
2.
harness: add neutrino chain-backend option for lnd nodesAdds a per-client lnd chain-backend option to the itest harness so package-relay
itests can drive an lnd node against a neutrino backend. Consumed by the server
package-relay itest matrix (darepo #564).
Depends only on merged upstream. Builds + vets green.