Fix the memory access violations, such as:
unknown location(0): fatal error: in "wallet_tests/rescan": memory access violation at address: 0x0000001f: no mapping at fault address ../src/wallet/test/wallet_tests.cpp(34): last checkpoint: "rescan" fixture ctor *** 1 failure is detected in the test module "Bitcoin Test Suite" test_bitcoin: /usr/include/boost/thread/pthread/condition_variable_fwd.hpp:116: boost::condition_variable::~condition_variable(): Assertion `!ret' failed. Aborted (core dumped)
~TestingSetup calls UnloadBlockIndex() which deletes the
mapBlockIndex but does not reset the pindexBestForkTip and
pindexBestForkBase pointers. When a test then calls
ProcessNewBlock() (such as validation_block_tests), the callstack
leads to the CheckForkWarningConditions() where these pointers are
read, causing the fault.