Repository navigation
net_processing: process unique tx INVs only - #35878
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35878. ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
Concept ACK |
|
Makes sense. Concept ACK. |
|
Concept ACK Deduplicating identical tx announcements makes sense. |
l0rinc
left a comment
There was a problem hiding this comment.
I wasn't very familiar with this part of the codebase (let me know if my assessment is wrong), but it seems to me the txids and wtxids should be deduped separately.
| } | ||
|
|
||
| const bool reject_tx_invs{RejectIncomingTxs(pfrom)}; | ||
| std::unordered_set<uint256, SaltedUint256Hasher> seen_tx_hashes; |
There was a problem hiding this comment.
SaltedUint256Hasher is stateful now and it's recreated for most inv messages this way - including ones without a transaction announcement.
Could we keep one salt in PeerManagerImpl and copy it into each short-lived set?
(I considered the new SipHash-1-3-UJ here, but CInv::hash is peer-controlled and does not satisfy its jumbo-input assumptions, so I think we should keep SipHash-2-4)
reuse tx INV dedup salt
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index cbb248b7e5..e94dac73fb 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -844,6 +844,9 @@ private:
FastRandomContext m_rng GUARDED_BY(NetEventsInterface::g_msgproc_mutex);
+ const SaltedUint256Hasher m_txhash_hasher;
FeeFilterRounder m_fee_filter_rounder GUARDED_BY(NetEventsInterface::g_msgproc_mutex);
const CChainParams& m_chainparams;
@@ -4339,7 +4342,7 @@ void PeerManagerImpl::ProcessMessage(Peer& peer, CNode& pfrom, const std::string
}
const bool reject_tx_invs{RejectIncomingTxs(pfrom)};
- std::unordered_set<uint256, SaltedUint256Hasher> seen_tx_hashes;
+ std::unordered_set<uint256, SaltedUint256Hasher> seen_tx_hashes(0, m_txhash_hasher);
LOCK2(cs_main, m_tx_download_mutex);
There was a problem hiding this comment.
considered this before, but this is pushing me over the edge: I'll make one hasher and reuse it for both filter
There was a problem hiding this comment.
FWIW, I think that basically anywhere SipHash is used for hashtables (and thus we care about "ease of creating a large number of collisions" rather than "one collision is fatal"), we can move to SipHash-1-3. That may be all/almost all uses in the codebase except those specified by external standards (e.g. compact blocks).
The unpadded version can probably also be used almost everywhere, as we generally work with data whose length is self-descriptive.
Only the jumbo trick is subject to the "inputs must be self-computed hashes, not directly attacker-provided".
The new SipHashState structure makes it pretty easy to create more tailored versions wherever needed. It may not be worth the effort for many call-sites though, so this isn't a suggestion to go throughout the code and replace all siphash usage with -1-3 or -1-3-unpadded, but if performance is a consideration somewhere, it should be an easy choice.
| pfrom.fDisconnect = true; | ||
| return; | ||
| } | ||
| if (!seen_tx_hashes.insert(inv.hash).second) continue; |
There was a problem hiding this comment.
Shouldn't we deduplicate txids and wtxids separately to make sure one doesn't prohibit the other?
BIP144 says MSG_WITNESS_TX is only for use in getdata, but IsGenTxMsg() includes it, so this inv path currently processes it.
Is it intentional for a preceding MSG_WITNESS_TX to suppress a following MSG_WTX with the same hash before AddTxAnnouncement() sees it? Concretely, this is what I mean:
MSG_WITNESS_TX carries a txid, while MSG_WTX carries a wtxid
diff --git a/test/functional/p2p_tx_download.py b/test/functional/p2p_tx_download.py
--- a/test/functional/p2p_tx_download.py (revision c0355a8b183de8461f29814e992e677fb813417a)
+++ b/test/functional/p2p_tx_download.py (revision aec4caf0d946e97149009d6280277c159fdc8cb5)
@@ -16,6 +16,7 @@
CInv,
MSG_TX,
MSG_TYPE_MASK,
+ MSG_WITNESS_TX,
MSG_WTX,
msg_inv,
msg_notfound,
@@ -364,6 +365,16 @@
assert_equal(log.count(inv_a_log), 1)
assert_equal(log.count(inv_b_log), 0)
+ # MSG_WITNESS_TX carries a txid, while MSG_WTX carries a wtxid.
+ peer = node.add_p2p_connection(TestP2PConn(wtxidrelay=True))
+ hash_a = 0x778899
+ log = send_invs_and_read_log(peer, [
+ CInv(t=MSG_WITNESS_TX, h=hash_a),
+ CInv(t=MSG_WTX, h=hash_a),
+ ])
+ assert_equal(log.count(f"got inv: witness-tx {hash_a:064x}"), 1)
+ assert_equal(log.count(f"got inv: wtx {hash_a:064x}"), 1) # TODO fails currently
+
def test_spurious_notfound(self):
self.log.info('Check that spurious notfound is ignored')
self.nodes[0].p2ps[0].send_without_ping(msg_notfound(vec=[CInv(MSG_TX, 1)]))If so, we could probably fix it by having separate deduplication sets.
There was a problem hiding this comment.
good catch, even if it's a protocol violation I don't want to affect behavior. Added a second filter as you suggest
There was a problem hiding this comment.
I think a followup that does:
} else if (inv.IsGenTxMsg()) {
if (reject_tx_invs) { ...; return; }
if (peer.m_wtxid_relay) {
if (!inv.IsMsgWtx()) continue;
} else {
if (!inv.IsMsgTx()) continue;
}
...would make sense. (ie, move the ignore-wrong-invs into the GenTxMsg block, disconnect first, and ignore MSG_WITNESS_TX requests) I think not dropping MSG_WITNESS_TX's was just an oversight, ref: #18044 (comment)
There was a problem hiding this comment.
Shouldn't we deduplicate txids and wtxids separately to make sure one doesn't prohibit the other?
I don't think this makes sense -- if you have txA with txid X and txB with wtxid X, then either txA=txB and they don't have any witness data and deduping is fine, or you've found a hash collision and bitcoin's broken anyway. Alternatively, if your peer is lying to you advertising tx inv's where it doesn't have the corresponding tx and hoping to trick you into not requesting something that you actually want, they could equally well just ignore your request if you had actually made it, just as they'll have to ignore your request for the tx that doesn't actually exist.
There was a problem hiding this comment.
The relevant context seems to be the orphanage, where "the orphanage can store multiple transactions with the same txid", see
bitcoin/src/node/txdownloadman_impl.cpp
Lines 129 to 135 in 1278a59
It's a bit complicated for me, especially since BIP 144's restriction does not seem to be enforced here. If we ignored MSG_WITNESS_TX INVs, the separate sets would probably become unnecessary. Based on the reproducer and the AI explanations, though, it seems to me that either the separation or ignoring those INVs is currently needed for this change.
AI summary of the problem
The same witnessless transaction is enough for the two announcements to behave differently.
The txid form reaches
AlreadyHaveTx(), which finds the witnessless orphan and returns.
The wtxid form instead enters the orphan-resolution branch, which treats the peer as if it had announced every missing parent, even if those parent INVs were never sent.With a shared set, the preceding
MSG_WITNESS_TXsuppresses that second side effect, so the node loses this peer as a source for the orphan’s missing parents.The peer could ignore
getdata, but that applies to every transaction announcement and does not make these processing paths equivalent.If the follow-up ignores
MSG_WITNESS_TXINVs, the separate sets would indeed become unnecessary.
There was a problem hiding this comment.
@ajtowns for my part, I wanted to keep the (lack of) behavior changes simple to follow. I had thought that there was a "domain separation" due to the existing filtering of wtid/txid invs from above, but this wasn't strictly true.
Trying to keep this as re-viewable as possible for now. Agreed on followup!
There was a problem hiding this comment.
@instagibbs Yeah, that made so much sense to me it triggered my "doesn't need to be said" filter, oops.
There was a problem hiding this comment.
I considered that and had the same reaction as AJ. If you get a hit for wtxid == txid, this is a legacy transaction you've already seen so you should drop it.
There is no reason we should process conflicting advertisements for transactions, as they cannot be both accepted into our mempool. Avoid processing these and doing spurious work.
b11d8fc to
1278a59
Compare
|
ACK 1278a59 Don't think the separation between txids/wtxids is needed, but don't think it's harmful either. Not reseeding the hasher over time or between different peers also seems fine. |
| pfrom.fDisconnect = true; | ||
| return; | ||
| } | ||
| if (!seen_tx_hashes.insert(inv.hash).second) continue; |
There was a problem hiding this comment.
The relevant context seems to be the orphanage, where "the orphanage can store multiple transactions with the same txid", see
bitcoin/src/node/txdownloadman_impl.cpp
Lines 129 to 135 in 1278a59
It's a bit complicated for me, especially since BIP 144's restriction does not seem to be enforced here. If we ignored MSG_WITNESS_TX INVs, the separate sets would probably become unnecessary. Based on the reproducer and the AI explanations, though, it seems to me that either the separation or ignoring those INVs is currently needed for this change.
AI summary of the problem
The same witnessless transaction is enough for the two announcements to behave differently.
The txid form reaches
AlreadyHaveTx(), which finds the witnessless orphan and returns.
The wtxid form instead enters the orphan-resolution branch, which treats the peer as if it had announced every missing parent, even if those parent INVs were never sent.With a shared set, the preceding
MSG_WITNESS_TXsuppresses that second side effect, so the node loses this peer as a source for the orphan’s missing parents.The peer could ignore
getdata, but that applies to every transaction announcement and does not make these processing paths equivalent.If the follow-up ignores
MSG_WITNESS_TXINVs, the separate sets would indeed become unnecessary.
| auto& seen_hashes{inv.IsMsgWtx() ? seen_wtxids : seen_txids}; | ||
| if (!seen_hashes.insert(inv.hash).second) continue; | ||
| const GenTxid gtxid = ToGenTxid(inv); |
There was a problem hiding this comment.
nit: alternatively, to avoid duplicating inv.IsMsgWtx() in ToGenTxid, we could reuse gtxid:
const GenTxid gtxid{ToGenTxid(inv)};
auto& seen_hashes{gtxid.IsWtxid() ? seen_wtxids : seen_txids};
if (!seen_hashes.insert(gtxid.ToUint256()).second) continue;|
I don't think it's harmful, but it bugs me that we now unnecessarily duplicate our deduplication sets. Would reviewers here be interested in reviewing a small follow-up that restores this to a single set? |
Sure |
|
Chaser: #35917 |
|
Palate-cleanser? #35920 |
2fc9289 net_processing: process unique tx INVs only (Gregory Sanders) Pull request description: There is no reason we should process conflicting advertisements for transactions, as they cannot be both accepted into our mempool. Avoid processing these and doing spurious work. Should be no change in observable behavior. ACKs for top commit: ajtowns: ACK 2fc9289 fjahr: ACK 2fc9289 l0rinc: ACK 2fc9289 Tree-SHA512: c62ceed2cc634c8c99509a8495e5f9bb6d4d8d050942f709a6539ae4dfe1ec628ce7ab0ec1392656809e0d827d1fecf2e8fb9bb4600d13a5bf9a34c9e9e3ad6e
…: private broadcast, flatfile/sock/net fixes, tx INV dedup, asmap, tests bitcoin/pull/35878 bitcoin/pull/36312 bitcoin/pull/36309 bitcoin/pull/36665 bitcoin/pull/36667 bitcoin/pull/36669 bitcoin/pull/36199 bitcoin/pull/36201 bitcoin/pull/36177 bitcoin/pull/36218 bitcoin/pull/36045 bitcoin/pull/35937 bitcoin/pull/36599 bitcoin/pull/35168 bitcoin/pull/35914 bitcoin/pull/35978 bitcoin/pull/35908 bitcoin/pull/35928 bitcoin/pull/36377 - net_processing: process unique tx INVs only. - net: private broadcast peers are no longer discouraged; private broadcast is marked experimental and the docs/RPC help scope their claims. - flatfile/sock/net: file positions stored as 64-bit integers and 64-bit file positioning syscalls on Windows; exception monitoring aligned between poll() and select() backends; timeout interval enforced for paused send peers. - net: RFC 9637 IPv6 documentation range treated as invalid, embedded asmap updated. - proxy: network name case preserved in errors, "onion" used in help and examples. - build/test/doc: avoid pipe2 on Darwin, Boost.Test signal stacks, LSAN options, ibd_wtxid getdata flake, m_blocks_unlinked LoadBlockIndex coverage, unused variable cleanups, openrc script, NetBSD/macOS build docs, BIP 461 in bips.md. - release prep: example config updated for v31.2, version bumped to 31.3.0. All of these are in official bitcoin/bitcoin 31.x. Ported from bitcoin/bitcoin: bitcoin/bitcoin@1278a5970d -- net_processing: process unique tx INVs only (Gregory Sanders) bitcoin/bitcoin@eab6630add -- net: don't discourage private broadcast peers (Andrew Toth) bitcoin/bitcoin@2630d8e6c9 -- doc: scope claims about private broadcast feature (Greg Sanders) bitcoin/bitcoin@f413729983 -- private broadcast: mark feature as experimental (Greg Sanders) bitcoin/bitcoin@1e0c407377 -- sock: align exception monitoring between poll() and select() backends (Antoine Poinsot) bitcoin/bitcoin@cc2534cdf7 -- net: enforce timeout interval for paused send peers (Antoine Poinsot) bitcoin/bitcoin@17556cb1f5 -- flatfile: store position as a 64 bits integer (Antoine Poinsot) bitcoin/bitcoin@48092a9042 -- flatfile: use 64-bit file positioning syscalls in Windows (Antoine Poinsot) bitcoin/bitcoin@e6c775c6d6 -- net: treat RFC 9637 new IPv6 documentation range as invalid (Fabian Jahr) bitcoin/bitcoin@b48a27691d -- fuzz: assert invalid addresses are not routable (Fabian Jahr) bitcoin/bitcoin@3c91db262b -- net: Update embedded asmap to 1788801420 (Fabian Jahr) bitcoin/bitcoin@332c3e8e3e -- test: characterize proxy network name errors (Lőrinc) bitcoin/bitcoin@b0375749d4 -- refactor: share proxy network parsing (Lőrinc) bitcoin/bitcoin@fd65406b39 -- net: preserve network name case in proxy errors (Lőrinc) bitcoin/bitcoin@6c7c27f615 -- doc: use onion in proxy help and examples (Lőrinc) bitcoin/bitcoin@9c7748315d -- build: avoid pipe2 on Darwin (for now) (fanquake) bitcoin/bitcoin@9eba3aafa6 -- test: avoid undersized Boost.Test signal stacks (Lőrinc) bitcoin/bitcoin@fad9ab714b -- test: Append print_suppressions=0 to LSAN_OPTIONS, and suppress bitcoin-qt (MarcoFalke) bitcoin/bitcoin@7777598f87 -- test: Fix intermittent timeout waiting for ibd_wtxid getdata (MarcoFalke) bitcoin/bitcoin@3f44f9aef7 -- test: Add coverage for m_blocks_unlinked invariant in LoadBlockIndex (marcofleon) bitcoin/bitcoin@da58e55986 -- test, refactor: Remove unused `warnings` in `wallet/test/util.cpp` (Hennadii Stepanov) bitcoin/bitcoin@fc28914de4 -- fuzz, refactor: Remove unused `linearization` in `cluster_linearize.cpp` (Hennadii Stepanov) bitcoin/bitcoin@3df0d067ad -- fuzz, refactor: Remove unused `random_string` in `locale.cpp` (Hennadii Stepanov) bitcoin/bitcoin@b7ae50e2e2 -- fuzz, refactor: Remove unused `header` in `p2p_transport_serialization.cpp` (Hennadii Stepanov) bitcoin/bitcoin@e50f422d25 -- test, refactor: Remove unused variables in `test/rbf_tests.cpp` (Hennadii Stepanov) bitcoin/bitcoin@e550945a39 -- test, refactor: Remove unused `removed_refs` in `txgraph_tests.cpp` (Hennadii Stepanov) bitcoin/bitcoin@422f1bd92f -- test, refactor: Remove unused `utxo_pool` in `coinselector_tests.cpp` (Hennadii Stepanov) bitcoin/bitcoin@3175d57628 -- test, refactor: Remove unused `error` in `wallet_tests.cpp` (Hennadii Stepanov) bitcoin/bitcoin@d837bb38a4 -- contrib/init: fix unused variables in openrc script (jpk68) bitcoin/bitcoin@9b85c9814d -- doc: Drop GCC upgrade instructions for NetBSD (Hennadii Stepanov) bitcoin/bitcoin@5964c7229f -- doc: Switch `pkg-config` package to modern `pkgconf` on NetBSD (Hennadii Stepanov) bitcoin/bitcoin@222855ed11 -- doc: mention -DWITH_ZMQ=ON in macOS build guide (cyb3ralbert) bitcoin/bitcoin@d57346d682 -- doc: add 461 (Deterministic ECDSA signatures with low-R grinding) to bips.md (Sebastian Falbesoner) bitcoin/bitcoin@a48dd277ed -- doc: update example bitcoin.conf for v31.2 (fanquake) bitcoin/bitcoin@bb5978023d -- build: bump version to v31.3 (fanquake) Tree-SHA512: 91cbd45c614b2ea1bfbc47dbb66192ea61602b426dcd97c0a6851198969a86347b33e69852f0592131ae01e32ac0e76a4a90f2403eab934909116f664a2025fa
…ep): private broadcast, versionbits, flatfile/sock/net fixes, tx INV dedup, asmap, tests bitcoin/bitcoin/pull/35406 bitcoin/bitcoin/pull/35678 bitcoin/bitcoin/pull/35679 bitcoin/bitcoin/pull/35766 bitcoin/bitcoin/pull/35769 bitcoin/bitcoin/pull/34779 bitcoin/bitcoin/pull/35878 bitcoin/bitcoin/pull/36312 bitcoin/bitcoin/pull/36309 bitcoin/bitcoin/pull/36665 bitcoin/bitcoin/pull/36667 bitcoin/bitcoin/pull/36669 bitcoin/bitcoin/pull/36199 bitcoin/bitcoin/pull/36201 bitcoin/bitcoin/pull/36177 bitcoin/bitcoin/pull/36218 bitcoin/bitcoin/pull/36045 bitcoin/bitcoin/pull/35937 bitcoin/bitcoin/pull/36599 bitcoin/bitcoin/pull/35168 bitcoin/bitcoin/pull/35914 bitcoin/bitcoin/pull/35978 bitcoin/bitcoin/pull/35908 bitcoin/bitcoin/pull/35928 bitcoin/bitcoin/pull/36377 - private broadcast: outstanding txs limited to 10,000 with a new RPC_LIMIT_EXCEEDED error code, cs_main released between individual tx re-attempts, peers are no longer discouraged, feature marked experimental and docs/RPC help scope their claims. - versionbits: live activation params and activation warnings limited per BIP 323, with test coverage and doc updates. - net_processing: process unique tx INVs only. - p2p: assume v2transport for addresses from seeds. - flatfile/sock/net: file positions stored as 64-bit integers and 64-bit file positioning syscalls on Windows; exception monitoring aligned between poll() and select() backends; timeout interval enforced for paused send peers. - net: RFC 9637 IPv6 documentation range treated as invalid, embedded asmap updated. - proxy: network name case preserved in errors, "onion" used in help and examples. - depends/build/test/doc: zeromq upstream patch, avoid pipe2 on Darwin, Boost.Test signal stacks, LSAN options, ibd_wtxid getdata flake, m_blocks_unlinked LoadBlockIndex coverage, fuzz Serialize/Deserialize cleanups, unused variable cleanups, openrc script, NetBSD/macOS build docs, BIP 323/461 in bips.md. - release prep: example config updated for v31.2, version bumped to 31.3.0. All of these are in official bitcoin/bitcoin 31.x. Ported from bitcoin/bitcoin: bitcoin/bitcoin@5aea3d0373 -- private broadcast: limit outstanding txs to count of 10,000 (Gregory Sanders) bitcoin/bitcoin@cbf8c107c1 -- Release cs_main between individual private tx re-attempts (Greg Sanders) bitcoin/bitcoin@82a02a2a22 -- rpc: define and use new RPC_LIMIT_EXCEEDED error code (stickies-v) bitcoin/bitcoin@efa7f8c143 -- fuzz: Remove unused `DeserializeFromFuzzingInput` params overload (Hennadii Stepanov) bitcoin/bitcoin@afab8d4225 -- fuzz, refactor: Remove `Serialize` overload (Hennadii Stepanov) bitcoin/bitcoin@cf0f2aeae0 -- p2p: Assume v2transport for addresses from seeds (Martin Zumsande) bitcoin/bitcoin@e446ea09c4 -- depends, zeromq: Apply upstream patch (Hennadii Stepanov) bitcoin/bitcoin@f802edf57c -- versionbits: Limit live activation params and activation warnings per BIP323 (Anthony Towns) bitcoin/bitcoin@1d5240574a -- qa: test we don't warn for ignored unknown version bits deployments (Antoine Poinsot) bitcoin/bitcoin@107d4178d9 -- versionbits: update VersionBitsCache doc comment to match current behaviour (Antoine Poinsot) bitcoin/bitcoin@94e3ac0b21 -- doc: bips doc update (release notes part not ported) (Antoine Poinsot) bitcoin/bitcoin@1278a5970d -- net_processing: process unique tx INVs only (Gregory Sanders) bitcoin/bitcoin@eab6630add -- net: don't discourage private broadcast peers (Andrew Toth) bitcoin/bitcoin@2630d8e6c9 -- doc: scope claims about private broadcast feature (Greg Sanders) bitcoin/bitcoin@f413729983 -- private broadcast: mark feature as experimental (Greg Sanders) bitcoin/bitcoin@1e0c407377 -- sock: align exception monitoring between poll() and select() backends (Antoine Poinsot) bitcoin/bitcoin@cc2534cdf7 -- net: enforce timeout interval for paused send peers (Antoine Poinsot) bitcoin/bitcoin@17556cb1f5 -- flatfile: store position as a 64 bits integer (Antoine Poinsot) bitcoin/bitcoin@48092a9042 -- flatfile: use 64-bit file positioning syscalls in Windows (Antoine Poinsot) bitcoin/bitcoin@e6c775c6d6 -- net: treat RFC 9637 new IPv6 documentation range as invalid (Fabian Jahr) bitcoin/bitcoin@b48a27691d -- fuzz: assert invalid addresses are not routable (Fabian Jahr) bitcoin/bitcoin@3c91db262b -- net: Update embedded asmap to 1788801420 (Fabian Jahr) bitcoin/bitcoin@332c3e8e3e -- test: characterize proxy network name errors (Lőrinc) bitcoin/bitcoin@b0375749d4 -- refactor: share proxy network parsing (Lőrinc) bitcoin/bitcoin@fd65406b39 -- net: preserve network name case in proxy errors (Lőrinc) bitcoin/bitcoin@6c7c27f615 -- doc: use onion in proxy help and examples (Lőrinc) bitcoin/bitcoin@9c7748315d -- build: avoid pipe2 on Darwin (for now) (fanquake) bitcoin/bitcoin@9eba3aafa6 -- test: avoid undersized Boost.Test signal stacks (Lőrinc) bitcoin/bitcoin@fad9ab714b -- test: Append print_suppressions=0 to LSAN_OPTIONS, and suppress bitcoin-qt (MarcoFalke) bitcoin/bitcoin@7777598f87 -- test: Fix intermittent timeout waiting for ibd_wtxid getdata (MarcoFalke) bitcoin/bitcoin@3f44f9aef7 -- test: Add coverage for m_blocks_unlinked invariant in LoadBlockIndex (marcofleon) bitcoin/bitcoin@da58e55986 -- test, refactor: Remove unused `warnings` in `wallet/test/util.cpp` (Hennadii Stepanov) bitcoin/bitcoin@fc28914de4 -- fuzz, refactor: Remove unused `linearization` in `cluster_linearize.cpp` (Hennadii Stepanov) bitcoin/bitcoin@3df0d067ad -- fuzz, refactor: Remove unused `random_string` in `locale.cpp` (Hennadii Stepanov) bitcoin/bitcoin@b7ae50e2e2 -- fuzz, refactor: Remove unused `header` in `p2p_transport_serialization.cpp` (Hennadii Stepanov) bitcoin/bitcoin@e50f422d25 -- test, refactor: Remove unused variables in `test/rbf_tests.cpp` (Hennadii Stepanov) bitcoin/bitcoin@e550945a39 -- test, refactor: Remove unused `removed_refs` in `txgraph_tests.cpp` (Hennadii Stepanov) bitcoin/bitcoin@422f1bd92f -- test, refactor: Remove unused `utxo_pool` in `coinselector_tests.cpp` (Hennadii Stepanov) bitcoin/bitcoin@3175d57628 -- test, refactor: Remove unused `error` in `wallet_tests.cpp` (Hennadii Stepanov) bitcoin/bitcoin@d837bb38a4 -- contrib/init: fix unused variables in openrc script (jpk68) bitcoin/bitcoin@9b85c9814d -- doc: Drop GCC upgrade instructions for NetBSD (Hennadii Stepanov) bitcoin/bitcoin@5964c7229f -- doc: Switch `pkg-config` package to modern `pkgconf` on NetBSD (Hennadii Stepanov) bitcoin/bitcoin@222855ed11 -- doc: mention -DWITH_ZMQ=ON in macOS build guide (cyb3ralbert) bitcoin/bitcoin@d57346d682 -- doc: add 461 (Deterministic ECDSA signatures with low-R grinding) to bips.md (Sebastian Falbesoner) bitcoin/bitcoin@a48dd277ed -- doc: update example bitcoin.conf for v31.2 (fanquake) bitcoin/bitcoin@bb5978023d -- build: bump version to v31.3 (fanquake) Local adjustments (not from upstream): - node/blockstorage.cpp: BACKPORT comment for the m_blocks_unlinked dedup corrected; the BLOCK_HAVE_DATA guard is already in official 31.x, only the AddUnlinkedBlock dedup remains unmerged. - test/util/time.h: typo fixed in the FakeNodeClock BACKPORT comment. - private_broadcast.h: removed the stale BACKPORT marker for the TxSendStatus changes, now in official 31.x. Tree-SHA512: 0afeda49b755a50ff21487839b8bc8da6010136a0431ac9015aa3bd9106721a88a6d86aa8607a282c92f61757a4bf7959ab28d049276d09b8429f84c1e7e4066
…prep): private broadcast, versionbits, flatfile/sock/net fixes, tx INV dedup, asmap, tests bitcoin/bitcoin/pull/35406 bitcoin/bitcoin/pull/35678 bitcoin/bitcoin/pull/35679 bitcoin/bitcoin/pull/35766 bitcoin/bitcoin/pull/35769 bitcoin/bitcoin/pull/34779 bitcoin/bitcoin/pull/35878 bitcoin/bitcoin/pull/36312 bitcoin/bitcoin/pull/36309 bitcoin/bitcoin/pull/36665 bitcoin/bitcoin/pull/36667 bitcoin/bitcoin/pull/36669 bitcoin/bitcoin/pull/36199 bitcoin/bitcoin/pull/36201 bitcoin/bitcoin/pull/36177 bitcoin/bitcoin/pull/36218 bitcoin/bitcoin/pull/36045 bitcoin/bitcoin/pull/35937 bitcoin/bitcoin/pull/36599 bitcoin/bitcoin/pull/35168 bitcoin/bitcoin/pull/35914 bitcoin/bitcoin/pull/35978 bitcoin/bitcoin/pull/35908 bitcoin/bitcoin/pull/35928 bitcoin/bitcoin/pull/36377 - private broadcast: outstanding txs limited to 10,000 with a new RPC_LIMIT_EXCEEDED error code, cs_main released between individual tx re-attempts, peers are no longer discouraged, feature marked experimental and docs/RPC help scope their claims. - versionbits: live activation params and activation warnings limited per BIP 323, with test coverage and doc updates. - net_processing: process unique tx INVs only. - p2p: assume v2transport for addresses from seeds. - flatfile/sock/net: file positions stored as 64-bit integers and 64-bit file positioning syscalls on Windows; exception monitoring aligned between poll() and select() backends; timeout interval enforced for paused send peers. - net: RFC 9637 IPv6 documentation range treated as invalid, embedded asmap updated. - proxy: network name case preserved in errors, "onion" used in help and examples. - depends/build/test/doc: zeromq upstream patch, avoid pipe2 on Darwin, Boost.Test signal stacks, LSAN options, ibd_wtxid getdata flake, m_blocks_unlinked LoadBlockIndex coverage, fuzz Serialize/Deserialize cleanups, unused variable cleanups, openrc script, NetBSD/macOS build docs, BIP 323/461 in bips.md. - release prep: example config updated for v31.2, version bumped to 31.3.0. All of these are in official bitcoin/bitcoin 31.x. Ported from bitcoin/bitcoin: bitcoin/bitcoin@5aea3d0373 -- private broadcast: limit outstanding txs to count of 10,000 (Gregory Sanders) bitcoin/bitcoin@cbf8c107c1 -- Release cs_main between individual private tx re-attempts (Greg Sanders) bitcoin/bitcoin@82a02a2a22 -- rpc: define and use new RPC_LIMIT_EXCEEDED error code (stickies-v) bitcoin/bitcoin@efa7f8c143 -- fuzz: Remove unused `DeserializeFromFuzzingInput` params overload (Hennadii Stepanov) bitcoin/bitcoin@afab8d4225 -- fuzz, refactor: Remove `Serialize` overload (Hennadii Stepanov) bitcoin/bitcoin@cf0f2aeae0 -- p2p: Assume v2transport for addresses from seeds (Martin Zumsande) bitcoin/bitcoin@e446ea09c4 -- depends, zeromq: Apply upstream patch (Hennadii Stepanov) bitcoin/bitcoin@f802edf57c -- versionbits: Limit live activation params and activation warnings per BIP323 (Anthony Towns) bitcoin/bitcoin@1d5240574a -- qa: test we don't warn for ignored unknown version bits deployments (Antoine Poinsot) bitcoin/bitcoin@107d4178d9 -- versionbits: update VersionBitsCache doc comment to match current behaviour (Antoine Poinsot) bitcoin/bitcoin@94e3ac0b21 -- doc: bips doc update (release notes part not ported) (Antoine Poinsot) bitcoin/bitcoin@1278a5970d -- net_processing: process unique tx INVs only (Gregory Sanders) bitcoin/bitcoin@eab6630add -- net: don't discourage private broadcast peers (Andrew Toth) bitcoin/bitcoin@2630d8e6c9 -- doc: scope claims about private broadcast feature (Greg Sanders) bitcoin/bitcoin@f413729983 -- private broadcast: mark feature as experimental (Greg Sanders) bitcoin/bitcoin@1e0c407377 -- sock: align exception monitoring between poll() and select() backends (Antoine Poinsot) bitcoin/bitcoin@cc2534cdf7 -- net: enforce timeout interval for paused send peers (Antoine Poinsot) bitcoin/bitcoin@17556cb1f5 -- flatfile: store position as a 64 bits integer (Antoine Poinsot) bitcoin/bitcoin@48092a9042 -- flatfile: use 64-bit file positioning syscalls in Windows (Antoine Poinsot) bitcoin/bitcoin@e6c775c6d6 -- net: treat RFC 9637 new IPv6 documentation range as invalid (Fabian Jahr) bitcoin/bitcoin@b48a27691d -- fuzz: assert invalid addresses are not routable (Fabian Jahr) bitcoin/bitcoin@3c91db262b -- net: Update embedded asmap to 1788801420 (Fabian Jahr) bitcoin/bitcoin@332c3e8e3e -- test: characterize proxy network name errors (Lőrinc) bitcoin/bitcoin@b0375749d4 -- refactor: share proxy network parsing (Lőrinc) bitcoin/bitcoin@fd65406b39 -- net: preserve network name case in proxy errors (Lőrinc) bitcoin/bitcoin@6c7c27f615 -- doc: use onion in proxy help and examples (Lőrinc) bitcoin/bitcoin@9c7748315d -- build: avoid pipe2 on Darwin (for now) (fanquake) bitcoin/bitcoin@9eba3aafa6 -- test: avoid undersized Boost.Test signal stacks (Lőrinc) bitcoin/bitcoin@fad9ab714b -- test: Append print_suppressions=0 to LSAN_OPTIONS, and suppress bitcoin-qt (MarcoFalke) bitcoin/bitcoin@7777598f87 -- test: Fix intermittent timeout waiting for ibd_wtxid getdata (MarcoFalke) bitcoin/bitcoin@3f44f9aef7 -- test: Add coverage for m_blocks_unlinked invariant in LoadBlockIndex (marcofleon) bitcoin/bitcoin@da58e55986 -- test, refactor: Remove unused `warnings` in `wallet/test/util.cpp` (Hennadii Stepanov) bitcoin/bitcoin@fc28914de4 -- fuzz, refactor: Remove unused `linearization` in `cluster_linearize.cpp` (Hennadii Stepanov) bitcoin/bitcoin@3df0d067ad -- fuzz, refactor: Remove unused `random_string` in `locale.cpp` (Hennadii Stepanov) bitcoin/bitcoin@b7ae50e2e2 -- fuzz, refactor: Remove unused `header` in `p2p_transport_serialization.cpp` (Hennadii Stepanov) bitcoin/bitcoin@e50f422d25 -- test, refactor: Remove unused variables in `test/rbf_tests.cpp` (Hennadii Stepanov) bitcoin/bitcoin@e550945a39 -- test, refactor: Remove unused `removed_refs` in `txgraph_tests.cpp` (Hennadii Stepanov) bitcoin/bitcoin@422f1bd92f -- test, refactor: Remove unused `utxo_pool` in `coinselector_tests.cpp` (Hennadii Stepanov) bitcoin/bitcoin@3175d57628 -- test, refactor: Remove unused `error` in `wallet_tests.cpp` (Hennadii Stepanov) bitcoin/bitcoin@d837bb38a4 -- contrib/init: fix unused variables in openrc script (jpk68) bitcoin/bitcoin@9b85c9814d -- doc: Drop GCC upgrade instructions for NetBSD (Hennadii Stepanov) bitcoin/bitcoin@5964c7229f -- doc: Switch `pkg-config` package to modern `pkgconf` on NetBSD (Hennadii Stepanov) bitcoin/bitcoin@222855ed11 -- doc: mention -DWITH_ZMQ=ON in macOS build guide (cyb3ralbert) bitcoin/bitcoin@d57346d682 -- doc: add 461 (Deterministic ECDSA signatures with low-R grinding) to bips.md (Sebastian Falbesoner) bitcoin/bitcoin@a48dd277ed -- doc: update example bitcoin.conf for v31.2 (fanquake) bitcoin/bitcoin@bb5978023d -- build: bump version to v31.3 (fanquake) Local adjustments (not from upstream): - node/blockstorage.cpp: BACKPORT comment for the m_blocks_unlinked dedup corrected; the BLOCK_HAVE_DATA guard is already in official 31.x, only the AddUnlinkedBlock dedup remains unmerged. - test/util/time.h: typo fixed in the FakeNodeClock BACKPORT comment. - private_broadcast.h: removed the stale BACKPORT marker for the TxSendStatus changes, now in official 31.x. Tree-SHA512: 0afeda49b755a50ff21487839b8bc8da6010136a0431ac9015aa3bd9106721a88a6d86aa8607a282c92f61757a4bf7959ab28d049276d09b8429f84c1e7e4066
There is no reason we should process conflicting advertisements for transactions, as they cannot be both accepted into our mempool. Avoid processing these and doing spurious work. Adapted: uses SaltedTxidHasher, since SaltedUint256Hasher does not exist before 30.x. Both hash a uint256 with SipHash and a random salt. Github-Pull: bitcoin#35878 Rebased-From: 1278a59
Summary: ``` There is no reason we should process conflicting advertisements for transactions, as they cannot be both accepted into our mempool. Avoid processing these and doing spurious work. ``` Backport of [[bitcoin/bitcoin#35878 | core#35878]]. Test Plan: ninja all check-all Reviewers: #bitcoin_abc, PiRK Reviewed By: #bitcoin_abc, PiRK Differential Revision: https://reviews.bitcoinabc.org/D21164
There is no reason we should process conflicting advertisements for transactions, as they cannot be both accepted into our mempool. Avoid processing these and doing spurious work. Github-Pull: bitcoin#35878 Rebased-From: 1278a59
There is no reason we should process conflicting advertisements for transactions, as they cannot be both accepted into our mempool. Avoid processing these and doing spurious work. Github-Pull: bitcoin/bitcoin#35878 Rebased-From: 1278a5970d5ada0979052a5bad899e896b8ab40b (cherry picked from commit 6814e0a)
Plumb 13 adds one fix to plumb12, bitcoin/bitcoin#35878 as Knots carries it, for CVE-2026-117348: a peer could stall the node with an orphan transaction and inv messages that repeat it. Against plumb12, bitcoind -help differs only in its version line, so no option or default changed and the settings stay as they are. The plumb12 binaries leave the image, so AVAILABLE_BITCOIN_KNOTS_VERSIONS holds plumb13 alone. A Plumb Version pinned to plumb12 moves to latest at startup through migrateUnavailableVersion, with no code change. Checked on amd64: the build's signature stage against the plumb13 SHA256SUMS, bitcoind and bitcoin-cli in the image byte for byte the ones in the signed tarball, and a fresh regtest start (/Satoshi:29.5.0/Knots:20260508/Plumb:13/, the five filters on, data size 42 and cost 2). The signature stage built for arm64 checks the aarch64 tarball the same way. A settings.json pinned to plumb12 moves to latest with bitcoind running, and a plumb12 install started on this image keeps its chain and settings.
plumb13 is built on Bitcoin Knots 29.5, as plumb12 was, and adds one fix, bitcoin/bitcoin#35878 as Knots carries it, for CVE-2026-117348: a peer could stall a node by sending it an orphan with many missing parents, then inv messages that repeat its wtxid 50,000 times. No consensus rule, filter, option or default changed. tools/bump-plumb.sh made the change after it checked the signature by 89F0 on SHA256SUMS, both tarballs against it, and the version lines of the x86_64 binaries. Tested on this tree: the installer suite, 65 tests, passes, including installs of plumb13 from the live release, the aarch64 one with its bitcoind's version check run under QEMU. Installs made by v0.2.10 with plumb12, by v0.2.9 with plumb11 and by v0.2.8 with plumb10, each upgraded by rerunning install.sh, got plumb13, wrote their config files and units byte for byte as before, and kept the regtest chain I had mined on them. On that chain the plumb13 node gave the gateway's login a block template and refused it a call not on its list, and the gateway, run by hand in solo mode, gave a test miner work and new work after a block. Run on regtest with the bitcoin.conf the installer wrote for it, the plumb13 node of a new install and each of the three upgraded ones reported /Satoshi:29.5.0/Knots:20260508/Plumb:13/ and logged at startup the same five filters as plumb12, all on. The fix is tested in Plumb: on the plumb13 tag's tree, 305 functional tests passed, 65 were skipped and none failed, with p2p_tx_download.py and its new duplicate inv cases among those that passed. On regtest, with an orphan that has 2,400 missing parents and inv messages that each name it 50,000 times, the longest getblockcount call took 20.6 s on plumb12 and 0.001 s on plumb13.
Plumb 13 adds one fix to plumb12, bitcoin/bitcoin#35878 as Knots carries it, for CVE-2026-117348. It changes no option or default, so the description and the app's settings stay as they are. The image is built by GitHub Actions from the signed tag on plumb-node/umbrel-plumb and pinned here by its index digest.
…s only Fixes CVE-2026-117348 (node stall through duplicate orphan announcements). When a peer announces a transaction by wtxid that is in the orphanage, AddTxAnnouncement builds the orphan's unique parent list and checks each parent against the mempool and the recent-transaction filters. A single inv message can carry up to 50,000 entries and duplicates were not skipped, so a peer could send an orphan with thousands of missing parents and then repeat its wtxid 50,000 times per inv, stalling message processing (including blocks) for many seconds per message. Process each transaction announced in an inv message only once. txids (MSG_TX / MSG_WITNESS_TX) and wtxids (MSG_WTX) are deduplicated separately, and the filter is scoped to a single inv message. This branch has no SaltedUint256Hasher, so use SaltedTxidHasher, which hashes a uint256 here. Upstream: bitcoin/bitcoin#35878 Advisory: https://bitcoincore.org/en/2026/11/20/disclose-orphan-inv-stall/ Co-Authored-By: Claude Fable 5.2 <[email protected]>
…s only Fixes CVE-2026-117348 (node stall through duplicate orphan announcements). When a peer announces a transaction by wtxid that is in the orphanage, AddTxAnnouncement builds the orphan's unique parent list and checks each parent against the mempool and the recent-transaction filters. A single inv message can carry up to 50,000 entries and duplicates were not skipped, so a peer could send an orphan with thousands of missing parents and then repeat its wtxid 50,000 times per inv, stalling message processing (including blocks) for many seconds per message. Process each transaction announced in an inv message only once. txids (MSG_TX / MSG_WITNESS_TX) and wtxids (MSG_WTX) are deduplicated separately, and the filter is scoped to a single inv message. This branch has no SaltedUint256Hasher, so use SaltedTxidHasher, which hashes a uint256 here. Upstream: bitcoin/bitcoin#35878 Advisory: https://bitcoincore.org/en/2026/11/20/disclose-orphan-inv-stall/ Co-Authored-By: Claude Fable 5.2 <[email protected]>
The knots choice now installs Bitcoin Knots 29.5.1 in place of 29.5. Knots tagged it on 2026-11-21, signed by Luke Dashjr's release key 1A3E. Among its fixes is the one for CVE-2026-117348 (bitcoin/bitcoin#35878): a peer could stall a node by sending it an orphan with many missing parents, then inv messages that repeat its wtxid 50,000 times. See its release notes for other changes. Changed by hand, since there is no bump tool for Knots, after the checks tools/bump-plumb.sh makes for Plumb: the signature by 1A3E on SHA256SUMS, in a keyring of its own with the key from KNOTS_KEY_URL, the x86_64 and aarch64 linux-gnu tarballs against the list, and the version lines of the x86_64 binaries. Tested with the next three commits in place: the installer suite, 88 tests, passes, including an install of Knots 29.5.1 from bitcoinknots.org, INSTALL.md's Knots commands as written, and Knots and Plumb taking turns on one regtest data directory. An install made by v0.2.11 with Knots 29.5, upgraded by rerunning install.sh, got 29.5.1, wrote its config files and units byte for byte as before, and kept the regtest chain I had mined on it. On that chain the 29.5.1 node gave the gateway's login a block template and refused it a call not on its list, and the gateway, run by hand in solo mode, gave a test miner work and new work after a block.
…s only (#100) Fixes CVE-2026-117348 (node stall through duplicate orphan announcements). When a peer announces a transaction by wtxid that is in the orphanage, AddTxAnnouncement builds the orphan's unique parent list and checks each parent against the mempool and the recent-transaction filters. A single inv message can carry up to 50,000 entries and duplicates were not skipped, so a peer could send an orphan with thousands of missing parents and then repeat its wtxid 50,000 times per inv, stalling message processing (including blocks) for many seconds per message. Process each transaction announced in an inv message only once. txids (MSG_TX / MSG_WITNESS_TX) and wtxids (MSG_WTX) are deduplicated separately, and the filter is scoped to a single inv message. This branch has no SaltedUint256Hasher, so use SaltedTxidHasher, which hashes a uint256 here. Upstream: bitcoin/bitcoin#35878 Advisory: https://bitcoincore.org/en/2026/11/20/disclose-orphan-inv-stall/ Co-authored-by: Shuning Hong <[email protected]> Co-authored-by: Claude Fable 5.2 <[email protected]>
Skip repeated transaction announcements within one inv message, as in Bitcoin Core (bitcoin/bitcoin#35878). Adds the functional test, the v4.0.7 changelog and bumps the version to 4.0.7.
…s only Fixes CVE-2026-117348 (node stall through duplicate orphan announcements). When a peer announces a transaction by wtxid that is in the orphanage, AddTxAnnouncement builds the orphan's unique parent list and checks each parent against the mempool and the recent-transaction filters. A single inv message can carry up to 50,000 entries and duplicates were not skipped, so a peer could send an orphan with thousands of missing parents and then repeat its wtxid 50,000 times per inv, stalling message processing (including blocks) for many seconds per message. Process each transaction announced in an inv message only once. txids (MSG_TX / MSG_WITNESS_TX) and wtxids (MSG_WTX) are deduplicated separately, and the filter is scoped to a single inv message. This branch has no SaltedUint256Hasher, so use SaltedTxidHasher, which hashes a uint256 here. Upstream: bitcoin/bitcoin#35878 Advisory: https://bitcoincore.org/en/2026/11/20/disclose-orphan-inv-stall/ Co-Authored-By: Claude Fable 5.2 <[email protected]>
…s only Fixes CVE-2026-117348 (node stall through duplicate orphan announcements). When a peer announces a transaction by wtxid that is in the orphanage, AddTxAnnouncement builds the orphan's unique parent list and checks each parent against the mempool and the recent-transaction filters. A single inv message can carry up to 50,000 entries and duplicates were not skipped, so a peer could send an orphan with thousands of missing parents and then repeat its wtxid 50,000 times per inv, stalling message processing (including blocks) for many seconds per message. Process each transaction announced in an inv message only once. txids (MSG_TX / MSG_WITNESS_TX) and wtxids (MSG_WTX) are deduplicated separately, and the filter is scoped to a single inv message. This branch has no SaltedUint256Hasher, so use SaltedTxidHasher, which hashes a uint256 here. Upstream: bitcoin/bitcoin#35878 Advisory: https://bitcoincore.org/en/2026/11/20/disclose-orphan-inv-stall/ Co-Authored-By: Claude Fable 5.2 <[email protected]>
…s only (#101) Fixes CVE-2026-117348 (node stall through duplicate orphan announcements). When a peer announces a transaction by wtxid that is in the orphanage, AddTxAnnouncement builds the orphan's unique parent list and checks each parent against the mempool and the recent-transaction filters. A single inv message can carry up to 50,000 entries and duplicates were not skipped, so a peer could send an orphan with thousands of missing parents and then repeat its wtxid 50,000 times per inv, stalling message processing (including blocks) for many seconds per message. Process each transaction announced in an inv message only once. txids (MSG_TX / MSG_WITNESS_TX) and wtxids (MSG_WTX) are deduplicated separately, and the filter is scoped to a single inv message. This branch has no SaltedUint256Hasher, so use SaltedTxidHasher, which hashes a uint256 here. Upstream: bitcoin/bitcoin#35878 Advisory: https://bitcoincore.org/en/2026/11/20/disclose-orphan-inv-stall/ Co-authored-by: Shuning Hong <[email protected]> Co-authored-by: Claude Fable 5.2 <[email protected]>
…oin#35878) Transaction hashes already seen in the same inv message are skipped. Upstream commit: 1bb5289d4 (30.x; master 1278a5970). BCH2 adaptation: upstream keeps separate txid and wtxid sets. After the fork a txid is its wtxid, and before it a txid can only equal another transaction's wtxid through a hash collision, so a single set is used. Test: p2p_tx_download.py.
There is no reason we should process conflicting advertisements for transactions, as they cannot be both accepted into our mempool. Avoid processing these and doing spurious work. Github-Pull: bitcoin/bitcoin#35878 Rebased-From: 1278a5970d5ada0979052a5bad899e896b8ab40b (cherry picked from commit 6814e0ae57941222c89757c6b669fca86c71a54e)
Upgrades the bundled Bitcoin Knots Cash binary to the official v0.2.2-xbtc release, which backports bitcoin/bitcoin#35878 (process unique tx INVs only) to fix CVE-2026-117348 — a remote DoS where a peer stalls the node by repeating orphan-tx INVs under cs_main. Node-local fix: no consensus change, no reindex, no resync. Also hardens the build: the Dockerfile now verifies the downloaded tarball's SHA256 against the release's published SHA256SUMS (6d62b9afd846b8b40abbf2a9c049bba972d34d5d994142306292a2a15ec53bb3) before installing, instead of trusting an unauthenticated curl. - Dockerfile: XBTC_RELEASE v0.2.2-xbtc + XBTC_SHA256 check - build-images.yml: bump CI build-arg/tag defaults to v0.2.2-xbtc - docker-compose.yml: pin image :v0.2.2-xbtc - umbrel-app.yml: version v0.2.2-xbtc + security release notes - README: reference + checksum note Co-Authored-By: Claude Opus 4.8 <[email protected]>
… 64-bit file positions, paused send timeout, duplicate INVs (#296) * sock: align exception monitoring between poll() and select() backends The select() backend, which Windows and macOS use, put every socket into the exception set, whatever was asked of it. A peer whose receive side is paused is waited on for sending only, and TCP urgent data then showed as an error event; the socket handler reads on an error event, so the pause did not hold and what was read was kept without bound. poll(), which Linux uses, has no such case. The exception set is now filled only for a socket that is waited on for reading, and a socket nothing is asked of is left out of the call. Backport of Bitcoin Core 30.4 commit d4a065bf0fab, by Antoine Poinsot. Github-Pull: bitcoin/bitcoin#36665 Rebased-From: 1e0c407377034e9cbb4d52f1f534c06cdf202a36 * net: only use the select error set while connecting After the change before this one a socket waited on for reading is still in the exception set of select(). With urgent data pending on it the wait returns at once, every time, with nothing for recv() to return: the socket handler spins for as long as the byte is there. Windows needs the exception set for one thing, a failed non-blocking connect(), which it reports nowhere else. So ERR becomes an event that can be asked for, ConnectToSocket() asks for it, and every other wait leaves the set empty. With select() a socket waited on without ERR no longer reports exceptional conditions; a closed or failed connection is seen by the read that follows, as before. No change with poll(). The Stratum v2 listener disconnects a client on ERR. On Windows and macOS it now finds a broken connection through recv(), like the P2P handler. A unit test sends an urgent byte and checks that a wait for reading does not report an error. Run on Linux with sock.cpp built for select(): it fails on the code as it was and on the change before this one, and passes here. Port of Bitcoin Core commit 97e3c9562, by Cory Fields, Vasil Dimov and Antoine Poinsot, to the event names of 30.x. Github-Pull: bitcoin/bitcoin#36716 Rebased-From: 97e3c9562291f5bbc2b03fef1c70e4975eb2a8c6 * flatfile: store positions as 64-bit integers A position in a block or undo file was an unsigned int. Block files are capped at 128 MiB, undo files are not: the undo data of the blocks of one block file go into one undo file, and blocks that spend many large outputs have far more undo data than block data. Past 4 GiB the position wrapped, and on Windows fseek() takes a 32-bit long and failed from 2 GiB. The position, the sizes kept per file and the offsets in the block index are 64 bits wide, and seeking and truncating use the 64-bit calls on Windows. Positions are written as varints, so nothing on disk changes. Avian's own part: ReadRawBlock() computed the header position with a brace-initialized int64_t, which does not take a uint64_t; it casts now. Compiling the files that handle these positions with -Wshorten-64-to-32 before and after shows no place where a position is cut back to 32 bits. Backport of Bitcoin Core 30.4 commits adb363c753ee and a9e7b35d06af, by Antoine Poinsot. Github-Pull: bitcoin/bitcoin#36669 Rebased-From: 17556cb1f52fcbc807f65245101f72e8ec1573d8 Rebased-From: 48092a9042d8fcfd6bb7ae5911a1d53b8746d546 * net: enforce timeout interval for paused send peers A peer that does not read leaves the send buffer over its limit, and the node stops queueing replies for it but goes on queueing announcements. The time the buffer went over the limit is now kept, and a peer that has not brought it back under within 20 minutes is disconnected. In Bitcoin Core the peer that could stay in that state was one too old to be asked for a pong. Avian refuses peers below protocol version 70033, all of which answer pings, so the ping timeout already ends such a connection here. The change is taken to keep the bound explicit and the code in step with 30.x. Backport of Bitcoin Core 30.4 commit 96b53721763e, by Antoine Poinsot. Github-Pull: bitcoin/bitcoin#36667 Rebased-From: cc2534cdf7b14d0f1a18928ebaab7f7fdd7e839e * net_processing: process unique tx INVs only An inv message may name the same transaction up to 50,000 times, and each entry was handled as if it were new. Entries are now passed over once their hash has been seen in the message, txids and wtxids apart. In Bitcoin Core the costly case is a wtxid announcement of an orphan, which looks at every missing parent each time. Avian does not negotiate wtxid relay and ignores wtxid announcements, so that path is not reached today; it would be once wtxid relay is turned on. The functional test of the upstream change is left out: it needs wtxid relay, and the functional suite is not localized. Its txid cases were run against a regtest node with the P2P layer of the framework set to Avian's magic and version: one announcement per transaction with this change, two on 5.0.6. Backport of Bitcoin Core 30.5 commit 1bb5289d48c1, by Gregory Sanders. Github-Pull: bitcoin/bitcoin#35878 Rebased-From: 1278a5970d5ada0979052a5bad899e896b8ab40b * doc: release notes for the network fixes taken from Bitcoin Core 30.4 and 30.5
There is no reason we should process conflicting
advertisements for transactions, as they cannot be both accepted into our mempool.
Avoid processing these and doing spurious work.
Should be no change in observable behavior.