1

What is the frequency of the addr messages in bitcoin? And are the contents of the addr messages from the new or the tried table or both?

2 Answers 2

1

From the Bitcoin wiki:

The getaddr message sends a request to a node asking for information about known active peers to help with finding potential nodes in the network. The response to receiving this message is to transmit one or more addr messages with one or more peers from a database of known active peers. The typical presumption is that a node is likely to be active if it has been sending a message within the last three hours.

In the Bitcoin Core implementation AddrMan (Address Manager, .cpp file) manages a node's known addresses. As the correction below in the comments says the response to a getaddr request will return both tried and untried (new) addresses.

3
  • 2
    That's incorrect. Both tried and new addresses are sent (though as the other answer points out, this is implementation specific - the protocol has no notion of tried and new addresses). Aug 30 at 11:25
  • I would have also thought superior logic would be to send tried addresses because your peer will disconnect from you if you send a bunch of untried addresses that turn out to be unresponsive. I guess it is a privacy, maintaining connections trade-off Aug 30 at 11:33
  • 1
    No, we don't disconnect peers that give us unresponsible IP addresses. Aug 30 at 12:13
2

What is the frequency of the addr messages in bitcoin?

I believe they are sent in response to a getaddr message. So the frequency at which your node receives addr messages depends on the frequency your node issues getaddr messages.

are the contents of the addr messages from the new or the tried table or both?

The network protocol specification doesn't specify the source in that way. It says

getaddr

The getaddr message sends a request to a node asking for information about known active peers to help with finding potential nodes in the network. The response to receiving this message is to transmit one or more addr messages with one or more peers from a database of known active peers. The typical presumption is that a node is likely to be active if it has been sending a message within the last three hours.

addr:

Provide information on known nodes of the network. Non-advertised nodes should be forgotten after typically 3 hours

To me this suggests each implementer chooses exactly how to source, categorise, store and maintain the data it uses in the response. If in doubt the implementer presumably consults the source code of whatever implementation they regard as the reference implementation.

I guess it would be prudent not to make any assumptions about the sending node's selection of entries in it's addr response. The sending node may be hostile or faulty.

2
  • I believe you mean getaddr? getdata based on my understanding is used for information regarding transactions Aug 30 at 12:44
  • @Vinay: Thanks, I believe you are right. Answer updated accordingly. Aug 30 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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