Skip to content

Private broadcast as node-less jobs, reimplemented from the specification - #7

Open
instagibbs wants to merge 35 commits into
masterfrom
privbcast-4-package
Open

instagibbs wants to merge 35 commits into
masterfrom
privbcast-4-package

Conversation

@instagibbs

@instagibbs instagibbs commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

This is a second implementation of the design in #5. It was written from the specification
(doc/design/private-broadcast-tool.md) and the black-box test suite alone, without reading #5's
code, and then compared with #5. The goal is the same: broadcast
a transaction without revealing the sender's IP address, onion address or node identity, by not
letting the local node's state influence the broadcast at all.

The design is specified in doc/design/private-broadcast-tool.md: goals, threat model, invariants,
parameters, interface, assumptions and non-goals. Usage is in doc/private-broadcast.md.

This PR is the whole series. It splits into four PRs, each mergeable in turn (branches
privbcast-1-support to privbcast-4-package):

  1. Supporting changes (3 commits): BIP324 moves to the common library, the transports move out of
    net.h (move-only), and fixed-seed decoding is pulled out of ConvertSeeds for reuse.
  2. The tool (11 commits): the specification first, then the job library one piece per commit with
    its unit and fuzz tests (parameters and schedule, candidate assignment, a byte-driven SOCKS5
    client, the attempt, proxy streams and discovery, the job), then the test harness,
    bitcoin-privbcast with tool_privbcast.py, the user guide and release notes.
  3. Node mode (7 commits): the job queue; -privatebroadcast runs jobs, with master's tests replaced
    in the same commit; two delete-only commits removing the old relay and connection code (git show -w --word-diff-regex='[A-Za-z0-9_]+|[^[:space:]]' shows deletions only); AdvertisedVersion()
    dropped; guide and release notes.
  4. Package mode (6 commits): one parent and its child, in the tool and through submitpackage; the
    specification's extension section, guide and release notes.

The tool is useful on its own after step 2.

Compared with -privatebroadcast on master

master This PR
Peers the node's address manager per job: the release DNS seeds resolved through Tor (RESOLVE), and onion peers from the release fixed-seed list
Networks Tor, I2P, IPv4/IPv6 through the proxy Tor only: onion peers, and IPv4/IPv6 peers through Tor exits
Transport v2 or v1 v2 (BIP324) only
Connections at once 3 per transaction when submitted (all share a cap of 64), each up to 3 min at most 6 per job; in bitcoind up to 18 jobs overlap
Connections in total more with every re-send at most 24 recipients per job, after 4 RESOLVE streams per DNS seed
Retries a new peer every 2-3 min until the transaction comes back or fails a test accept, up to 1000 times none; the schedule is drawn when the job starts
Duration open-ended a job's scheduled work ends within 568 s
Peer profile NODE_NONE, no wtxid relay, announces by txid NODE_WITNESS, protocol 70017, wtxid relay required (BIP339)
Packages no one parent and its child
Without a node no the bitcoin-privbcast program

Given up: I2P, peers that speak only v1, the node's address manager, and re-sending when the
transaction does not come back. The remedy for a transaction that did not arrive is another job.

Compared with #5

#5 This PR
A job a watcher thread, one thread per slot, up to 28 discovery threads one thread running a non-blocking event loop over every socket of the job
State machines the session reads and writes sockets the SOCKS5 client and the attempt are pure: bytes and a time in, bytes out
SOCKS5 netbase's client extended (RESOLVE, required authentication, per-call deadlines and interrupt), still blocking its own byte-driven client in src/privbcast/; netbase untouched
Time in tests a process-wide time divisor and a waiter registry Timing passed in; tests drive the loop over fake clocks and sockets
Node queue 18 resident workers and a pure queue a scheduler thread whose start rule is a pure function, and one thread per running job
Failure containment per slot thread per attempt and per discovery query; a failure of the job itself still prints the report
Reports JSON built in the job a typed report; the node stores finished reports once and shares them with the RPC
BIP324 keys Core's default Core's default (strong RNG) in production; tests inject a seeded key source and replay a job byte for byte
Commits one 41-file commit for node mode and the removal, then fixups 27 commits in the four PRs above; move-only and delete-only commits checkable mechanically; each code commit names the specification items it implements
Production lines added 3,913 5,316
Test lines added 4,218 (2,021 unit, 2,197 fuzz) 7,018 (5,037 unit, 1,981 fuzz)

