How does a node forget about other nodes?

2

1

It is said that addr message: Provide information on known nodes of the network. Non-advertised nodes should be forgotten after typically 3 hours.

I did not totally understood what does it mean forgetting a node? A node has a list of peers, and it is checking every 3 hours if these peer are active? Does it work like this? How does this forgetting mechanism work?

Önder Gürcan

Posted 2017-06-12T11:39:36.307

Reputation: 327

Where did you read this? – Pieter Wuille – 2017-06-12T22:03:23.717

I read it here: https://en.bitcoin.it/wiki/Protocol_documentation#addr

– Önder Gürcan – 2017-06-13T07:29:50.490

Ignore that wiki, it was inaccurate when most of it was written years ago, and has been unmaintained since, mostly. I suggest using the bitcoin.org developer documentation instead. – Pieter Wuille – 2017-06-13T07:42:10.160

OK. So does it mean that there is no neighbour forgetting if it does not respond in 3 hours or something like that? The answer to my question is still missing. – Önder Gürcan – 2017-06-13T08:34:41.583

I'll write a full answer too when I have time; this is just a short comment to let you know the premise makes little sense. – Pieter Wuille – 2017-06-13T11:00:54.127

OK. I am waiting for your answer. – Önder Gürcan – 2017-06-14T12:39:10.483

Answers

1

There is no need for a node to "forget" a node. This is not something that is required nor necessary. What Bitcoin Core does in response to a getaddr message (so it sends an addr message) is that it checks its list of nodes. It filters through that list for the things that it recently had a connection to and that it didn't have multiple failed connections to before. There is no checking that a node is actually live and it doesn't do it on a set timer either.

Andrew Chow

Posted 2017-06-12T11:39:36.307

Reputation: 50 267

But isn't there a number limit for the connections? Doesn't a node try to find another connection if one of its connection has failed? – Önder Gürcan – 2017-06-18T13:14:39.417

Yes, so? That doesn't prevent a node from remembering that it recently connected to someone or that it recently tried to connect to a node and failed. And that only pertains to outgoing connections. If an incoming connection drops, Core doesn't care. It will only try to fill all of the 8 outbound connection slots. – Andrew Chow – 2017-06-18T16:00:37.120

So the limit for outbound connections is 8, right? – Önder Gürcan – 2017-06-19T09:50:07.430