Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
501utxo_to_spend=self.wallet.get_utxo(confirmed_only=True),502)503chained_burn_hex = [t["hex"] for t in chained_txns_burn]505tx = tx_from_hex(chained_burn_hex[1])506tx.vout[-1].scriptPubKey = b'a' * 10001 # scriptPubKey bigger than 10k IsUnspendable507chained_burn_hex = [chained_burn_hex[0], tx.serialize().hex()]508# burn test is run before any package evaluation; nothing makes it in and we get broader exception509assert_raises_rpc_error(-25, "Unspendable output exceeds maximum configured by user", node.submitpackage, chained_burn_hex, 0, chained_txns_burn[1]["new_utxo"]["value"] - Decimal("0.00000001"))510assert_equal(node.getrawmempool(), [])512minrate_btc_kvb_burn = min([chained_txn_burn["fee"] / chained_txn_burn["tx"].get_vsize() * 1000 for chained_txn_burn in chained_txns_burn])514# Relax the restrictions for both and send it; parent gets through as own subpackage515pkg_result = node.submitpackage(chained_burn_hex, maxfeerate=minrate_btc_kvb_burn, maxburnamount=chained_txns_burn[1]["new_utxo"]["value"])516assert "error" not in pkg_result["tx-results"][chained_txns_burn[0]["wtxid"]]517assert_equal(pkg_result["tx-results"][tx.wtxid_hex]["error"], "scriptpubkey")518assert_equal(node.getrawmempool(), [chained_txns_burn[0]["txid"]])520def test_submitpackage_with_ancestors(self):521self.log.info("Test that submitpackage can send a package that has in-mempool ancestors")522node = self.nodes[0]523peer = node.add_p2p_connection(P2PTxInvStore())525parent_tx = self.wallet.create_self_transfer()526child_tx = self.wallet.create_self_transfer(utxo_to_spend=parent_tx["new_utxo"])527grandchild_tx = self.wallet.create_self_transfer(utxo_to_spend=child_tx["new_utxo"])528ggrandchild_tx = self.wallet.create_self_transfer(utxo_to_spend=grandchild_tx["new_utxo"])530# Submitting them all together doesn't work, as the topology is not child-with-parents531assert_raises_rpc_error(-25, "package topology disallowed", node.submitpackage, [parent_tx["hex"], child_tx["hex"], grandchild_tx["hex"], ggrandchild_tx["hex"]])533# Submit older package and check acceptance534result_submit_older = node.submitpackage(package=[parent_tx["hex"], child_tx["hex"]])535assert_equal(result_submit_older["package_msg"], "success")536mempool = node.getrawmempool()537assert parent_tx["txid"] in mempool538assert child_tx["txid"] in mempool540# Submit younger package and check acceptance541result_submit_younger = node.submitpackage(package=[grandchild_tx["hex"], ggrandchild_tx["hex"]])542assert_equal(result_submit_younger["package_msg"], "success")543mempool = node.getrawmempool()545assert parent_tx["txid"] in mempool546assert child_tx["txid"] in mempool547assert grandchild_tx["txid"] in mempool548assert ggrandchild_tx["txid"] in mempool550# The node should announce each transaction.551peer.wait_for_broadcast([tx["tx"].wtxid_hex for tx in [parent_tx, child_tx, grandchild_tx, ggrandchild_tx]])552self.generate(node, 1)555if __name__ == "__main__":556RPCPackagesTest(__file__).main()
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.