Bitcoin Forum
September 29, 2024, 04:19:37 AM *
News: Latest Bitcoin Core release: 27.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How many addresses are sent in response to a getaddr message?  (Read 469 times)
disckjet (OP)
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
December 19, 2013, 05:59:20 PM
 #1

I've been trying to determine the number of addresses a node sends when it receives a getaddr message but I'm a little confused.

On one hand, on addrman.h/.cpp I can see that:

Code:
// the maximum percentage of nodes to return in a getaddr call
#define ADDRMAN_GETADDR_MAX_PCT 23

// the maximum number of nodes to return in a getaddr call
#define ADDRMAN_GETADDR_MAX 2500

[...]

int nNodes = ADDRMAN_GETADDR_MAX_PCT*vRandom.size()/100;
if (nNodes > ADDRMAN_GETADDR_MAX)
    nNodes = ADDRMAN_GETADDR_MAX;

So it seems that the number of addresses sent is the smaller of the two conditions, namely, 23% of the (active known) nodes or 2500 nodes.

But on the other hand, from the bitcoin wiki https://en.bitcoin.it/wiki/Satoshi_Client_Node_Discovery:

Quote
The getaddr message sends a request to a node asking for information about known active peers to help with identifying potential nodes in the network. The response to receiving this message is to transmit an addr message with one or more peers from a database of known active peers.

...and...

Quote
[About addr messages]If the sender sent over 1000 addresses, they are all ignored.

So, why does a node try to send 2500 addresses if the receiver is going to discard them? Why not sending at most 1000 addresses?
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!