The extra production lines are mostly the SOCKS5 client (about 420), the typed report (about 330),
the node queue (about 280) and the plan and assignment code (about 220); #5's attempt and discovery
code is the larger. The second SOCKS5 client is the main cost: netbase's client
blocks and takes its timeout and interrupt from process-wide globals, which is what forced #5 into a
thread per slot. If reviewers want one implementation, this client can move into common code with
netbase's Socks5() rewritten as a blocking loop around it, as a change in the first PR.

Comparing the two also found places where #5 does not meet the specification; this PR meets each:

  • a small backward clock step can start the next job too early (N3);
  • in package mode the PING can be written after the request window (E6);
  • queued jobs can survive networking going off and on while every worker is busy (N6);
  • -signetseednode and -mocktime are not refused (U1), and -listenonion -onion=0 starts although
    onion can never become reachable (U2);
  • the tool ignores -signetchallenge;
  • an internal error never gives exit status 1, and a fully written INV can be lost from the report
    at a deadline (H2);
  • a jump of the node's clock does not end a blocked exchange within a second, and two discoveries
    can overlap after a jump (N4);
  • the descriptor reservation assumes at most eight DNS seeds (N10).

Specification changes since #5

C7: an internal failure in one attempt or discovery query ends only that attempt or query. C8: no
exception for a TCP connect under way. D2: when a slot ends. R4 and R5b: a shared endpoint is
credited to the first of its seeds in the drawn order, a seed's kept answers are a random choice,
and a slot takes a candidate from a seed it already used rather than leave an opportunity empty. H2:
exit status 0 if any INV was fully written even if the job failed afterwards, else 1 for a usage,
input or job failure, 2 for a job that ran without failing; summary.error replaces the per-slot
error. U1: the tool, and the node with -privatebroadcast, refuse -signetseednode and
-signetchallenge; the node refuses -mocktime off regtest. U2: -onion=0 refused with
-privatebroadcast. N3: after a backward clock step a start also waits for an open discovery (N4
first). Interface: the tool reads no configuration file; seen_in_mempool is set from submission
when the txid is already in the mempool. Extension: the package input rule no longer requires the
spent parent output to be spendable; submitpackage counts fees and sizes as validation does;
abortprivatebroadcast matches a package job by its child only.

