Skip to content

feat(electrum): add blockchain.transaction.broadcast_package#227

Open
EddieHouston wants to merge 1 commit into
Blockstream:new-indexfrom
EddieHouston:feat/electrum-broadcast-package
Open

feat(electrum): add blockchain.transaction.broadcast_package#227
EddieHouston wants to merge 1 commit into
Blockstream:new-indexfrom
EddieHouston:feat/electrum-broadcast-package

Conversation

@EddieHouston

Copy link
Copy Markdown
Collaborator

Summary

Adds the blockchain.transaction.broadcast_package Electrum method (part of Electrum protocol 1.6), letting Electrum clients broadcast a transaction package via bitcoind's submitpackage. This is a step toward #172, and directly enables the TRUC/v3 package-relay use case requested there (LDK, RewindBitcoin).

It reuses the existing submitpackage plumbing introduced in 5e36b93 (POST /txs/package): daemon.submit_package / query.submit_package / SubmitPackageResult.

Ported from @romanz's electrs (romanz#1242).

Behavior

Params: [[txhex, ...]] or [[txhex, ...], verbose].

  • Non-verbose: returns { "success": bool }, or { "success": bool, "errors": [{ "error", "txid" }] } if any tx was rejected.
  • Verbose: returns the full submitpackage result.

Local mempool visibility fix

query.submit_package previously only forwarded to bitcoind. Unlike query.broadcast_raw (which calls Mempool::add_by_txid), it did not add accepted txs to electrs' local mempool — so scripthash subscription/history updates (which read the local mempool) would miss package txs until the next background sync. This affected both the new Electrum method and the existing REST /txs/package endpoint.

Fixed at the shared query.submit_package layer: accepted txs are now added to the local mempool (new Mempool::add_by_txids, batched so parent/child package txs link within one add), benefiting both entry points.

Test plan

  • test_electrum_broadcast_package — success + verbose response shapes.
  • test_electrum_broadcast_package_updates_mempool — regression: a tx electrs hasn't synced becomes visible in scripthash history immediately after broadcast_package.
  • test_rest_package_updates_mempool — same regression for POST /txs/package.

Both regression tests were verified to fail without the local-mempool fix. Full suite green on both default and --features liquid.

Ported from @romanz's electrs.

  Expose bitcoind's submitpackage over the Electrum protocol, reusing the
  existing submit_package query/daemon plumbing. Accepted package txs are
  added to electrs' local mempool (like broadcast_raw) so scripthash
  subscription/history updates reflect them immediately.

  Includes Electrum and REST regression tests for the local-mempool
  visibility behavior.

  Ported from @romanz's electrs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant