net: PeerHub uses NodeClock, drop second mock battery - #837
Open
Hero-Gamer wants to merge 6 commits into
Open
Hero-Gamer wants to merge 6 commits into
Hero-Gamer wants to merge 6 commits into
Conversation
HEAD: 886463e Merge reardencode#823 (latest master) - clock.rs:44 root wall source = LEAVE - tx_relay.rs:928 manual mock check = node-time MIGRATE to NodeClock - tx_relay.rs:3753 tmp uniqueness = log/perf LEAVE - bulk_io 10, bdz 5, etc = log/perf LEAVE - peers.rs 3, service.rs 3, peer.rs 4 = node-time MIGRATE for Steps 2/3 No prod change. Tracks reardencode#688 item 2.1, part of reardencode#821, follows reardencode#740
- peers.rs:1249 AtomicU64 0=wall, Acquire/Release - tx_relay.rs:625 AtomicU64 0=wall, Relaxed/Relaxed - chain.rs: hub.clock.set_mock() third clock - split-brain enables INV freeze and peer timeout bypass No prod change, adversarial review for reardencode#821
…6463e repro: rg -n SystemTime::now crates/ --type rust -g '!*tests*' | cut -d: -f1,2 = 100/100 match
- PeerHub::new(clock: Arc<NodeClock>) where NodeClock::new()->Arc<Self> - Remove mock_now/set_mock_now second battery from PeerHub, CLEAN - Add on_clock_jump() explicit reaction to clock jump (INV + heartbeat) - setmocktime writes ChainHub clock once, fanout removed - Migrate methods_tests.rs + integration_multinode.rs: hub.clock.set_mock(x as i64) - Fix run.rs proxy_seed test ctor and all journey tests - QC: fmt OK, clippy workspace all-targets -D warnings OK, ast-grep 12 passed - Verified: rbitcoin-net --lib 588 passed, no bare PeerHub::new()
Hero-Gamer
force-pushed
the
clock-step2-single-source
branch
from
September 30, 2026 19:22
0fdc367 to
5af26ba
Compare
Contributor
There was a problem hiding this comment.
The shared-clock wiring looks sound for #821 Step 2, and the required checks are green. I found one behavior regression that should be fixed before merge (see inline comment).
Scope note: TxRelay still owns its separate mock clock and setmocktime still notifies it, as expected for the planned Step 3. Please keep the PR and changelog wording scoped to PeerHub / Step 2; ‘Clock is single NodeClock source’ can read as if the whole node has been consolidated.
Hero-Gamer
force-pushed
the
clock-step2-single-source
branch
from
October 2, 2026 15:56
184ac8c to
ae96744
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#821 Step 2 only. Not the whole issue.
PeerHub no longer has its own mock clock.
NodeClock::new()returnsArc<Self>.PeerHub::new(clock)holdspub clock.mock_now/set_mock_noware gone.on_clock_jump()requests tx INVs, runs the heartbeat, and queues a due addr self-announcement on each live peer.TxRelay still has its own mock clock.
setmocktimestill notifies it. That is Step 3.Ctors migrated to
PeerHub::new(NodeClock::new())/hub.clock.set_mock:chain.rs,ephemeral.rs,overlay_addrman_journey.rs,peer_*_journey.rs,service.rs,rbitcoin-node/src/run.rs,rbitcoin-rpc/src/methods_tests.rs,rbitcoin-test/tests/integration_multinode.rs.Test plan
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warnings./scripts/ast-grep.shcargo test -p rbitcoin-net --libself_announce_due_on_peerhub_clock_jump: next send is start+24h; a 25h jump queues Addr. A jump that does not pass that deadline must not.