tests: fix spurious addrman test failure #10429
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There have been a few PRs lately that have failed checks due to a bug introduced in #10287. The first check happened to work already because the chosen addresses didn't collide. The
addrman.Clear()after that check causes addrman's salt to be reset, making all future tests non-deterministic.When inserting two addresses of the same class, from the same source, there's a 1/64 chance that their hashes will collide. So it's faulty logic to be checking for an exact size. @sipa, mind verifying that?
I'd like to fix this properly by ensuring determinism in the test as a next step, but I'd rather fix the spurious failures asap.