Skip to content

Commit 2da9554

Browse files
hebastojnewbery
andcommitted
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 <[email protected]>
1 parent 5c4f0c4 commit 2da9554

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/test/addrman_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ class CAddrManTest : public CAddrMan
7474
// Simulates connection failure so that we can test eviction of offline nodes
7575
void SimConnFail(const CService& addr)
7676
{
77-
LOCK(cs);
7877
int64_t nLastSuccess = 1;
79-
Good_(addr, true, nLastSuccess); // Set last good connection in the deep past.
78+
// Set last good connection in the deep past.
79+
Good(addr, true, nLastSuccess);
8080

8181
bool count_failure = false;
8282
int64_t nLastTry = GetAdjustedTime()-61;

0 commit comments

Comments
 (0)