feat(electrum): add blockchain.transaction.broadcast_package#227
Open
EddieHouston wants to merge 1 commit into
Open
feat(electrum): add blockchain.transaction.broadcast_package#227EddieHouston wants to merge 1 commit into
EddieHouston wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the
blockchain.transaction.broadcast_packageElectrum method (part of Electrum protocol 1.6), letting Electrum clients broadcast a transaction package via bitcoind'ssubmitpackage. This is a step toward #172, and directly enables the TRUC/v3 package-relay use case requested there (LDK, RewindBitcoin).It reuses the existing
submitpackageplumbing 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].{ "success": bool }, or{ "success": bool, "errors": [{ "error", "txid" }] }if any tx was rejected.submitpackageresult.Local mempool visibility fix
query.submit_packagepreviously only forwarded to bitcoind. Unlikequery.broadcast_raw(which callsMempool::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/packageendpoint.Fixed at the shared
query.submit_packagelayer: accepted txs are now added to the local mempool (newMempool::add_by_txids, batched so parent/child package txs link within oneadd), 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 afterbroadcast_package.test_rest_package_updates_mempool— same regression forPOST /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.