Skip to content

cuprated: delay Tor P2P zone start until after sync#576

Open
redsh4de wants to merge 8 commits intoCuprate:mainfrom
redsh4de:feat/delayed-tor-start
Open

cuprated: delay Tor P2P zone start until after sync#576
redsh4de wants to merge 8 commits intoCuprate:mainfrom
redsh4de:feat/delayed-tor-start

Conversation

@redsh4de
Copy link

@redsh4de redsh4de commented Feb 3, 2026

What

Delays the start of the Tor P2P zone until after the node has synchronized using clearnet

Closes #544

Why

Prevents deanonymization based on sync state

Where

  • cuprated
    • main.rs - Changed startup logic to initialize clearnet seperately. Creates the Tor router delivery channels. Sets up a task that starts Tor zone after receiving the sync notification from blockchain manager.
    • p2p.rs - Split initialize_zones_p2p into two seperate clearnet/Tor zone init functions
    • blockchain
      • manager.rs - Returns the notification channel to main, passes it to the syncer.
      • syncer.rs - Changed check_behind_peers to check_sync_status, which now returns: no peers, behind peers, synced. On synced, fires the notification.
    • txpool
      • dandelion.rs - Receives Tor network interface via the tokio oneshot channel

How

  1. On node start, an Arc<Notify> instance is created and used between the syncer and the Tor startup task
  2. The Tor task waits on the notification that the node is synced, then initializes the Tor P2P zone. The old initialize_zones_p2p was split into two per-zone functions to enable this
  3. The dandelion router receives the Tor network interface via a tokio::oneshot channel, checking for it in poll_ready(). Transaction routing works over clearnet initially and then adds Tor routing once it is available

@github-actions github-actions bot added the A-binaries Area: Related to binaries. label Feb 3, 2026
@github-actions github-actions bot added A-dependency Area: Related to dependencies, or changes to a Cargo.{toml,lock} file. A-workspace Area: Changes to a root workspace file or general repo file. labels Feb 4, 2026
@github-actions github-actions bot added the A-net Area: Related to networking. label Feb 4, 2026
@github-actions github-actions bot added the A-p2p Area: Related to P2P. label Feb 4, 2026
@github-actions github-actions bot added A-consensus Area: Related to consensus. A-cryptonight Area: Related to Cryptonight. labels Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-binaries Area: Related to binaries. A-consensus Area: Related to consensus. A-cryptonight Area: Related to Cryptonight. A-dependency Area: Related to dependencies, or changes to a Cargo.{toml,lock} file. A-net Area: Related to networking. A-p2p Area: Related to P2P. A-workspace Area: Changes to a root workspace file or general repo file.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tor should only start once synced

1 participant