The test has many issues:
- It fails intermittently, due to the use of
-stopatheight(https://github.com/bitcoin/bitcoin/issues/34710) - Using
-stopatheightis expensive, because it requires two restarts, making the test slow - The overwritten
def setup_networkdoes not store the extra args via theadd_nodescall, so if code is added in the future to restart a node, it may not pick up its global extra args.
Fix all issues by:
- Adding and using a fast
dumb_sync_blocksutil helper to achieve what-stopatheightdoesn’t achieve - Calling
self.add_nodes(self.num_nodes, self.extra_args)in the overriddensetup_network
Can be tested via this diff:
0diff --git a/src/node/kernel_notifications.cpp b/src/node/kernel_notifications.cpp
1index ab0e5ccb69..49384c10b8 100644
2--- a/src/node/kernel_notifications.cpp
3+++ b/src/node/kernel_notifications.cpp
4@@ -61,2 +61,3 @@ kernel::InterruptResult KernelNotifications::blockTip(SynchronizationState state
5 if (m_stop_at_height && index.nHeight >= m_stop_at_height) {
6+ LogInfo("Send shutdown signal after reaching stop height");
7 if (!m_shutdown_request()) {
8diff --git a/src/util/tokenpipe.cpp b/src/util/tokenpipe.cpp
9index c982fa6fc4..a5565ebd36 100644
10--- a/src/util/tokenpipe.cpp
11+++ b/src/util/tokenpipe.cpp
12@@ -4,2 +4,3 @@
13 #include <util/tokenpipe.h>
14+#include <util/time.h>
15
16@@ -60,2 +61,3 @@ int TokenPipeEnd::TokenRead()
17 ssize_t result = read(m_fd, &token, 1);
18+ UninterruptibleSleep(500ms);
19 if (result < 0) {
On master: The test fails On this pull: The test passes