Page MenuHomePhabricator

Seeder: Fix getaddr interval to actually query address lists once a day
Needs RevisionPublic

Authored by PiRK on Jul 15 2024, 07:46.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Summary

The seeder was intended to fetch address lists of nodes once a day:

https://github.com/sipa/bitcoin-seeder/commit/966d040f8d976bc824821c5b2bb778363b5128fa

However, ourLastSuccess is updated each time a node is successfully
connected, which can be up to every 15 minutes. This effectively means
that address lists are only fetched when a node has been down for a day,
which means the seeder only queries address lists from new or unreliable
nodes.

To fix this, we add the new timestamp lastAddressRequest to the
database, which means the format is now version 5. This timestamp is
used to keep track of when we last send a getaddr / getheaders
request to a node.

This is a backport of bchn#1042

Depends on D16465
This fix is important if we want the improvement from D16465 to actually apply to nodes that are already in the database. Without the fix, the existing BCH and BSV nodes that are in the db will not get removed because the check never runs.

Test Plan
  • ninja check-bitcoin-seeder
  • Enable logging and observe address list being queried daily

Event Timeline

PiRK requested review of this revision.Jul 15 2024, 07:46
Fabien requested changes to this revision.Jul 15 2024, 08:59
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/seeder/main.cpp
77

This is still not quite what you want, as it means that a bad node will be requested just like a good one. You need to gate with ret.
Any chance we can have a test ?

This revision now requires changes to proceed.Jul 15 2024, 08:59
src/seeder/main.cpp
77

I'm not sure how to test changes to the main function in unit test. I think this kind of change would require a functional test framework for the seeder to be properly tested.