Skip to content

Conversation

@ajtowns
Copy link
Contributor

@ajtowns ajtowns commented Dec 6, 2025

Cuts out some wasted time in net socket handling. First, only calculates the current time once every 50ms, rather than once for each peer, which given we only care about second-level precision seems more than adequate. Second, caches the value of the -capturemessages setting in CConnman rather than re-evaluating it every time we invoke PushMessaage.

We run InactivityChecks() for each node everytime poll()/select() every
50ms or so. Rather than calculating the current time once for each node,
just calculate it once and reuse it.
@DrahtBot DrahtBot added the P2P label Dec 6, 2025
@DrahtBot
Copy link
Contributor

DrahtBot commented Dec 6, 2025

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34025.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK vasild, maflcko, sedited, mzumsande

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #30951 (net: option to disallow v1 connection on ipv4 and ipv6 peers by stratospher)

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.

LLM Linter (✨ experimental)

Possible places where named args for integral literals may be used (e.g. func(x, /*named_arg=*/0) in C++, and func(x, named_arg=0) in Python):

  • CaptureMessage(pnode->addr, msg.m_type, msg.data, /is_incoming=/false) in src/net.cpp

2025-12-09

@ajtowns
Copy link
Contributor Author

ajtowns commented Dec 6, 2025

Not sure if the flame graph is usable, but:

perf

GetBoolArg takes up 0.31% of total time, as part of PushMessage that takes up 1.75% of total time, in b-msghand.

GetTime takes up 0.82% of total time, as part of InactivityCheck that takes up 1.78% of total time, in b-net.

Converting from std::chrono::microseconds to NodeClock::time_point is a lot more intrusive (impacting at least net_processing and node/eviction as well).

Note that CConnman was a friend of CNode until #27257 (no longer relevant)

@sedited
Copy link
Contributor

sedited commented Dec 6, 2025

Concept ACK

@fanquake
Copy link
Member

fanquake commented Dec 8, 2025

cc @theuni @vasild

