0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-02 09:46:52 -05:00

test: Drop excessive locking in CAddrManTest::SimConnFail

The unit test is single threaded, so there's no need to hold the mutex
between Good() and Attempt().

This change avoids recursive locking in the CAddrMan::Attempt function.

Co-authored-by: John Newbery <john@johnnewbery.com>
This commit is contained in:
Hennadii Stepanov 2021-05-23 16:27:14 +03:00
parent 5c4f0c4d46
commit 2da95545ea
No known key found for this signature in database
GPG key ID: 410108112E7EA81F

View file

@ -74,9 +74,9 @@ public:
// Simulates connection failure so that we can test eviction of offline nodes
void SimConnFail(const CService& addr)
{
LOCK(cs);
int64_t nLastSuccess = 1;
Good_(addr, true, nLastSuccess); // Set last good connection in the deep past.
// Set last good connection in the deep past.
Good(addr, true, nLastSuccess);
bool count_failure = false;
int64_t nLastTry = GetAdjustedTime()-61;