Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: MatthewLM on July 26, 2012, 11:20:45 PM



Title: Node Address Sharing. The use of Time.
Post by: MatthewLM on July 26, 2012, 11:20:45 PM
Hello can anyone explain the use of time for sharing addresses. This is might confusing to me:

https://github.com/bitcoin/bitcoin/blob/master/src/main.cpp#L2475

Like, why does it set the time for addresses advertised with times over 10 minutes in the future to five days ago?

Can anyone explain the exact mechanism for the use of time and perhaps advise on another more straightforward mechanism?

Thanks.


Title: Re: Node Address Sharing. The use of Time.
Post by: gmaxwell on July 26, 2012, 11:32:30 PM
with times over 10 minutes in the future to five days ago?

The reason it twiddles the time in various ways in various places is because the time is used to prioritize peer selection (in some limited ways), if peers could send you times in the far future they could unduly influence your peer selection.


Title: Re: Node Address Sharing. The use of Time.
Post by: MatthewLM on July 27, 2012, 08:08:02 PM
Hmm, yes. Though if a node wanted to place their addresses as high priority it could try to set the times to near 10 minutes in the future.

Perhaps to avert this somewhat, the addresses with the times placed close to the network time, are given the same priority. So if we wanted addresses from now to five minutes ago with a margin of 10 minutes, we could place the addresses from 15 minutes ago to 10 minutes in the future as the highest priority with the time set to now. As usual addresses after 10 minutes in the future can be set to 5 days ago (But why if below 100000000?). All other times remain the same.

?