Merge bitcoin/bitcoin#26818: test: Fix feature_startupnotify intermittent issue

fac810bb0a524e79014882f8fc694efade35de9f test: Fix feature_startupnotify intermittent issue (MarcoFalke)

Pull request description:

  Might fix #25644

ACKs for top commit:
  aureleoules:
    ACK fac810bb0a524e79014882f8fc694efade35de9f
  brunoerg:
    ACK fac810bb0a524e79014882f8fc694efade35de9f

Tree-SHA512: 870bf65da8120b6897d02e3bb70eea018d4761396abe64c3533bbc5237e65be9f77d35f62cd5d08cf7132dd53b504bf58229c33e18833c191495ad229c84d7c2
This commit is contained in:
MarcoFalke 2023-01-05 17:22:24 +01:00 committed by pasta
parent 864d02e4a9
commit d1b93c78b7
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -29,9 +29,14 @@ class StartupNotifyTest(BitcoinTestFramework):
self.wait_until(lambda: os.path.exists(tmpdir_file))
self.log.info("Test -startupnotify is executed once")
def get_count():
with open(tmpdir_file, "r", encoding="utf8") as f:
file_content = f.read()
assert_equal(file_content.count(FILE_NAME), 1)
return file_content.count(FILE_NAME)
self.wait_until(lambda: get_count() > 0)
assert_equal(get_count(), 1)
self.log.info("Test node is fully started")
assert_equal(self.nodes[0].getblockcount(), 200)