Page MenuHomePhabricator

refactor: Use type-safe std::chrono for addrman time
ClosedPublic

Authored by PiRK on Jan 5 2024, 14:31.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCc578c4851283: refactor: Use type-safe std::chrono for addrman time
Summary
Test Plan
ninja all check-all bitcoin-fuzzers
src/seeder/bitcoin-seeder

Check that the seeder finds valid peers

Event Timeline

PiRK requested review of this revision.Jan 5 2024, 14:31
Fabien requested changes to this revision.Jan 5 2024, 16:51
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/addrman.cpp
38

just checked, days (operator "d") is added in C++20...

89

that's 60s ?

src/net.cpp
2025

This is not obvious but this is correct

src/protocol.h
443
This revision now requires changes to proceed.Jan 5 2024, 16:51
src/addrman.cpp
89

oops. Good catch.

fix IsTerrible, use auto for TIME_INIT

Fabien added inline comments.
src/addrman.cpp
89 ↗(On Diff #43968)

I guess there is not test for that ?

This revision is now accepted and ready to land.Jan 8 2024, 08:15
src/addrman.cpp
89 ↗(On Diff #43968)

I don't see a test for IsTerrible. There is only one test that even mentions it (addrman_getaddr) and it just tweaks the addr.nTime to ensure it always returns False

It should be trivial to add a few tests to would catch such obvious mistakes. I will have a look at it in a separate diff.