Skip to content

bitcoind shouldn't perform network activity if the option networkactive=0, e.g. [addrman] Selected IP:PORT from tried #34190

Open

Description

@GregTonoski

Is there an existing issue for this?

  • I have searched the existing issues

Current behaviour

There are many logs like the examples below despite networkactive=0:

  1. 2025-12-31T12:24:47Z [addrman] Selected 34.75.109.94:8333 from tried
  2. 2025-12-31T12:24:47Z [tor] Error connecting to Tor control socket
    2025-12-31T12:24:47Z [tor] Not connected to Tor control port 127.0.0.1:9051, retrying in 25.63 s
  3. 2025-12-31T12:28:43Z [net:error] Could not get best interface for default route: Element not found. (1168)
    2025-12-31T12:28:43Z [net] portmap: Could not determine IPv4 default gateway

Expected behaviour

There isn't any network activity and so no such logs.

Steps to reproduce

  1. Start bitcoind.exe -networkactive=0

Relevant log output

bitcoind_addrman_win.txt

How did you obtain Bitcoin Core

Pre-built binaries

What version of Bitcoin Core are you using?

v29

Operating system and version

Windows 11

Machine specifications

No response

Activity

  1. willcl-ark commented on Jan 13, 2026

    @willcl-ark
    Member

    If you interpret "networkactive" to mean "this program will not perform any network-related activity" then "fixing" this would make sense. However of your interpretation is "toggle a connection to the bitcoin p2p network" then the current behaviour seems fine:

    • If you have networkactive and toggle it, then all bitcoin p2p connections are dropped
    • Toggle it again to re-enable connections

    Configuring pmp, running the addrman loop and making a connection to the tor control port in readiness for future connections doesn't seem completely untoward, in my opinion.

    Curious what others think here though, as giving torControlThread and mapport_thread knowledge of the state of networkactive is pretty easy. I didn't have a look at addrman yet though...

    edit: I did end up taking a look at what an implementation for this would look like for mapport and torcontroller here: master...willcl-ark:bitcoin:refs/heads/respect-networkactive

    Seems to work ok.

  2. davidgumberg commented on Jan 14, 2026

    @davidgumberg
    Contributor

    Configuring pmp, running the addrman loop and making a connection to the tor control port in readiness for future connections doesn't seem completely untoward, in my opinion.

    I agree, but I don't think there is much advantage in doing those things when disconnected from the P2P network, no one will be surprised that Bitcoin Core isn't doing those things when networkactive is set to false. master...willcl-ark:bitcoin:refs/heads/respect-networkactive seems simple enough...

  3. brunoerg commented on Jan 15, 2026

    @brunoerg
    Contributor

    Curious what others think here though, as giving torControlThread and mapport_thread knowledge of the state of networkactive is pretty easy. I didn't have a look at addrman yet though...

    I think these many selections from addrman is because we verify if the network is active at OpenNetworkConnection, so this addrman interation might come from ThreadOpenConnections.

  4. added a commit that references this issue on Jan 30, 2026
    717d6ce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions