This pull adds a tried
argument to RPC addpeeraddress and a regression test for the recent addrman/asmap changes and issue.
PR #22697 introduced a reproducible bug in commit 181a1207 that fails addrman consistency checks and causes it to significantly lose peer entries when the -asmap
configuration option is used.
The issue occurs upon bitcoind restart due to an initialization order change in src/init.cpp
in that commit, whereby CAddrman asmap is set after deserializing peers.dat
, rather than before.
Issue reported on the #bitcoin-core-dev
IRC channel starting at https://www.erisian.com.au/bitcoin-core-dev/log-2021-08-23.html#l-263.
0addrman lost 22813 new and 2 tried addresses due to collisions or invalid addresses
1ADDRMAN CONSISTENCY CHECK FAILED!!! err=-17 bitcoind: ./addrman.h:707: void CAddrMan::Check() const: Assertion `false' failed. Aborted
How to reproduce:
git checkout 181a1207
, build, and launch bitcoind with the-asmap
and-checkaddrman=1
configuration options enabled- restart bitcoind
- bitcoind aborts on the second call to the addrman consistency checks in
CAddrMan::Check()
How to test this pull:
git checkout 181a1207
, cherry pick the first commit of this branch, build, git checkout this branch, runtest/functional/rpc_net.py
, which should pass, and then runtest/functional/feature_asmap.py
, which should fail with the following output:
0AssertionError: Unexpected stderr bitcoind: ./addrman.h:739: void CAddrMan::Check() const: Assertion `false' failed.