test: check getprivatebroadcast and abortprivatebroadcast throw if the node is running without -privatebroadcast set
What changed, and why it matters
This commit only adds two new test assertions to an existing functional test file. It verifies that two Bitcoin Core RPC commands (getprivatebroadcastinfo and abortprivatebroadcast) return a documented error when the -privatebroadcast feature is not enabled. There is no change to production code, no bug fix, and no security vulnerability being patched.
No security action needed. This is a routine test-only commit. Reviewers may optionally verify that the new assertions pass in CI.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds test-only coverage in test/functional/p2p_private_broadcast.py. It asserts that calling getprivatebroadcastinfo and abortprivatebroadcast on a node started without -privatebroadcast=1 raises RPC error -32601 with the expected message. The production behavior being tested already exists; this commit merely adds regression tests for it.
Changed components
test/functional/p2p_private_broadcast.pyInspect captured patch +6 / −0
diff --git a/test/functional/p2p_private_broadcast.py b/test/functional/p2p_private_broadcast.py
index e8eaee6f..2c581df1 100755
--- a/test/functional/p2p_private_broadcast.py
+++ b/test/functional/p2p_private_broadcast.py
@@ -223,6 +223,12 @@ class P2PPrivateBroadcast(BitcoinTestFramework):
tx_receiver = self.nodes[1]
far_observer = tx_receiver.add_p2p_connection(P2PInterface())
+ self.log.info("Test getprivatebroadcastinfo and abortprivatebroadcast fails if the node is running without -privatebroadcast set")
+ assert_raises_rpc_error(-32601, "Private broadcast is not enabled. Ensure you're running Bitcoin Core with -privatebroadcast=1.",
+ tx_receiver.getprivatebroadcastinfo)
+ assert_raises_rpc_error(-32601, "Private broadcast is not enabled. Ensure you're running Bitcoin Core with -privatebroadcast=1.",
+ tx_receiver.abortprivatebroadcast, "00" * 32)
+
self.fill_node_addrman(node_index=0, address_types_to_add=[CAddress.NET_IPV4, CAddress.NET_IPV6, CAddress.NET_TORV3, CAddress.NET_I2P, CAddress.NET_CJDNS])
wallet = MiniWallet(tx_originator)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.