{
AssertLockNotHeld(m_total_bytes_sent_mutex);

auto now = GetTime<std::chrono::microseconds>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetTime() is deprecated.

Suggested change
auto now = GetTime<std::chrono::microseconds>();
const auto now = NodeClock::now();

(this is moving the deprecated call from elsewhere, but now is a good time to change it)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting from std::chrono::microseconds to NodeClock::time_point is a lot more intrusive (impacting at least net_processing and node/eviction as well).

I did try that, it requires a lot of changes to all the things we compare now against, so m_connected, m_last_send, m_last_recv. m_connected in particular is a big hit compared to the rest of this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works:

@@ -2125 +2125 @@ void CConnman::SocketHandlerConnected(const std::vector<CNode*>& nodes,
-    auto now = GetTime<std::chrono::microseconds>();
+    auto now = NodeClock::now();
@@ -2218 +2218 @@ void CConnman::SocketHandlerConnected(const std::vector<CNode*>& nodes,
-        if (InactivityCheck(*pnode, now)) pnode->fDisconnect = true;
+        if (InactivityCheck(*pnode, now.time_since_epoch())) pnode->fDisconnect = true;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A question beyond this PR: if GetTime() is still useful because a lot of surrounding code uses e.g. std::chrono::seconds which we need to compare against, then should GetTime() be un-deprecated?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting from std::chrono::microseconds to NodeClock::time_point is a lot more intrusive (impacting at least net_processing and node/eviction as well).

Happy to take a look as well in a fresh commit, either here, or in a follow-up.

if GetTime() is still useful because a lot of surrounding code uses e.g. std::chrono::seconds which we need to compare against, then should GetTime() be un-deprecated?

GetTime returning a time duration is wrong, because the current time point (now) is not a duration, but a time point. A duration arises as the difference of two points in time. This duration can then be compared with any other duration (e.g. peer timeout). I don't think it makes sense un-deprecate something just because it is used in the current code. If this was a valid reason, nothing could ever be marked deprecated as long as it is used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duration works as an atomic fine -- we have atomic<seconds> and atomic<microseconds> in various places in net, net_processing and util/time. atomic<time_point> doesn't work because even if the duration is noexcept (necessary for atomic), that doesn't propagate to the time_point's constructor also being noexcept which is a requirement for wrapping in atomic.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may be missing something obvious. https://godbolt.org/z/8GM97aYhs seems to compile fine. And https://eel.is/c++draft/time.duration.cons doesn't mention noexcept. Can you give a minimal reproducer, or link to the std docs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I was seeing was that the duration constructor was noexcept in practice, but time_point has an explicit constructor that wouldn't throw but wasn't declared as noexcept, which was then rejected by atomic...

Stackoverflow answer about it: https://stackoverflow.com/questions/22701617/should-constructors-on-stdchrono-time-point-be-noexcept-or-why-arent

Ah, it looks like it changed between C++17 and C++20, going from atomic() noexcept = default; to constexpr atomic() noexcept(is_nothrow_default_constructible_v<T>); which fixes it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Having a custom class might still have some value in allowing direct comparisons/calculations without explicit loads, I guess)

Copy link
Contributor Author

@ajtowns ajtowns Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it looks to me like libstdc++ didn't match the C++20 spec until gcc-mirror/gcc@613f8dd which doesn't seem to have been merged until March this year in libstdc++15? C++20 spec change was https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0883r2.pdf

However I can't reproduce the "core" bug LWG#2165 CWG#1778 even with -std=c++11, so apparently modern compilers just no longer behave this way? I can't quite figure out what the change was or when it was made though. 🤷‍♂️

EDIT: ah, looks like the underlying language issue was present in g++ 9.x but fixed in g++ 10.x (May 2020).

}

if (InactivityCheck(*pnode)) pnode->fDisconnect = true;
if (InactivityCheck(*pnode, now)) pnode->fDisconnect = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, feel free to ignore: given that we allow some nontrivial amount of time to pass between the variable initialization and usage, maybe now is not the best name for it. What about time_at_start_of_loop or something like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I'd say "we allow some nontrivial amount of time to pass" -- it's probably a bug if that were to actually happen?

AssertLockNotHeld(m_total_bytes_sent_mutex);

auto now = GetTime<std::chrono::microseconds>();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the reasoning of the first commit cea443e net: Pass time to InactivityChecks fuctions is well grounded. No need to retrieve the current time for every node, given that we only care about seconds-precision here. I measured on my slow node with a few tens of connections: all nodes are processed in a few milliseconds or less. So, at worst this is outdated that much which is fine IMO.

@ajtowns ajtowns force-pushed the 202512-netsplit-opt branch from b4d1007 to 5373898 Compare December 9, 2025 16:57
@dergoegge
Copy link
Member

Re: #34025 (comment)

Just to confirm, this flamegraph is from a node that has finished syncing to the tip? i.e. IBD is not included in this graph, right?

@maflcko
Copy link
Member

maflcko commented Dec 9, 2025

GetTime takes up 0.82% of total time, as part of InactivityCheck that takes up 1.78% of total time, in b-net.

Interesting. I was wondering why getting the time eats so much CPU. Though, in the happy path, InactivityCheck is just loading a few atomics, which means getting the time costs as much as loading a few atomics. Also, the flame graph probably shows the CPU time, and not the wall clock time. So the patch here likely won't cut the wall clock time between two calls of SocketHandlerConnected, but only the CPU time inside a single SocketHandlerConnected call?

concept ack, Seems fine to still make the changes here.

@ajtowns
Copy link
Contributor Author

ajtowns commented Dec 9, 2025

Just to confirm, this flamegraph is from a node that has finished syncing to the tip? i.e. IBD is not included in this graph, right?

Yes; it's taken over a longish period though, iirc, I think either 30m or 2h. You can see ProcessNewBlock at 0.20% just before ProcessTransaction at 4.56% fwiw.

Also, the flame graph probably shows the CPU time, and not the wall clock time. So the patch here likely won't cut the wall clock time between two calls of SocketHandlerConnected, but only the CPU time inside a single SocketHandlerConnected call?

Yeah, presuming SocketHandlerConnected isn't using 100% of a core, it'll be spending its time waiting for the SELECT_TIMEOUT_MILLISECONDS timeout to hit, which is 50ms.

@ajtowns ajtowns force-pushed the 202512-netsplit-opt branch from 5373898 to 5f5c1ea Compare December 9, 2025 20:52
Copy link
Contributor

@vasild vasild left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 5f5c1ea

Would be happy to see the call to the deprecated GetTime() removed: #34025 (comment).
I do not see it as a blocker because this PR is actually moving the call around, not planting a new one.

@DrahtBot DrahtBot requested a review from sedited December 10, 2025 05:37
@maflcko
Copy link
Member

maflcko commented Dec 10, 2025

review ACK 5f5c1ea 🏣

Show signature

Signature:

untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: review ACK 5f5c1ea01955d277581f6c2acbeb982949088960 🏣
DIf+EMRUrE9g+3ldiGUW0pHeRyThkZk3bbOL6sas10+I4f60l14Vo/S1nCwtrHEqiue3z1X4uTE3S7uN3Tg3DQ==

Copy link
Contributor

@sedited sedited left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 5f5c1ea

@glozow glozow requested a review from theuni December 11, 2025 16:39
Copy link
Contributor

@mzumsande mzumsande left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 5f5c1ea

Looks like an improvement, but I wonder if instead of doing micro-optimizations like the ones here, it wouldn't be better to have the entire InactivityCheck() procedure run somewhere else than in the SocketHandlerConnected, or at least less often - it seems a bit absurd to check every 50ms for a timeout of 20 minutes. Even the initial waiting time m_peer_connect_timeout from ShouldRunInactivityChecks() for a new peer doesn't really be checked that frequently.

@fanquake fanquake merged commit 597b8be into bitcoin:master Dec 12, 2025
25 checks passed
stringintech added a commit to stringintech/go-bitcoinkernel that referenced this pull request Dec 12, 2025
938d7aacab Merge bitcoin/bitcoin#33657: rest: allow reading partial block data from storage
597b8be223 Merge bitcoin/bitcoin#34025: net: Waste less time in socket handling
d155fc12a0 Merge bitcoin/bitcoin#32414: validation: periodically flush dbcache during reindex-chainstate
07135290c1 rest: allow reading partial block data from storage
4e2af1c065 blockstorage: allow reading partial block data from storage
f2fd1aa21c blockstorage: return an error code from `ReadRawBlock()`
5be20c380d Merge bitcoin/bitcoin#34033: scripted-diff: Unify error and warning log formatting
b31f786695 Merge bitcoin/bitcoin#34045: test: Log IP of download server in get_previous_releases.py
b26762bdcb Merge bitcoin/bitcoin#33805: merkle: migrate `path` arg to reference and drop unused args
0f6d8a347a Merge bitcoin/bitcoin#30442: precalculate SipHash constant salt XORs
c2975f26d6 Merge bitcoin/bitcoin#33602: [IBD] coins: reduce lookups in dbcache layer propagation
cdaf25f9c3 test: Log IP of download server in get_previous_releases.py
c1f0a89d9c Merge bitcoin/bitcoin#34040: test: Detect truncated download in get_previous_releases.py
fa75480c84 test: Detect truncated download in get_previous_releases.py
56ce78d5f6 Merge bitcoin/bitcoin#34031: net: Remove "tor" as a network specification
500862b2d4 Merge bitcoin/bitcoin#33423: qa: Improvements to debug_assert_log + busy_wait_for_debug_log
5f5c1ea019 net: Cache -capturemessages setting
cca113f5b0 Merge bitcoin/bitcoin#34008: log: don't rate-limit "new peer" with -debug=net
2c44c41984 Merge bitcoin/bitcoin#33553: validation: Improve warnings in case of chain corruption
6eb5ba5691 refactor: extract shared `SipHash` state into `SipHashState`
118d22ddb4 optimization: cache `PresaltedSipHasher` in `CBlockHeaderAndShortTxIDs`
9ca52a4cbe optimization: migrate `SipHashUint256` to `PresaltedSipHasher`
ec11b9fede optimization: introduce `PresaltedSipHasher` for repeated hashing
d23d49ee3f Merge bitcoin/bitcoin#31823: tests: Add witness commitment if we have a witness transaction in `FullBlockTest.update_block()`
20330548cf refactor: extract `SipHash` C0-C3 constants to class scope
9f9eb7fbc0 test: rename k1/k2 to k0/k1 in `SipHash` consistency tests
29ed608dc7 Merge bitcoin/bitcoin#33961: script: Add a separate ScriptError for empty pubkeys encountered in Tapscript
d2a199bca7 Merge bitcoin/bitcoin#33909: doc, ci: Make the max number of commits tested explicit
dbc8928069 Merge bitcoin/bitcoin#33993: init: point out -stopatheight may be imprecise
d4d184eda9 log: don't rate-limit "new peer" with -debug=net
e7ac5a133c doc: add release note for 34031
c4c70a256e netbase: Remove "tor" as a network specification
fa89f60e31 scripted-diff: LogPrintLevel(*,BCLog::Level::*,*) -> LogError()/LogWarning()
fa6c7a1954 scripted-diff: LogPrintLevel(*,BCLog::Level::Debug,*) -> LogDebug()
d5c8199b79 Merge bitcoin/bitcoin#34006: Add util::Expected (std::expected)
77248e8496 Merge bitcoin/bitcoin#33771: refactor: C++20 operators
36073d56db Merge bitcoin/bitcoin#33952: depends: update freetype and document remaining `bitcoin-qt` runtime libs
f09ae5f96f Merge bitcoin/bitcoin#33950: guix: reduce allowed exported symbols
cea443e246 net: Pass time to InactivityChecks fuctions
89dc82295e Merge bitcoin/bitcoin#29641: scripted-diff: Use LogInfo over LogPrintf
eb19a2dac5 Merge bitcoin/bitcoin#34017: fuzz: Add a test case for `ParseByteUnits()`
faa23738fc refactor: Enable clang-tidy bugprone-unused-return-value
fa114be27b Add util::Expected (std::expected)
e68517208b Merge bitcoin/bitcoin#33995: depends: Propagate native C compiler to `sqlite` package
091cae6fdf Merge bitcoin/bitcoin#33939: contrib: Count entry differences in asmap-tool diff summary
57b888ce0e fuzz: Add a test case for `ParseByteUnits()`
b8e66b901d Merge bitcoin/bitcoin#33858: test: add unit test coverage for the empty leaves path in MerkleComputation
0c9ab0f8f8 Merge bitcoin/bitcoin#33956: net: fix use-after-free with v2->v1 reconnection logic
fa4395dffd refactor: Remove unused LogPrintf
fa05181d90 scripted-diff: LogPrintf -> LogInfo
9890058b37 Merge bitcoin/bitcoin#33723: chainparams: remove dnsseed.bitcoin.dashjr-list-of-p2p-nodes.us
9e02f78089 Merge bitcoin/bitcoin#33774: cmake: Move IPC tests to `ipc/test`
ad452a1e65 Merge bitcoin/bitcoin#33528: wallet: don't consider unconfirmed TRUC coins with ancestors
ff06e2468a init: point out -stopatheight may be imprecise
9a29b2d331 Merge bitcoin/bitcoin#33857: doc: Add `x86_64-w64-mingw32ucrt` triplet to `depends/README.md`
69e66efe45 Merge bitcoin/bitcoin#32882: index: remove unnecessary locator cleaning in BaseIndex::Init()
6581ac5d9f Merge bitcoin/bitcoin#33996: contrib: fix manpage generation
39ca015259 Merge bitcoin/bitcoin#33140: test: Avoid shutdown race in NetworkThread
e9536faaee contrib: fix manpage generation
bcf794d5f3 Merge bitcoin/bitcoin#30455: test: assumeutxo: add missing tests in wallet_assumeutxo.py
af0e6a65c9 Merge bitcoin/bitcoin#33702: contrib: Remove brittle, confusing and redundant UTF8 encoding from Python IO
4b47113698 validation: Reword CheckForkWarningConditions and call it also during IBD and at startup
2f51951d03 p2p: Add warning message when receiving headers for blocks cached as invalid
4c784b25c4 Merge bitcoin/bitcoin#33985: fuzz: gate mempool entry based on weight
710031ebef Revert "guix: sqlite wants tcl"
4cf5ea6c3d depends: Propagate native C compiler to `sqlite` package
ce771726f3 Merge bitcoin/bitcoin#33960: log: Use more severe log level (warn/err) where appropriate
cb7d5bfe4a test, assumeutxo: loading a wallet (backup) on a pruned node
7a365244f8 test, refactor snapshot import and background validation
e0ba6bbed9 Merge bitcoin/bitcoin#33591: Cluster mempool followups
b8d279a81c doc: add comment to explain correctness of GatherClusters()
aba7500a30 Fix parameter name in getmempoolcluster rpc
6c1325a091 Rename weight -> clusterweight in RPC output, and add doc explaining mempool terminology
bc2eb931da Require mempool lock to be held when invoking TRUC checks
957ae23241 Improve comments for getTransactionAncestry to reference cluster counts instead of descendants
d97d6199ce Fix comment to reference cluster limits, not chain limits
a1b341ef98 Sanity check feerate diagram in CTxMemPool::check()
23d6f457c4 rpc: improve getmempoolcluster output
d2dcd37aac Avoid using mapTx.modify() to update modified fees
d84ffc24d2 doc: add release notes snippet for cluster mempool
b0417ba944 doc: Add design notes for cluster mempool and explain new mempool limits
804329400a fuzz: gate mempool entry based on weight
6356041e58 Merge bitcoin/bitcoin#33972: cmake: Make `BUILD_KERNEL_TEST` depend on `BUILD_KERNEL_LIB`
7d7cb1bb48 Merge bitcoin/bitcoin#33971: cmake: Set `WITH_ZMQ` to `ON` in Windows presets
2d88966e43 miner: replace "package" with "chunk"
6f3e8eb300 Add a GetFeePerVSize() accessor to CFeeRate, and use it in the BlockAssembler
b5f245f6f2 Remove unused DEFAULT_ANCESTOR_SIZE_LIMIT_KVB and DEFAULT_DESCENDANT_SIZE_LIMIT_KVB
1dac54d506 Use cluster size limit instead of ancestor size limit in txpackage unit test
04f65488ca Use cluster size limit instead of ancestor/descendant size limits when sanity checking TRUC policy limits
634291a7dc Use cluster limits instead of ancestor/descendant limits when sanity checking package policy limits
fc18ef1f3f Remove ancestor and descendant vsize limits from MemPoolLimits
ed8e819121 Warn user if using -limitancestorsize/-limitdescendantsize that the options have no effect
80d8df2d47 Invoke removeUnchecked() directly in removeForBlock()
9292570f4c Rewrite GetChildren without sets
3e39ea8c30 Rewrite removeForReorg to avoid using sets
a3c31dfd71 scripted-diff: rename AddToMempool -> TryAddToMempool
a5a7905d83 Simplify removeRecursive
01d8520038 Remove unused argument to RemoveStaged
fe1815d48f cmake: Make `BUILD_KERNEL_TEST` depend on `BUILD_KERNEL_LIB`
49c6728535 cmake: Set `WITH_ZMQ` to `ON` in Windows presets
ec8eb013a9 doc: Add `x86_64-w64-mingw32ucrt` triplet to `depends/README.md`
48496caa12 ci: Remove redundant `DEP_OPTS` from “Windows-cross UCRT” job
f6acbef108 Merge bitcoin/bitcoin#33764: ci: Add Windows + UCRT jobs for cross-compiling and native testing
b5a7a685bb ci: Make the max number of commits tested explicit
9d5021a05b script: add SCRIPT_ERR_TAPSCRIPT_EMPTY_PUBKEY
7b90b4f5bb guix: reduce allowed exported symbols
41e657aacf guix: add bitcoin-qt runtime libs doc in symbol-check
ef4ce19a15 depends: freetype 2.11.1
808f1d972b Merge bitcoin/bitcoin#32009: contrib: turn off compression of macOS SDK to fix determinism (across distros)
4de26b111f Merge bitcoin/bitcoin#33514: ci: clear out space on CentOS, depends, gui GHA job
fa45a1503e log: Use LogWarning for non-critical logs
fa0018d011 log: Use LogError for fatal errors
22229de728 doc: Fix typo in init log
38c8474d0d Merge bitcoin/bitcoin#33914: Change Parse descriptor argument to string_view
4b25b274de Merge bitcoin/bitcoin#33951: test: check for output to stdout in `TestShell` test
167df7a98c net: fix use-after-free with v2->v1 reconnection logic
52230a7f69 test: check for output to stdout in `TestShell` test
85d058dc53 Merge bitcoin/bitcoin#33946: interfaces: remove redundant mempool lock in ChainImpl::isInMempool()
fd4ce55121 contrib: Count entry differences in asmap-tool diff summary
e07e57368e ci: clear out space on centos job
79d6e874e1 Merge bitcoin/bitcoin#32587: test: Fix reorg patterns in tests to use proper fork-based approach
e249ea7da6 Merge bitcoin/bitcoin#33945: depends: latest config.guess & config.sub
3e01b5d0e7 contrib: rename gen-sdk to gen-sdk.py
c1213a35ab macdeploy: disable compression in macOS gen-sdk script
a33d034545 contrib: more selectively pick files for macOS SDK
fad6118586 test: Fix "typo" in written invalid content
fab085c15f contrib: Use text=True in subprocess over manual encoding handling
fa71c15f86 scripted-diff: Bump copyright headers after encoding changes
fae612424b contrib: Remove confusing and redundant encoding from IO
fa7d72bd1b lint: Drop check to enforce encoding to be specified in Python scripts
faf39d8539 test: Clarify that Python UTF-8 mode is the default today for most systems
fa83e3a81d lint: Do not allow locale dependent shell scripts
70d9e8f0a1 fix: reorg behaviour in mempool tests to match real one
540ed333f6 Move the create_empty_fork method to the test framework's blocktools.py module to enable reuse across multiple tests.
2909655fba fix: remove redundant mempool lock in ChainImpl::isInMempool()
d5ed4ba9d8 Merge bitcoin/bitcoin#33906: depends: Add patch for Windows11Style plugin
3e4355314b depends: latest config.sub
04eb84fe3f depends: latest config.guess
b30262dcaa Merge bitcoin/bitcoin#33903: ci: Remove redundant busybox option
1a5f1eb080 Merge bitcoin/bitcoin#33921: doc: clarify and cleanup macOS fuzzing notes
72cb8cef97 Merge bitcoin/bitcoin#33862: txgraph: drop move assignment operator
bc64013e6f Remove unused variable (cacheMap) in mempool
ade0397f59 txgraph: drop move assignment operator
5336bcd578 Merge bitcoin/bitcoin#33855: kernel: add btck_block_tree_entry_equals
4f65a1c5db Merge bitcoin/bitcoin#33917: clang-format: Set Bitcoin Core IncludeCategories
902717b66d Merge bitcoin/bitcoin#33918: depends: Update Qt download link
68ab2b65bf Merge bitcoin/bitcoin#33919: ci: Run GUI unit tests in cross-Windows task
7e129b644e Merge bitcoin/bitcoin#33893: test: add `-alertnotify` test for large work invalid chain warning
5fe753b56f Merge bitcoin/bitcoin#32655: depends: sqlite 3.50.4; switch to autosetup
ff8c2f3749 Merge bitcoin/bitcoin#33932: ci: Use latest Xcode that the minimum macOS version allows
fa283d28e2 Merge bitcoin/bitcoin#33629: Cluster mempool
2e27bd9c3a ci: Add Windows + UCRT jobs for cross-compiling and native testing
238c1c8933 Merge bitcoin-core/gui#914: Revert "gui, qt: brintToFront workaround for Wayland"
8343a9ffcc test: add `-alertnotify` test for large work invalid chain warning
c34bc01b2f doc: clarify and cleanup macOS fuzzing notes
fa9537cde1 ci: Use latest Xcode that the minimum macOS version allows
17cf9ff7ef Use cluster size limit for -maxmempool bound, and allow -maxmempool=0 in general
315e43e5d8 Sanity check `GetFeerateDiagram()` in CTxMemPool::check()
de2e9a24c4 test: extend package rbf functional test to larger clusters
4ef4ddb504 doc: update policy/packages.md for new package acceptance logic
79f73ad713 Add check that GetSortedScoreWithTopology() agrees with CompareMiningScoreWithTopology()
a86ac11768 Update comments for CTxMemPool class
9567eaa66d Invoke TxGraph::DoWork() at appropriate times
bd130db994 ci: Rename items specific to Windows + MSVCRT
0672e727bf Revert "gui, qt: brintToFront workaround for Wayland"
fa7ea497c3 ci: Run GUI unit tests in cross-Windows task
fa0fee44a8 ci: Remove redundant busybox option
fa102ec69f doc: Shorten ci name
fa7e222a23 clang-format: Set Bitcoin Core IncludeCategories
2222223780 doc: Remove bash -c wrapper
50cbde3295 depends: Update Qt download link
c0bfe72f6e Change Parse descriptor argument to string_view
8558902e57 depends: Add patch for Windows11Style plugin
6c5c44f774 test: add functional test for new cluster mempool RPCs
72f60c877e doc: Update mempool_replacements.md to reflect feerate diagram checks
21693f031a Expose cluster information via rpc
72e74e0d42 fuzz: try to add more code coverage for mempool fuzzing
f107417490 bench: add more mempool benchmarks
7976eb1ae7 Avoid violating mempool policy limits in tests
84de685cf7 Stop tracking parents/children outside of txgraph
88672e205b Rewrite GatherClusters to use the txgraph implementation
1ca4f01090 Fix miniminer_tests to work with cluster limits
1902111e0f Eliminate CheckPackageLimits, which no longer does anything
3a646ec462 Rework RBF and TRUC validation
19b8479868 Make getting parents/children a function of the mempool, not a mempool entry
5560913e51 Rework truc_policy to use descendants, not children
a4458d6c40 Use txgraph to calculate descendants
c8b6f70d64 Use txgraph to calculate ancestors
241a3e666b Simplify ancestor calculation functions
b9cec7f0a1 Make removeConflicts private
0402e6c780 Remove unused limits from CalculateMemPoolAncestors
08be765ac2 Remove mempool logic designed to maintain ancestor/descendant state
fc4e3e6bc1 Remove unused members from CTxMemPoolEntry
ff3b398d12 mempool: eliminate accessors to mempool entry ancestor/descendant cached state
b9a2039f51 Eliminate use of cached ancestor data in miniminer_tests and truc_policy
ba09fc9774 mempool: Remove unused function CalculateDescendantMaximum
8e49477e86 wallet: Replace max descendant count with cluster_count
e031085fd4 Eliminate Single-Conflict RBF Carve Out
cf3ab8e1d0 Stop enforcing descendant size/count limits
89ae38f489 test: remove rbf carveout test from mempool_limit.py
c0bd04d18f Calculate descendant information for mempool RPC output on-the-fly
bdcefb8a8b Use mempool/txgraph to determine if a tx has descendants
69e1eaa6ed Add test case for cluster size limits to TRUC logic
9cda64b86c Stop enforcing ancestor size/count limits
1f93227a84 Remove dependency on cached ancestor data in mini-miner
9fbe0a4ac2 rpc: Calculate ancestor data from scratch for mempool rpc calls
7961496dda Reimplement GetTransactionAncestry() to not rely on cached data
feceaa42e8 Remove CTxMemPool::GetSortedDepthAndScore
21b5cea588 Use cluster linearization for transaction relay sort order
6445aa7d97 Remove the ancestor and descendant indices from the mempool
216e693729 Implement new RBF logic for cluster mempool
ff8f115dec policy: Remove CPFP carveout rule
c3f1afc934 test: rewrite PopulateMempool to not violate mempool policy (cluster size) limits
47ab32fdb1 Select transactions for blocks based on chunk feerate
dec138d1dd fuzz: remove comparison between mini_miner block construction and miner
6c2bceb200 bench: rewrite ComplexMemPool to not create oversized clusters
1ad4590f63 Limit mempool size based on chunk feerate
b11c89cab2 Rework miner_tests to not require large cluster limit
95a8297d48 Check cluster limits when using -walletrejectlongchains
95762e6759 Do not allow mempool clusters to exceed configured limits
edb3e7cdf6 [test] rework/delete feature_rbf tests requiring large clusters
435fd56711 test: update feature_rbf.py replacement test
34e32985e8 Add new (unused) limits for cluster size/count
838d7e3553 Add transactions to txgraph, but without cluster dependencies
a7c96f874d tests: Add witness commitment if we have a witness transaction in FullBlockTest.update_block()
096924d39d kernel: add btck_block_tree_entry_equals
ffcae82a68 test: exercise TransactionMerklePath with empty block; targets the MerkleComputation empty-leaves path that was only reached by fuzz tests
d5ed9cb3eb Add accessor for sigops-adjusted weight
1bf3b51396 Add sigops adjusted weight calculator
c18c68a950 Create a txgraph inside CTxMemPool
29a94d5b2f Make CTxMemPoolEntry derive from TxGraph::Ref
92b0079fe3 Allow moving CTxMemPoolEntry objects, disallow copying
24ed820d4f merkle: remove unused `mutated` arg from `BlockWitnessMerkleRoot`
63d640fa6a merkle: remove unused `proot` and `pmutated` args from `MerkleComputation`
be270551df merkle: migrate `path` arg of `MerkleComputation` to a reference
866bbb98fd cmake, test: Improve locality of `bitcoin_ipc_test` library description
ae2e438b25 cmake: Move IPC tests to `ipc/test`
48840bfc2d refactor: Prefer `<=>` over multiple relational operators
5a0f49bd26 refactor: Remove all `operator!=` definitions
0ac969cddf validation: don't reallocate cache for short-lived CCoinsViewCache
c8f5e446dc coins: reduce lookups in dbcache layer propagation
1db7491470 depends: sqlite 3.50.4
286f3e49c8 guix: sqlite wants tcl
b0c706795c Remove unreliable seed from chainparams.cpp, and the associated README
6c73e47448 mempool: Store iterators into mapTx in mapNextTx
51430680ec Allow moving an Epoch::Marker
dcd42d6d8f [test] wallet send 3 generation TRUC
e753fadfd0 [wallet] never try to spend from unconfirmed TRUC that already has ancestors
fa6db79302 test: Avoid shutdown race in NetworkThread
a1f7623020 qa: Only complain about expected messages that were not found
1e54125e2e refactor(qa): Avoid unnecessary string operations
a9021101dc qa: Replace always-escaped regexps with "X in Y"
5c16e4631c doc: Remove no longer correct comment
facd01e6ff refactor: remove redundant locator cleanup in BaseIndex::Init()
c1e554d3e5 refactor: consolidate 3 separate locks into one block
41479ed1d2 test: add test for periodic flush inside ActivateBestChain
84820561dc validation: periodically flush dbcache during reindex-chainstate

git-subtree-dir: depend/bitcoin
git-subtree-split: 938d7aacabd0bb3784bb3e529b1ed06bb2891864
@ajtowns
Copy link
Contributor Author

ajtowns commented Dec 13, 2025

it seems a bit absurd to check every 50ms for a timeout of 20 minutes. Even the initial waiting time m_peer_connect_timeout from ShouldRunInactivityChecks() for a new peer doesn't really be checked that frequently.

I think if you're running a listening node with many real inbound peers, on mainnet where there seems to be maybe 4.5 tx/s, you probably expect to receive socket data from each peer every 2 seconds or so (announcing the ~9 txs that have been received in that time). With 80 (inbound, tx relay) peers, that's an interrupt every 25ms, rather than every 50ms. Worse if you have more peers, better if many of your peers are block-relay only or inactive spy nodes or similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants