merge-script 16613c9de9 Merge bitcoin/bitcoin#34857: test: Remove confusing assert_debug_log in wallet_reindex.py
fa30951af5 test: Remove confusing assert_debug_log in wallet_reindex.py (MarcoFalke)

Pull request description:

  The `wallet_reindex.py` test has many issues:

  * It uses a `assert_debug_log` to ensure the reindex happened via `initload thread exit`. However, no other test uses this pattern, because `restart_node` already achieves the same internally (via `getmempoolinfo.loaded`).
  * The `assert_debug_log` may intermittently fail, because the `initload thread exit` log may happen at any time after the inner thread function (lambda) is fully done.
  * The test uses an `node.syncwithvalidationinterfacequeue()` without any explanation. No other test uses this pattern, because all wallet RPCs, in particular the next one (`gettransaction`) call it internally (via `BlockUntilSyncedToCurrentChain`).

  Fix all issues by removing all confusing, useless, and brittle calls.

  Example failure: https://github.com/bitcoin/bitcoin/actions/runs/22671604602/job/65716917459?pr=34419#step:11:22339

  ```
  ...
   node0 2026-03-04T13:55:23.784715Z (mocktime: 2026-03-04T22:15:17Z) [scheduler] [validationinterface.cpp:185] [operator()] [validation] UpdatedBlockTip: new block hash=24b5cc4c1352bc8841ecbe67a43827acd1adc609bd26b2691e80e89b97eff135 fork block hash=24a4dc8be9c157ac31913397d8bb1653900e12b55539c234039559fdeb6dd2fb (in IBD=true)
   node0 2026-03-04T13:55:23.784851Z (mocktime: 2026-03-04T22:15:17Z) [initload] [util/thread.cpp:22] [TraceThread] initload thread exit
   test  2026-03-04T13:55:23.813824Z TestFramework (ERROR): Unexpected exception:
                                     Traceback (most recent call last):
                                       File "/home/admin/actions-runner/_work/_temp/test/functional/test_framework/test_framework.py", line 142, in main
                                         self.run_test()
                                       File "/home/admin/actions-runner/_work/_temp/build/test/functional/wallet_reindex.py", line 90, in run_test
                                         self.birthtime_test(node, miner_wallet)
                                       File "/home/admin/actions-runner/_work/_temp/build/test/functional/wallet_reindex.py", line 64, in birthtime_test
                                         with node.assert_debug_log(expected_msgs=["initload thread exit"]):
                                       File "/usr/lib/python3.12/contextlib.py", line 144, in __exit__
                                         next(self.gen)
                                       File "/home/admin/actions-runner/_work/_temp/test/functional/test_framework/test_node.py", line 607, in assert_debug_log
                                         self._raise_assertion_error(f'Expected message(s) {remaining_expected!s} '
                                       File "/home/admin/actions-runner/_work/_temp/test/functional/test_framework/test_node.py", line 241, in _raise_assertion_error
                                         raise AssertionError(self._node_msg(msg))
                                     AssertionError: [node 0] Expected message(s) ['initload thread exit'] not found in log:
  ```

  Diff to reproduce failure:

  ```diff
  diff --git a/src/util/thread.cpp b/src/util/thread.cpp
  index 0fde73c4e2..de4c05e752 100644
  --- a/src/util/thread.cpp
  +++ b/src/util/thread.cpp
  @@ -8,2 +8,3 @@
   #include <util/log.h>
  +#include <util/time.h>
   #include <util/threadnames.h>
  @@ -21,2 +22,3 @@ void util::TraceThread(std::string_view thread_name, std::function<void()> threa
           thread_func();
  +    UninterruptibleSleep(999ms);
           LogInfo("%s thread exit", thread_name);
  diff --git a/test/functional/wallet_reindex.py b/test/functional/wallet_reindex.py
  index 71ab69e01b..649df4301a 100755
  --- a/test/functional/wallet_reindex.py
  +++ b/test/functional/wallet_reindex.py
  @@ -62,2 +62,3 @@ class WalletReindexTest(BitcoinTestFramework):

  +        import time; time.sleep(1) # Wait for previous initload thread to exit fully
           # Reindex and wait for it to finish
  ```

  Before on master: Test fails
  After on this pull: Test passes

ACKs for top commit:
  rkrux:
    ACK fa30951af5 if this PR needs to be backported.

Tree-SHA512: 1e6599511e09b5b9ac4aed96a6b1b8239d5dc63b164fc0c163b6f9f5bc72c1c61f72ad8256a01875208d825af46d057c4d9de61758002f256388ddb324006bb5
2026-03-24 12:06:25 +08:00

Bitcoin Core integration/staging tree

https://bitcoincore.org

For an immediately usable, binary version of the Bitcoin Core software, see https://bitcoincore.org/en/download/.

What is Bitcoin Core?

Bitcoin Core connects to the Bitcoin peer-to-peer network to download and fully validate blocks and transactions. It also includes a wallet and graphical user interface, which can be optionally built.

Further information about Bitcoin Core is available in the doc folder.

License

Bitcoin Core is released under the terms of the MIT license. See COPYING for more information or see https://opensource.org/license/MIT.

Development Process

The master branch is regularly built (see doc/build-*.md for instructions) and tested, but it is not guaranteed to be completely stable. Tags are created regularly from release branches to indicate new official, stable release versions of Bitcoin Core.

The https://github.com/bitcoin-core/gui repository is used exclusively for the development of the GUI. Its master branch is identical in all monotree repositories. Release branches and tags do not exist, so please do not fork that repository unless it is for development reasons.

The contribution workflow is described in CONTRIBUTING.md and useful hints for developers can be found in doc/developer-notes.md.

Testing

Testing and code review is the bottleneck for development; we get more pull requests than we can review and test on short notice. Please be patient and help out by testing other people's pull requests, and remember this is a security-critical project where any mistake might cost people lots of money.

Automated Testing

Developers are strongly encouraged to write unit tests for new code, and to submit new unit tests for old code. Unit tests can be compiled and run (assuming they weren't disabled during the generation of the build system) with: ctest. Further details on running and extending unit tests can be found in /src/test/README.md.

There are also regression and integration tests, written in Python. These tests can be run (if the test dependencies are installed) with: build/test/functional/test_runner.py (assuming build is your build directory).

The CI (Continuous Integration) systems make sure that every pull request is tested on Windows, Linux, and macOS. The CI must pass on all commits before merge to avoid unrelated CI failures on new pull requests.

Manual Quality Assurance (QA) Testing

Changes should be tested by somebody other than the developer who wrote the code. This is especially important for large or high-risk changes. It is useful to add a test plan to the pull request description if testing the changes is not straightforward.

Translations

Changes to translations as well as new translations can be submitted to Bitcoin Core's Transifex page.

Translations are periodically pulled from Transifex and merged into the git repository. See the translation process for details on how this works.

Important: We do not accept translation changes as GitHub pull requests because the next pull from Transifex would automatically overwrite them again.

Description
Languages
C++ 64.5%
Python 18.8%
C 12.9%
CMake 1.2%
Shell 0.9%
Other 1.4%