Testing

  • Black-box suite: tool_privbcast.py and p2p_private_broadcast.py (each also with --package),
    p2p_private_broadcast_cap.py, and the -privatebroadcast checks in feature_config_args.py,
    feature_init.py and feature_signet.py. Every invariant it claims to check was confirmed by
    mutation against Create privbcast tool, swap out in-node implementation for node-less driving #5's implementation: 98 mutants, each failing the intended test.
  • White-box: 74 unit cases in privbcast_*_tests, and the fuzz targets privbcast_attempt,
    privbcast_discovery, privbcast_socks5, privbcast_input, privbcast_queue and
    privbcast_start_policy. A mutation pass designed from the invariant map: all 108 mutants of
    mapped items were caught (84 by the unit case the map names, 17 by the named fuzz target, 7 by
    another suite); of 36 further mutants, 4 survive, all behaviours the black-box suite checks.
  • Every commit builds and passes the unit tests and the functional tests it can affect; at each of
    the four tips the whole functional suite, the lints and a clang -Wthread-safety -Werror build
    pass. Not run locally: libc++ and Windows builds.
  • Live, through a local Tor: discover on mainnet, testnet4 and signet; on mainnet, sends of
    unconfirmed transactions taken from mempool.space (exit 0; requested and PONGed by peers that
    lacked the transaction); on signet, a new transaction (served by two peers, in a separate node's
    mempool 30 s after the job started) and a TRUC parent with its fee-paying child (the peer asked for
    the parent 4.3 s after receiving the child; both in the separate node's mempool after 42 s).

Not done yet: node mode against real peers, a rebase onto current master, and seed inputs for the
new fuzz targets in qa-assets (the attempt target needs a corpus to get past the handshake).

@instagibbs
instagibbs force-pushed the privbcast-4-package branch 15 times, most recently from af8348b to 76976f0 Compare October 9, 2026 21:35
@instagibbs

instagibbs commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner Author

I need to removed the fixed onion seeds as trivial version fingerprint, and need to more fully flesh out design issues that involve fingerprints via seeder more generally

@andrewtoth

Copy link
Copy Markdown

Thanks for sharing this approach.

I realize this is still WIP, so just sharing some high level feedback:

I agree generally with the goal. Moving the logic out of net_processing and removing dependence on node state should help reduce unintended privacy leaks. A separate tool could also be useful for users not currently running a node.

Supporting 1P1C package relay out of the box is a big improvement!

This is a lot of code change. It might make sense to try and simplify the change so it can be more easily reviewed.

Why has i2p been removed? I think having more network diversity here would improve reliability. Is this an explicit design decision due to an inherent weakness, or is it to reduce complexity?

I am not sure about using the built-in DNS seeds to source addresses.

We explicitly added getnodeaddresses (bitcoin#13152) for this purpose bitcoin#9463. Perhaps we can leave sourcing addresses to the caller of the tool, and in bitcoind we would pass a random sample of addresses from our addrman? This would still leave a gap in that if our addrman could be fingerprinted with certain addresses it could leak some data to an attacker. However, I am not sure how realistic this type of attack is. It might make sense to better understand that attack's setup cost and practical effectiveness.

@instagibbs

Copy link
Copy Markdown
Owner Author

Thanks for taking a look.

This is a lot of code change. It might make sense to try and simplify the change so it can be more easily reviewed.

While it's a lot of code, it can be split up into multiple PRs, each compartmentalized and hopefully well-tested. I was unable to make this dramatically simpler, even when I delete ~all "goal 2" requirements of trying to not leak things between opportunities.

Why has i2p been removed? I think having more network diversity here would improve reliability. Is this an explicit design decision due to an inherent weakness, or is it to reduce complexity?

I am not sure about using the built-in DNS seeds to source addresses.

These are tied together in a way. Other than wishing to reduce the total loc changed, torv3 and i2p addresses don't fit in Tor's RESOLVE record responses, so the state machine would need to be extended into a slightly more involved state machine with RESOLVE->getaddressinfo->dial. We would still require dns seeds, otherwise we don't know who to ask.

Another strategy is we could reduce the number of circuits by having a single circuit (via one exit) do RESOLVEs against all the dns seeds. During the discovery phase that would drop it down to 7 circuits, though you still need individual circuits for each opportunity.

Given that, I'm not quite sure what it would buy. We would be able to RESOLVE a few times less. The real gains from that would mostly be not having to fire up N circuits per seeder during the discovery phase.

I've run fairly extensive tests and have seen no indication that this many Tor circuits is a problem, but more testing is probably warranted.

The real gain from doing "RESOLVE->getaddressinfo->dial" seems to be i2p support, but I have done no benchmarking on this front, including testing a client would actually get an appropriate number of i2p addresses from seeders. Even assuming it works, it still precludes i2p-only designs, as you need to get dns seeder responses first over Tor. If the user has Tor, we should just use that. I might be missing something.

We can't safely use fixed seed i2p/tor addresses due to fingerprint potential across releases, and the decay quickly regardless, based on my testing.

Perhaps we can leave sourcing addresses to the caller of the tool, and in bitcoind we would pass a random sample of addresses from our addrman?

This would be a unique fingerprint to their node. I don't think we should offer users this.

I think we should be trying to reduce our reliance on the built-in DNS seeds. This moves in the opposite direction. This is also somewhat supported by documentation in the project:

Yes, for block connectivity, we definitely should not be increasing reliance on the dns seeds. Usage in the context of the propose private broadcast functionality carries no such risk. Any realistic solution I see is solved by dsn seeders, or downstream of things they hand us via getaddressinfo.

===

wrt DNS seed rotation in releases, looks like:

Set Releases Change from the previous set
S1 v22.0 → v26.1 9 seeds. Unchanged for about 2.5 years (2021–2023).
S2 v26.2 dashjr.org renamed to dashjr-list-of-p2p-nodes.us (point release only)
S3 v27.0 petertodd .org → .net. v27.0 still has dashjr.org: the rename landed on master after 27
branched and was backported to 26.2 and 27.1.
S4 v27.1, v27.2 dashjr rename
S5 v28.0–28.3, v29.0–29.2, v30.0 + achownodes, − bitcoinstats
S6 v28.4, v29.3–29.4, v30.1–30.3, v31.0–31.1 − dashjr ("unreliable seed", 2025-10-28, backported to
three branches)
S7 master, so v32 − seed.bitcoin.sipa.be (2026-07-09). Leaves 7 seeds.

So over time there is a mild fingerprint still, as churn is induced, with additions/modifications being the largest vector.

side-note: I need to also modify the implementation to not silently run short of candidates for a job if dns seeds are removed.

@instagibbs

instagibbs commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner Author

removed fixed seeds support, increased ANSWERS_KEPT_PER_SEED to 4 to stay at parity of usable responses

doing some more Tor benchmarking to see how problematic discovery can get under load

Might need to switch from 28x1 RESOLVEs to 4x7 which would mean only 4 Tor circuits based on the below:

Each job makes 28 mainnet RESOLVEs through the local Tor (0.4.9.13). Only answers inside the 18 s window
count.
k = number of jobs started at the same moment. 3 trials per cell, in random order, 75 s apart.

Overlapping jobs (k) 28×1 answer ratio 4×7 answer ratio 4×7 new circuits (median)
1 1.00, 1.00, 1.00 0.86, 1.00, 1.00 0 (reuses pre-built)
2 0.91, 0.27, 0.96 1.00, 0.96, 0.96 5
4 0.02, 0.00, 0.04 0.94, 0.98, 0.99 17
8 (not run) 0.00, 0.04, 0.89 21

iow, 4 concurrent jobs in 47 config seem to do as well as 1 concurrent job in 281. The number of tor circuits dominates it.

@instagibbs

instagibbs commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner Author

Implemented the 4x7 "query sets":

  1. Reduces the Tor circuit load greatly, for no fundamental privacy hit
  2. Spread out over 4 circuits because if repeated on the same circuit(aka exit) would result in the same responses 4 times redundantly on each dns seed. There is a risk that an exit drops all responses, so having 4 circuits hedges against depriving us of all slots. On average, this new setup drops fewer results.
  3. Reduced the discovery time to 12s vs 18s, with no measures misses yet, though they could happen.

Another alternative would be to drop RESOLVE and do CONNECT stream instead so we could get N results from a seeder at once. This would require us doing DNS resolution ourselves including choosing a resolver and parsing responses. Sounds not worth it.

@instagibbs
instagibbs force-pushed the privbcast-4-package branch 4 times, most recently from e67b5a0 to 7d9534a Compare October 22, 2026 13:03
Empty commit marking where the parts of this pull request begin. Part 1 moves code that bitcoin-privbcast shares with the node into the common library and exports what it needs from net and netbase. No behaviour change.
bitcoin-privbcast (added later in this series) links the BIP324 cipher
without the node library. The cipher depends only on crypto, keys,
randomness and chain parameters, which the common library already
provides.
The transports and the messages they carry are needed by a tool that
must not link the node library (bitcoin-privbcast, added later in this
series). Move them, with NodeId and MAX_PROTOCOL_MESSAGE_LENGTH, to
net_transport.{h,cpp} in the common library. net.h includes the new
header and drops the includes that only the moved code used; files that
name NodeId include the new header themselves.

net.h includes the new header first, where bip324.h was: Qt's moc reads
net.h through the GUI's headers and cannot parse libstdc++'s <concepts>
unless an earlier header has defined _GLIBCXX_VISIBILITY.

Move-only: no code changes.
A job reaches recipients and resolves DNS seed names through the proxy,
on streams its event loop drives without blocking. Socks5Client holds
no socket: it offers the bytes to write, consumes the proxy's replies,
and leaves bytes past the final reply to the P2P transport. It offers
only username and password authentication, with the credentials it is
given or fresh ones, and sends a numeric address as IPV4 or IPV6
without resolving anything.

Implements B2 and the Proxy interface section.
An attempt is one connection to a recipient once the proxy connected
it: a BIP324 session as initiator, the handshake with the job's
VERSION, one INV, the transaction served at most once, and the PING.
It holds no socket and reads no clock: the job's loop passes the bytes
read and the time; each call records what happened (a completed write,
the connection, bytes received) and then enforces the attempt's
deadlines, so that nothing is acted on at or after one.

The attempt draws its VERSION and PING nonces from the random context
it is given, and takes its BIP324 key, ellswift entropy and garbage
from a key source. Without one, as in production, V2Transport draws
them from the strong RNG. The tests and the fuzz target inject a
source that draws from their seeded context, so that an attempt's
bytes are a function of that context and of what the peer sent.

Implements E1-E8, A2, B4, D3 and the attempt part of D2.
A job reaches the network only through streams to the SOCKS5 proxy,
which its event loop drives without blocking. ProxyStream connects to
the proxy by address or unix socket path, resolving nothing, and runs
the exchange of its Socks5Client; each stage, the connect and each
step of the exchange, times out on the steady clock. Once the proxy
has connected the stream, its socket carries the destination's bytes.

Discovery launches every RESOLVE query at job start, each on a stream
of its own, in four query sets: each set has credentials of its own
and one query of every seed, so Tor builds four circuits rather than
one per query, and each seed is still asked through four exits.
Discovery ends when every query has ended or when the discovery window
does, whatever is still pending. It keeps the answers that are public
routable IPv4 or IPv6 addresses, with the chain's default port, and
counts the others; its result gives each seed's answers by the query
set they came through, whatever order they arrived in. An exception
thrown while it acts on one query ends only that query, as a failed
stream would.

The tests run discovery against a scripted proxy behind fake sockets
that connect as non-blocking sockets do. The fake socket and the
proxy's side of the SOCKS5 exchange go into the test utilities, as the
job's tests use them too.

Implements B1, B2, C3, D1, R1, R2 and C7 for the queries.
A job is one event loop on its caller's thread. Step() runs the
deadlines and the dials that are due, waits on every open stream until
the next deadline, and does the I/O; Run() steps to the end. The plan
is drawn when the job is made, before any socket exists, and discovery
starts with the first step. When discovery ends the assignment is
fixed, and each slot dials its opportunities at their scheduled times,
one attempt at a time, until one reaches the announcement point or
none is left. The slots share only the loop, so a stalled stream holds
up no other slot, and the cancel flag ends everything at the next step.

An exception thrown while the loop acts on one attempt ends only that
attempt, as a failed stream would. One thrown anywhere else in a step
fails the job: it stops as a cancelled job does, and its report gives
the error.

The report mirrors Interface/Report, every time an offset from job
start on the plan clock. Snapshot() gives the progress the node is to
show, from any thread. ExitStatus() gives the tool's exit status for a
report.

Implements A1, A3, A4, C1-C8, D1, D2, H1, H3 and the report interface.
The SOCKS5 server gains Tor's RESOLVE command, reply delays for a slow
or stalled proxy, a mode that offers only unauthenticated access and a
mode that behaves as an ordinary non-Tor proxy. A client that hangs up
before its greeting, as a cancelled job's streams can, and a connection
that Windows reports as aborted count as closed, not as errors. The P2P
network thread judges a failed protocol by its own reconnect flag, so
that several listeners can share one loop. The framework learns where
bitcoin-privbcast is and how to skip a test without it.

Prepares the functional test that the next commit adds with the binary.
The standalone tool: it reads one transaction on stdin, runs one job
through the Tor proxy named by -tor and prints the report on stdout,
with progress lines on stderr. It takes no configuration file and only
a loopback proxy, refuses the regtest overrides on other chains and
checks its arguments and input before any network activity. The
discover command runs discovery alone.

Build and packaging: the BUILD_PRIVBCAST option (on with BUILD_TESTS),
the privbcast subcommand of the bitcoin wrapper, the man page, the
Windows resource file, the manpage generator and Windows CI lists, and
the test configuration that tells the functional framework the binary
exists.

The functional tests tool_privbcast.py, tool_privbcast_proxy.py and
tool_privbcast_peers.py, with their harness in
test_framework/privbcast.py, are the specification's black-box
acceptance suite for the tool: scripted recipients and a scripted proxy
check every wire-visible parameter, the schedule, the assignment, the
exit statuses and cancellation.

Implements B3, H2, U1 and the Interface section for bitcoin-privbcast.
Add the user guide to private broadcast with its bitcoin-privbcast
part: the Tor proxy the tool needs, how to send a transaction and read
the exit status and the report, discover, and the limits of what a job
protects.
Empty commit marking the start of part 3: the node runs each private broadcast as the tool's job, and the old relay and connections are removed.
The node runs each private broadcast as a privbcast::Job, the tool's
job, on a thread of its own. PrivbcastQueue queues the submitted
transactions, starts and cancels the jobs from one scheduler thread,
and keeps in memory the records that getprivatebroadcastinfo and
abortprivatebroadcast are to show. It reaches the node only through
callbacks for networking, the onion proxy and the mempool, and takes
the job runner as a parameter, so that the tests drive it with stub
jobs and mocked clocks. A job that failed, or whose runner threw, ends
aborted with the error in its record.

The scheduler's start rule is a pure function, StartPolicy::Decide(),
which each pass of the scheduler applies: a fuzz target checks the
rule on its own, and another the queue through its interface.

bitcoin_node now links bitcoin_privbcast.

Implements N3-N7, N9, N10, the node's D2 and D3, U3. Not yet wired:
the next commit switches -privatebroadcast to it.
With -privatebroadcast, sendrawtransaction now queues a job on the
node's PrivbcastQueue instead of handing the transaction to the
connection manager, getprivatebroadcastinfo lists the jobs with their
progress and reports, and abortprivatebroadcast aborts them. Startup
requires onion to be able to become reachable, refuses the regtest
seed overrides on other chains, -signetseednode, -signetchallenge, and
off regtest a non-zero -mocktime, and refuses to start rather than trim
connections when the jobs' file descriptors are not available. -connect
and -proxyrandomize no longer matter.

The old private broadcast connections and relay stay in the tree, no
longer fed, until the commits that remove them.

Implements N1, N2, N8, N10, N11, U1, U2 and Interface/Node; replaces
the old implementation's tests with the specification's.
Since -privatebroadcast runs jobs, nothing hands PeerManager a
transaction for private broadcast any more. Remove its queue
(src/private_broadcast.{h,cpp}) with the methods, the retry task and
the private_broadcast option that served it, and its handling of
private broadcast connections: the fixed VERSION, the INV after
VERACK, the GETDATA and PONG handling, the incoming message filter,
the lifetime limit and the exemption from discouragement. The unit and
fuzz tests of that code go with it, including the net_tests case for
the addrman exception and the denialofservice_tests cases for the
discouragement exemption.

Delete-only: besides whole lines, conditions and arguments are cut out
of lines, and the lines of a removed branch's alternative move out one
indentation level. git show -w --word-diff-regex='[A-Za-z0-9_]+|[^[:space:]]'
shows deletions only, apart from the size of the node array in
denialofservice_tests, which goes back from 5 to 3.
With the relay gone, nothing asks CConnman for private broadcast
connections. Remove the connection type, the thread that opened such
connections with its counters and choice of network, and the places
that treated them specially: the incoming nonce check, the fresh I2P
session, the guard against direct connections, the outbound message
filter, the fixed protocol version, the exception in disconnection by
subnet and their term in the orphanage's static_assert. The type's
names go from getpeerinfo's help, bitcoin-cli -netinfo and the GUI. The
proxy override of ConnectNode() and OpenNetworkConnection(), which only
that thread set, goes too, with its copy in CNode and in the
reconnection record and the fuzz input for it.

Delete-only: besides whole lines, conditions, arguments and list
separators are cut out of lines, what followed a cut argument joins
its line, and one line moves out an indentation level with the if
around it. git show -w --word-diff-regex='[A-Za-z0-9_]+|[^[:space:]]'
shows deletions only.
Without private broadcast connections, a node advertises
PROTOCOL_VERSION on every connection, and CNode::AdvertisedVersion()
only returns it. Use the constant again where the method was called.
Add the node part of the private broadcast guide: which Tor proxy the
jobs use, how sendrawtransaction queues them and when they start, what
is not queued again, how to follow and abort jobs, what disabling
networking and shutdown do, which node settings do not apply, what
the default log shows, the file descriptors the jobs need, and the
link between a job's connections and the node's peers at shutdown.
Empty commit marking the start of part 4: one parent and its child. The validation commits here serve only this part.
A child can pay for a parent too cheap to enter mempools alone when the
recipient takes the two together. A job may now carry the parent: each
attempt announces only the child, serves the parent to a peer that asks
for it, and holds the PING for that request. A job without a parent
runs and reports as before.

Implements F1-F4 and the package amendments of E6-E8.
bitcoin-privbcast send also reads two transactions, an unconfirmed
parent and its child in either order, checks that they are such a pair
and runs the job in package mode. The acceptance suite gains its
package sections in tool_privbcast_package.py.

Implements the Extension's Interface for bitcoin-privbcast.
Two prioritisetransaction deltas near INT64_MIN made the sum overflow.
ProcessNewPackage's test mode checks each transaction without package
feerates or replacements, as testmempoolaccept does. With
test_as_submission it runs submission's evaluation instead and stops
short of the mempool, so a caller can learn whether a child pays for its
parent before relaying them. A transaction that passed before another
failed is reported by its own result, as submission reports it. Results
do not list replaced transactions, and a parent that passes alone gives
no answer for its child, which it does not stage.

From bitcoin#35286, without its RPC.
A test does not stage a transaction that passes alone, so the child
that spends it was found missing its inputs. Test the new transactions
together instead, each paying for itself. Their replacements get
package RBF's checks of fees, feerate diagram and cluster limits, but
not its rules that the package have no mempool ancestors and pay more
per vbyte than the parent: submission would take the two in turn, each
replacing what it may. A replacement of an ancestor of the package is
refused instead, as it would take away the package's inputs. For a
parent and child this accepts at least what submission accepts.
With -privatebroadcast, submitpackage now queues a private broadcast
job instead of adding the transactions to the mempool. It takes one
transaction, or a parent and its child, and queues one job, the
child's, which carries the parent. A transaction whose txid is in the
mempool counts as accepted; the rest is test-accepted, one transaction
alone as by sendrawtransaction, two as a package, after the package
checks on the whole submission, two as submitpackage evaluates them.
maxfeerate follows each path's own convention. Unit tests drive the RPC through its table.

The queue takes the parent with the transaction: a submission with a
parent is covered only by a job with the same parent, one without by a
job with any parent. getprivatebroadcastinfo lists the parent's txid
and documents the report's package fields; abortprivatebroadcast
matches the child's ids only. Both submission RPCs ask the queue
whether an onion proxy is configured, which lets unit tests drive
them without the process-wide proxy registry. The acceptance suite gains its package
sections, run as p2p_private_broadcast.py --package.

Implements the Extension's N5 and N11 amendments and its Interface for
submitpackage.
Add the specification's section "Extension: one parent, one child",
which the preceding commits implement: a job that carries a child and
its unconfirmed parent announces only the child and serves the parent
on request (F1-F4), and the tool and the node take such a pair.
Add the guide's part on a parent and its child: when it helps, which
recipients accept such a package, what the tool and the node check and
what peers can tell; and how submitpackage queues a job under
-privatebroadcast.
instagibbs pushed a commit that referenced this pull request Nov 10, 2026
…:__pad_and_output

fa3821e test: Add missing suppression for race:std::__1::__pad_and_output (MarcoFalke)

Pull request description:

  From https://github.com/bitcoin/bitcoin/actions/runs/41684419453/job/126086262840?pr=35990#step:11:8669:

  ```
  WARNING: ThreadSanitizer: data race (pid=17903)
    Write of size 8 at 0x7ff5c1990c20 by thread T12 (mutexes: write M0):
      #0 width /llvm-project/libcxx/include/ios:498:18 (libc++.so.1+0xd3816) (BuildId: 6e001266114c9106207bb18363e2d5a09b534306)
      #1 std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>> std::__1::__pad_and_output[abi:dee230102]<char, std::__1::char_traits<char>>(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>, char const*, char const*, char const*, std::__1::ios_base&, char) /llvm-project/libcxx/include/__locale_dir/pad_and_output.h:67:9 (libc++.so.1+0xd3816)
      #2 std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>> std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>>::__do_put_integral[abi:dee230102]<long long>(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>, std::__1::ios_base&, char, long long) const /llvm-project/libcxx/include/__locale_dir/num.h:907:10 (libc++.so.1+0xbcfa0) (BuildId: 6e001266114c9106207bb18363e2d5a09b534306)
      #3 std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>>::do_put(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char>>, std::__1::ios_base&, char, long long) const /llvm-project/libcxx/include/__locale_dir/num.h:919:16 (libc++.so.1+0xbcb79) (BuildId: 6e001266114c9106207bb18363e2d5a09b534306)
      #4 put /llvm-project/libcxx/include/__locale_dir/num.h:780:12 (libc++.so.1+0x9b40c) (BuildId: 6e001266114c9106207bb18363e2d5a09b534306)
      #5 std::__1::basic_ostream<char, std::__1::char_traits<char>>& std::__1::basic_ostream<char, std::__1::char_traits<char>>::__put_num[abi:dee230102]<long long>(long long) /llvm-project/libcxx/include/__ostream/basic_ostream.h:104:21 (libc++.so.1+0x9b40c)
      #6 std::__1::basic_ostream<char, std::__1::char_traits<char>>::operator<<(long long) /llvm-project/libcxx/include/__ostream/basic_ostream.h:316:10 (libc++.so.1+0x9b2a0) (BuildId: 6e001266114c9106207bb18363e2d5a09b534306)
      #7 KernelLog::LogMessage(btck::LogEntry const&) /home/runner/work/_temp/src/bitcoin-chainstate.cpp:49:33 (bitcoin-chainstate+0xf2667) (BuildId: cff46198c8fd29997404a749cd55fdd6fcb3e865)

ACKs for top commit:
  fanquake:
    utACK fa3821e

Tree-SHA512: 383705fe33e429d40baaf7811a3edd6ce5164c423a1450c7a7a5d749d1ba44b8dac7a1270cbb593fcd0888dd9a2efbe7507650adf69b2f46ac09db4488cb9aec
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.

2 participants