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:
diff --git a/src/node/kernel_notifications.cpp b/src/node/kernel_notifications.cpp
index ab0e5ccb69..49384c10b8 100644
--- a/src/node/kernel_notifications.cpp
+++ b/src/node/kernel_notifications.cpp
@@ -61,2 +61,3 @@ kernel::InterruptResult KernelNotifications::blockTip(SynchronizationState state
if (m_stop_at_height && index.nHeight >= m_stop_at_height) {
+ LogInfo("Send shutdown signal after reaching stop height");
if (!m_shutdown_request()) {
diff --git a/src/util/tokenpipe.cpp b/src/util/tokenpipe.cpp
index c982fa6fc4..a5565ebd36 100644
--- a/src/util/tokenpipe.cpp
+++ b/src/util/tokenpipe.cpp
@@ -4,2 +4,3 @@
#include <util/tokenpipe.h>
+#include <util/time.h>
@@ -60,2 +61,3 @@ int TokenPipeEnd::TokenRead()
ssize_t result = read(m_fd, &token, 1);
+ UninterruptibleSleep(500ms);
if (result < 0) {
On master: The test fails On this pull: The test passes