I want to test peer discovery in regtest mode of bitcoin core, running in Docker. However, I noticed in the source code of bitcoin core that there is a check if the address is routable before answering to a getaddr message. So I first create a network with routable addresses (IsRFC6598):

docker network create -d bridge --subnet bridge_sharedrange

Then I launch four Docker machines with bitcoind installed (and using the bridge_sharedrange network, with different /16 addresses). The bitcoin daemon is then started in all of these four machines with:

bitcoind -regtest -daemon

Running ifconfig on these nodes show that they are running on,,, From the first machine ( I then execute the command:

bitcoin-cli addnode add

From the third machine ( I then execute the command:

bitcoin-cli addnode add

So basically, the node with address now has two peers (checked with bitcoin-cli getpeerinfo). I would expect now that

  • learned about &
  • learned about

But that is not the case. They only know Is this normal behaviour? I read on https://en.bitcoin.it/wiki/Satoshi_Client_Node_Discovery#Command_Line_Provided_Addresses that it might have to do with the timestamp of the addr, but I'm not certian this can be the cause, and how can circumvent that.

BTW, I also tested with

bitcoind -regtest -daemon -discover=1

Update: It seems this feature of discovering local LAN nodes is under discussion: https://github.com/bitcoin/bitcoin/issues/3802 , however I would think that the WAN rules apply to my situation, as I use RFC6598 addresses in my test set-up.

1 Answer 1


Bitcoin Core does not immediately broadcast a new addr message to nodes with each new connection it gets. On average, those broadcasts are every 30 seconds, but they could happen sooner or later than that as the delay follows a Poisson distribution. You should wait a few minutes before checking again. Furthermore, just because they know about the address does not mean that the nodes will actually choose to connect to them.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.