Bitcoin Forum
May 03, 2024, 06:58:04 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Why does core send its own addr message to inbound connections?  (Read 128 times)
Coding Enthusiast (OP)
Legendary
*
Offline Offline

Activity: 1039
Merit: 2783


Bitcoin and C♯ Enthusiast


View Profile WWW
October 01, 2020, 12:36:22 PM
 #1

Although the code seems to be sending addr message to outbound connections (ref) but in my experience it is sending it to inbound connections too.
And in both cases I can't think of why it is doing that. When the connection is made specially if it is initiated by the other node, they should know our address and sending it again seems pointless to me.
On top of that the addr message is sent after version message (hand-shake) which already contains connection information (ie. the addr message).

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.19.1)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
1714719484
Hero Member
*
Offline Offline

Posts: 1714719484

View Profile Personal Message (Offline)

Ignore
1714719484
Reply with quote  #2

1714719484
Report to moderator
1714719484
Hero Member
*
Offline Offline

Posts: 1714719484

View Profile Personal Message (Offline)

Ignore
1714719484
Reply with quote  #2

1714719484
Report to moderator
1714719484
Hero Member
*
Offline Offline

Posts: 1714719484

View Profile Personal Message (Offline)

Ignore
1714719484
Reply with quote  #2

1714719484
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714719484
Hero Member
*
Offline Offline

Posts: 1714719484

View Profile Personal Message (Offline)

Ignore
1714719484
Reply with quote  #2

1714719484
Report to moderator
1714719484
Hero Member
*
Offline Offline

Posts: 1714719484

View Profile Personal Message (Offline)

Ignore
1714719484
Reply with quote  #2

1714719484
Report to moderator
1714719484
Hero Member
*
Offline Offline

Posts: 1714719484

View Profile Personal Message (Offline)

Ignore
1714719484
Reply with quote  #2

1714719484
Report to moderator
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6578


Just writing some code


View Profile WWW
October 01, 2020, 04:07:21 PM
Merited by Foxpup (2)
 #2

addr messages contain the addresses of other nodes. It's how IP addresses for other nodes are spread around the network.

Coding Enthusiast (OP)
Legendary
*
Offline Offline

Activity: 1039
Merit: 2783


Bitcoin and C♯ Enthusiast


View Profile WWW
October 01, 2020, 05:13:24 PM
 #3

addr messages contain the addresses of other nodes. It's how IP addresses for other nodes are spread around the network.
That's true most of the times but I'm talking about when nodes send you their own addr message.

Let me put it this way, I connect to 185.132.178.23:18333 (satoshi 0.20.0) and send it a version message saying I know you are 185.132.178.23:18333 (in the receiving node address part), I've also connected to it so I already knew that. Then it sends me its own version message that can contain 185.132.178.23:18333 again (but it doesn't but that's irrelevant for now). After the handshake is finished it sends me an addr message saying 185.132.178.23:18333 is an address of a node!


I'm trying to figure out what the reason behind all this repetition is, specifically the last addr part.

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.19.1)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
MixMAx123
Full Member
***
Offline Offline

Activity: 161
Merit: 168


View Profile
October 01, 2020, 08:36:15 PM
 #4

the addr message usually contains all known nodes.
My guess is that the node only knows your own address at the time.
gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4158
Merit: 8382



View Profile WWW
October 02, 2020, 08:11:51 PM
Merited by Welsh (4), Foxpup (2), Coding Enthusiast (2), ABCbits (1)
 #5

This is how you advertise yourself. When you send the addr message to your peer it will (sometimes) pass it on to other hosts so that they learn about you.

Quote
they should know our address and sending it again seems pointless to me.
Yes, they might know about it (or they might have just had it manually configured w/ an addnode), but even if they do their knoweldge doesn't serve the purpose of causing your address to get advertised to the network. For that to happen, you have to advertise it.
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!