bitcoin icon indicating copy to clipboard operation
bitcoin copied to clipboard

test: addrman: tried 3 times and never a success so `isTerrible=true`

Open brunoerg opened this issue 7 months ago • 3 comments

This PR adds test coverage for the following verification:

if (TicksSinceEpoch<std::chrono::seconds>(m_last_success) == 0 && nAttempts >= ADDRMAN_RETRIES) { // tried N times and never a success
    return true;
}

If we've tried an address for 3 or more times and were unsuccessful, this address should be pointed out as "terrible".


You can test this by applying:

diff --git a/src/addrman.cpp b/src/addrman.cpp
index 054a9bee32..93a9521b59 100644
--- a/src/addrman.cpp
+++ b/src/addrman.cpp
@@ -81,7 +81,7 @@ bool AddrInfo::IsTerrible(NodeSeconds now) const
     }
 
     if (TicksSinceEpoch<std::chrono::seconds>(m_last_success) == 0 && nAttempts >= ADDRMAN_RETRIES) { // tried N times and never a success
-        return true;
+        return false;
     }

brunoerg avatar Jul 12 '24 17:07 brunoerg