From 58365e5e7611b524362d6537a7f6dd8a0aae396f Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 29 Apr 2019 08:51:01 -0400 Subject: [PATCH 1/7] partial Merge #15919: Remove unused OpenSSL includes to make it more clear where OpenSSL is used a34081b7c3 Remove unused OpenSSL includes to make it more clear where OpenSSL is used (practicalswift) Pull request description: Remove unused OpenSSL includes to make it more clear where OpenSSL is used. Before this patch: ``` $ git grep '#include src/qt/paymentrequestplus.cpp:#include src/qt/paymentrequestplus.h:#include src/qt/paymentserver.cpp:#include src/qt/rpcconsole.cpp:#include src/qt/test/paymentservertests.cpp:#include src/qt/test/paymentservertests.cpp:#include src/qt/test/test_main.cpp:#include src/qt/winshutdownmonitor.cpp:#include src/random.cpp:#include src/random.cpp:#include src/random.cpp:#include src/test/crypto_tests.cpp:#include src/test/crypto_tests.cpp:#include ``` After this patch: ``` $ git grep '#include src/qt/paymentrequestplus.h:#include src/qt/paymentserver.cpp:#include src/qt/test/paymentservertests.cpp:#include src/qt/test/paymentservertests.cpp:#include src/qt/test/test_main.cpp:#include src/qt/winshutdownmonitor.cpp:#include src/random.cpp:#include src/random.cpp:#include src/random.cpp:#include ``` Removed: * `src/init.cpp:#include ` (unused since 5ecfa36fd01fc27475abbfcd53b4efb9da4a7398 (2016)) * `src/qt/rpcconsole.cpp:#include ` (unused since 5ecfa36fd01fc27475abbfcd53b4efb9da4a7398 (2016)) * `src/test/crypto_tests.cpp:#include ` (introduced unused in daa384120a63542257d4ca73047d775f16fac654 (2015)) * `src/test/crypto_tests.cpp:#include ` (introduced unused in daa384120a63542257d4ca73047d775f16fac654 (2015)) ACKs for commit a34081: MarcoFalke: utACK a34081b7c398847c37a587029c7ad7f3a3396c8e real-or-random: utACK a34081b fanquake: utACK a34081b Tree-SHA512: 8ab9699c063f2d0ed2d71738f20ac5c21336585f7f62fd3a4b23199a125ea3224725591d64171347465762181788fac1bc4ce13d8824090bf1a5ac71a66d6538 --- src/init.cpp | 1 - src/qt/rpcconsole.cpp | 2 -- src/test/crypto_tests.cpp | 1 - 3 files changed, 4 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 42cfbba556..58d3905772 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -99,7 +99,6 @@ #include #include #include -#include #if ENABLE_ZMQ #include diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index af78cb0ab9..5596ebc5ea 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -23,8 +23,6 @@ #include #include -#include - #include #ifdef ENABLE_WALLET diff --git a/src/test/crypto_tests.cpp b/src/test/crypto_tests.cpp index 1731677535..1ffb8829a3 100644 --- a/src/test/crypto_tests.cpp +++ b/src/test/crypto_tests.cpp @@ -21,7 +21,6 @@ #include #include -#include #include BOOST_FIXTURE_TEST_SUITE(crypto_tests, BasicTestingSetup) From 87960509dfb2ae65676207e6d7f647e24fcf6742 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 29 Apr 2019 15:03:44 -0400 Subject: [PATCH 2/7] Merge #15897: QA/mininode: Send all headers upfront in send_blocks_and_test to avoid sending an unconnected one 9f9db39041 QA/mininode: Send all headers upfront in send_blocks_and_test to avoid sending an unconnected one (Luke Dashjr) Pull request description: While this doesn't currently trigger any problems, the network protocol does expect headers to be sent connectable in normal circumstances, and if too many are sent out of order will disconnect the peer. ACKs for commit 9f9db3: Tree-SHA512: 25b88718e4ba3d31aed2de7ece23fab9a0737fd6536c5e618ea8eb5a3a217dab0dffaebc4892df7993bcea7efb7c4fb5085fabebe99535b8f7fdde3c19df54ff --- test/functional/test_framework/mininode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functional/test_framework/mininode.py b/test/functional/test_framework/mininode.py index f61fd212e9..0bbef10ac0 100755 --- a/test/functional/test_framework/mininode.py +++ b/test/functional/test_framework/mininode.py @@ -633,7 +633,7 @@ class P2PDataStore(P2PInterface): reject_reason = [reject_reason] if reject_reason else [] with node.assert_debug_log(expected_msgs=reject_reason): - self.send_message(msg_headers([CBlockHeader(blocks[-1])])) + self.send_message(msg_headers([CBlockHeader(block) for block in blocks])) if request_block: wait_until(lambda: blocks[-1].sha256 in self.getdata_requests, timeout=timeout, lock=mininode_lock) From 267482876a9b5c120e8d325d5aa5adbaee0a7e97 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 8 Apr 2019 11:24:45 -0400 Subject: [PATCH 3/7] Merge #15763: Update bips.md for 0.18.0 65d2f5d2de Update bips.md for 0.18.0 (Pieter Wuille) Pull request description: Update `doc/bips.md` for changes in 0.17 and 0.18 (BIP 61 deprecated, BIP 70 support optional, BIP 159 connection logic). ACKs for commit 65d2f5: MarcoFalke: ACK 65d2f5d2de37fd64c9cf8d526bab0072774b7b1d fanquake: utACK 65d2f5d promag: ACK 65d2f5d, referenced pulls match. Tree-SHA512: a261aae196c90d4fab7925e53e61cdd02e39050cb09eb5a89002f2d8304e26782ec4811f77bfc9e92a5b1b675020c324ca91c9a111ccbd3ae90b80821607c7c9 --- doc/bips.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/bips.md b/doc/bips.md index fa36d30310..31d77d1d85 100644 --- a/doc/bips.md +++ b/doc/bips.md @@ -1,4 +1,4 @@ -BIPs that are implemented by Bitcoin Core (up-to-date up to **v0.13.0**): +BIPs that are implemented by Bitcoin Core (up-to-date up to **v0.18.0**): * [`BIP 9`](https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki): The changes allowing multiple soft-forks to be deployed in parallel have been implemented since **v0.12.1** ([PR #7575](https://github.com/bitcoin/bitcoin/pull/7575)) * [`BIP 11`](https://github.com/bitcoin/bips/blob/master/bip-0011.mediawiki): Multisig outputs are standard since **v0.6.0** ([PR #669](https://github.com/bitcoin/bitcoin/pull/669)). @@ -19,7 +19,7 @@ BIPs that are implemented by Bitcoin Core (up-to-date up to **v0.13.0**): * [`BIP 65`](https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki): The CHECKLOCKTIMEVERIFY softfork was merged in **v0.12.0** ([PR #6351](https://github.com/bitcoin/bitcoin/pull/6351)), and backported to **v0.11.2** and **v0.10.4**. Mempool-only CLTV was added in [PR #6124](https://github.com/bitcoin/bitcoin/pull/6124). * [`BIP 66`](https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki): The strict DER rules and associated version 3 blocks have been implemented since **v0.10.0** ([PR #5713](https://github.com/bitcoin/bitcoin/pull/5713)). * [`BIP 68`](https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki): Sequence locks have been implemented as of **v0.12.1** ([PR #7184](https://github.com/bitcoin/bitcoin/pull/7184)), and have been activated since *block 419328*. -* [`BIP 70`](https://github.com/bitcoin/bips/blob/master/bip-0070.mediawiki) [`71`](https://github.com/bitcoin/bips/blob/master/bip-0071.mediawiki) [`72`](https://github.com/bitcoin/bips/blob/master/bip-0072.mediawiki): Payment Protocol support has been available in Bitcoin Core GUI since **v0.9.0** ([PR #5216](https://github.com/bitcoin/bitcoin/pull/5216)). +* [`BIP 70`](https://github.com/bitcoin/bips/blob/master/bip-0070.mediawiki) [`71`](https://github.com/bitcoin/bips/blob/master/bip-0071.mediawiki) [`72`](https://github.com/bitcoin/bips/blob/master/bip-0072.mediawiki): Payment Protocol support has been available in Bitcoin Core GUI since **v0.9.0** ([PR #5216](https://github.com/bitcoin/bitcoin/pull/5216)). Support can be optionally disabled at build time since **v0.18.0** ([PR 4350](https://github.com/dashpay/dash/pull/4350)). * [`BIP 90`](https://github.com/bitcoin/bips/blob/master/bip-0090.mediawiki): Trigger mechanism for activation of BIPs 34, 65, and 66 has been simplified to block height checks since **v0.14.0** ([PR #8391](https://github.com/bitcoin/bitcoin/pull/8391)). * [`BIP 111`](https://github.com/bitcoin/bips/blob/master/bip-0111.mediawiki): `NODE_BLOOM` service bit added, and enforced for all peer versions as of **v0.13.0** ([PR #6579](https://github.com/bitcoin/bitcoin/pull/6579) and [PR #6641](https://github.com/bitcoin/bitcoin/pull/6641)). * [`BIP 112`](https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki): The CHECKSEQUENCEVERIFY opcode has been implemented since **v0.12.1** ([PR #7524](https://github.com/bitcoin/bitcoin/pull/7524)) and has been activated since *block 419328*. @@ -28,4 +28,4 @@ BIPs that are implemented by Bitcoin Core (up-to-date up to **v0.13.0**): * [`BIP 130`](https://github.com/bitcoin/bips/blob/master/bip-0130.mediawiki): direct headers announcement is negotiated with peer versions `>=70012` as of **v0.12.0** ([PR 6494](https://github.com/bitcoin/bitcoin/pull/6494)). * [`BIP 147`](https://github.com/bitcoin/bips/blob/master/bip-0147.mediawiki): NULLDUMMY softfork as of **v0.13.1** ([PR 8636](https://github.com/bitcoin/bitcoin/pull/8636) and [PR 8937](https://github.com/bitcoin/bitcoin/pull/8937)). * [`BIP 152`](https://github.com/bitcoin/bips/blob/master/bip-0152.mediawiki): Compact block transfer and related optimizations are used as of **v0.13.0** ([PR 8068](https://github.com/bitcoin/bitcoin/pull/8068)). -* [`BIP 159`](https://github.com/bitcoin/bips/blob/master/bip-0159.mediawiki): The NODE_NETWORK_LIMITED service bit is signalled as of **v0.16.0** ([PR 11740](https://github.com/bitcoin/bitcoin/pull/11740)), and such nodes are connected to as of v0.17.0 ([PR 10387](https://github.com/bitcoin/bitcoin/pull/10387)). +* [`BIP 159`](https://github.com/bitcoin/bips/blob/master/bip-0159.mediawiki): The NODE_NETWORK_LIMITED service bit is signalled as of **v0.16.0** ([PR 11740](https://github.com/bitcoin/bitcoin/pull/11740)), and such nodes are connected to as of **v0.17.0** ([PR 10387](https://github.com/bitcoin/bitcoin/pull/10387)). From 610f1e41d8d21f8a37a60844ed6c5eab5489f3f1 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Tue, 24 Sep 2019 11:32:34 -0400 Subject: [PATCH 4/7] Merge #16912: doc: Remove Doxygen intro from src/bitcoind.cpp dbdc758c27cfdda9d255742b6c6ff4d1b7be82df doc: Improve doxygen readme navigation section (Jon Layton) c15ac2c0aa45c59aee6d36c2d6d5210290dc601c doc: Move doxygen intro to file for USE_MDFILE_AS_MANPAGE (Jon Layton) Pull request description: With `USE_MDFILE_AS_MAINPAGE`, this moves the introductory Doxygen comment to its own file. This makes `bitcoind.cpp` cleaner. It also removes the `\mainpage` header text, which was smaller than the section titles, and improves the Navigation section. ACKs for top commit: promag: ACK dbdc758c27cfdda9d255742b6c6ff4d1b7be82df. Tree-SHA512: 9352baad655877437913b74dc8888a71d1cccf55a837657ee2630fde3f427d0f0339155b7ab3d9e63a9edb9d53512d747eafcb11987a7c26c47a6df2eca93351 --- doc/Doxyfile.in | 4 ++-- doc/README_doxygen.md | 15 +++++++++++++++ src/dashd.cpp | 16 ---------------- 3 files changed, 17 insertions(+), 18 deletions(-) create mode 100644 doc/README_doxygen.md diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index b716bafe31..ba3307198d 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -793,7 +793,7 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = src dash-docs doc/release-notes/dash +INPUT = src dash-docs doc/release-notes/dash doc/README_doxygen.md # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -989,7 +989,7 @@ FILTER_SOURCE_PATTERNS = # (index.html). This can be useful if you have a project on for instance GitHub # and want to reuse the introduction page also for the doxygen output. -USE_MDFILE_AS_MAINPAGE = +USE_MDFILE_AS_MAINPAGE = doc/README_doxygen.md #--------------------------------------------------------------------------- # Configuration options related to source browsing diff --git a/doc/README_doxygen.md b/doc/README_doxygen.md new file mode 100644 index 0000000000..80bf136164 --- /dev/null +++ b/doc/README_doxygen.md @@ -0,0 +1,15 @@ +\mainpage notitle + +\section intro_sec Introduction + +This is the developer documentation of the reference client for an experimental new digital currency called Dash, +which enables instant payments to anyone, anywhere in the world. Dash uses peer-to-peer technology to operate +with no central authority: managing transactions and issuing money are carried out collectively by the network. + +The software is a community-driven open source project, released under the MIT license. + +See https://github.com/dashpay/dash and https://dash.org/ for further information about the project. + +\section Navigation +Use Modules, Namespaces, Classes, or Files at the top of the page to start navigating the code. + diff --git a/src/dashd.cpp b/src/dashd.cpp index 5b4bc0d0b8..d621d57846 100644 --- a/src/dashd.cpp +++ b/src/dashd.cpp @@ -29,22 +29,6 @@ const std::function G_TRANSLATION_FUN = nullptr; -/* Introduction text for doxygen: */ - -/*! \mainpage Developer documentation - * - * \section intro_sec Introduction - * - * This is the developer documentation of the reference client for an experimental new digital currency called Dash (https://www.dash.org/), - * which enables instant payments to anyone, anywhere in the world. Dash uses peer-to-peer technology to operate - * with no central authority: managing transactions and issuing money are carried out collectively by the network. - * - * The software is a community-driven open source project, released under the MIT license. - * - * \section Navigation - * Use the buttons Namespaces, Classes or Files at the top of the page to start navigating the code. - */ - static void WaitForShutdown() { while (!ShutdownRequested()) From f343697869b1c7d51a20fdf240ade160146cd201 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 1 Oct 2019 12:13:47 +0200 Subject: [PATCH 5/7] Merge #17001: doc: Remove mention of renamed mapBlocksUnlinked fadd6e0d2a6a5104aa215f456987ad7374bcc6ce doc: Remove mention of renamed mapBlocksUnlinked (MarcoFalke) Pull request description: This has been renamed to `m_blocks_unlinked`. Instead of adjusting the internal variable name in the help text, explain the debug flag with more general terms. ACKs for top commit: practicalswift: ACK fadd6e0d2a6a5104aa215f456987ad7374bcc6ce -- diff looks correct promag: ACK fadd6e0d2a6a5104aa215f456987ad7374bcc6ce. laanwj: ACK fadd6e0d2a6a5104aa215f456987ad7374bcc6ce (as argument help is not translated this doesn't have to wait for the split-off) Tree-SHA512: 8ad64965ab5bbba4b92933a5adcb0c9eda5bdb0cc080840a4a97b12c67f41f9b789fd289df4932d748f5a7eebc7305a000f03ceb968a78c9b5d9f34af61f0b15 --- src/init.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/init.cpp b/src/init.cpp index 58d3905772..06a1459e46 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -650,7 +650,7 @@ void SetupServerArgs() hidden_args.emplace_back("-zmqpubrawtxlocksighwm="); #endif - gArgs.AddArg("-checkblockindex", strprintf("Do a full consistency check for the block tree, setBlockIndexCandidates, ::ChainActive() and mapBlocksUnlinked occasionally. (default: %u, regtest: %u)", defaultChainParams->DefaultConsistencyChecks(), regtestChainParams->DefaultConsistencyChecks()), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST); + gArgs.AddArg("-checkblockindex", strprintf("Do a consistency check for the block tree, and occasionally. (default: %u, regtest: %u)", defaultChainParams->DefaultConsistencyChecks(), regtestChainParams->DefaultConsistencyChecks()), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST); gArgs.AddArg("-checkblocks=", strprintf("How many blocks to check at startup (default: %u, 0 = all)", DEFAULT_CHECKBLOCKS), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST); gArgs.AddArg("-checklevel=", strprintf("How thorough the block verification of -checkblocks is: " "level 0 reads the blocks from disk, " From 08418364414cf7512662132f4daeff920925bb40 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Wed, 21 Aug 2019 08:21:54 -0400 Subject: [PATCH 6/7] Merge #16656: test: fix rpc_setban.py race 6011c9d72d1df5c2cd09de6f85c21eb4f7eb1ba8 QA: fix rpc_setban.py race (Jonas Schnelli) Pull request description: The new `rpc_setban.py` test failes regularly on CIs due to a race between injecting the ban and testing the log "on the other side". The problem is, that the test immediately after the `addnode` command on node0 checks for the `dropped (banned)` entry on node1 (without giving some time). Adding a 2 seconds sleep seems to solve the race (I guess there is no better event-driven delay). Example of a failed test: https://bitcoinbuilds.org/index.php?ansilog=bf743910-103f-4b54-9a97-960c471061bd.log#l2906 Top commit has no ACKs. Tree-SHA512: 680f8ea3e5ddb07e93f824f1aeff4a459e25e6c14715a39fc7670e50506d7cf25925348672c5c2d8ba3e1243ccf5effbc2456bcd094fb96868349f8d26e008f1 --- test/functional/rpc_setban.py | 2 +- test/functional/test_framework/test_node.py | 25 ++++++++++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/test/functional/rpc_setban.py b/test/functional/rpc_setban.py index 2c3b6a2a4b..0c6d3fc86c 100755 --- a/test/functional/rpc_setban.py +++ b/test/functional/rpc_setban.py @@ -26,7 +26,7 @@ class SetBanTests(BitcoinTestFramework): self.nodes[1].setban("127.0.0.1", "add") # Node 0 should not be able to reconnect - with self.nodes[1].assert_debug_log(expected_msgs=['dropped (banned)\n']): + with self.nodes[1].assert_debug_log(expected_msgs=['dropped (banned)\n'],timeout=5): self.restart_node(1, []) self.nodes[0].addnode("127.0.0.1:" + str(p2p_port(1)), "onetry") diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index cc4fb73238..22916b8ce3 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -309,7 +309,8 @@ class TestNode(): wait_until(self.is_node_stopped, timeout=timeout) @contextlib.contextmanager - def assert_debug_log(self, expected_msgs): + def assert_debug_log(self, expected_msgs, timeout=2): + time_end = time.time() + timeout chain = get_chain_folder(self.datadir, self.chain) debug_log = os.path.join(self.datadir, chain, 'debug.log') with open(debug_log, encoding='utf-8') as dl: @@ -318,13 +319,21 @@ class TestNode(): try: yield finally: - with open(debug_log, encoding='utf-8') as dl: - dl.seek(prev_size) - log = dl.read() - print_log = " - " + "\n - ".join(log.splitlines()) - for expected_msg in expected_msgs: - if re.search(re.escape(expected_msg), log, flags=re.MULTILINE) is None: - self._raise_assertion_error('Expected message "{}" does not partially match log:\n\n{}\n\n'.format(expected_msg, print_log)) + while True: + found = True + with open(debug_log, encoding='utf-8') as dl: + dl.seek(prev_size) + log = dl.read() + print_log = " - " + "\n - ".join(log.splitlines()) + for expected_msg in expected_msgs: + if re.search(re.escape(expected_msg), log, flags=re.MULTILINE) is None: + found = False + if found: + return + if time.time() >= time_end: + break + time.sleep(0.05) + self._raise_assertion_error('Expected messages "{}" does not partially match log:\n\n{}\n\n'.format(str(expected_msgs), print_log)) @contextlib.contextmanager def assert_memory_usage_stable(self, *, increase_allowed=0.03): From 7874e7852eb116bedbcccac2389c0d95137cd0c7 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Thu, 5 Sep 2019 13:28:39 +0200 Subject: [PATCH 7/7] Merge #16804: test: Remove unused try-block in assert_debug_log fae91a09c453a9a95c382df765bd71e54698d5b2 test: Remove incorrect and unused try-block in assert_debug_log (MarcoFalke) Pull request description: This try block has accidentally been added by me in fa3e9f7627784ee00980590e5bf044a0e1249999. It was unused all the time, but commit 6011c9d72d1df5c2cd09de6f85c21eb4f7eb1ba8 added a `return` in the finally block, muting all exceptions. This can be tested by adding an `assert False` after any `with ...assert_debug_log...:` line. ACKs for top commit: laanwj: ACK fae91a09c453a9a95c382df765bd71e54698d5b2 ryanofsky: utACK fae91a09c453a9a95c382df765bd71e54698d5b2. I didn't know returning inside a `finally` block would cancel pending exceptions or return values, but I guess this makes sense and is a good thing to be aware of. Tree-SHA512: 47ed0165062060e9af055a3e92f1a529cd41d00476bfad64e3cd141ae084d22f926a343bb1257717e164e15459a59ab66aed198c95d18bf780d8cb0b76aa3298 --- test/functional/rpc_setban.py | 2 +- test/functional/test_framework/test_node.py | 36 ++++++++++----------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/test/functional/rpc_setban.py b/test/functional/rpc_setban.py index 0c6d3fc86c..bb0e73f7d7 100755 --- a/test/functional/rpc_setban.py +++ b/test/functional/rpc_setban.py @@ -26,7 +26,7 @@ class SetBanTests(BitcoinTestFramework): self.nodes[1].setban("127.0.0.1", "add") # Node 0 should not be able to reconnect - with self.nodes[1].assert_debug_log(expected_msgs=['dropped (banned)\n'],timeout=5): + with self.nodes[1].assert_debug_log(expected_msgs=['dropped (banned)\n'], timeout=5): self.restart_node(1, []) self.nodes[0].addnode("127.0.0.1:" + str(p2p_port(1)), "onetry") diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index 22916b8ce3..77772f84d1 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -316,24 +316,24 @@ class TestNode(): with open(debug_log, encoding='utf-8') as dl: dl.seek(0, 2) prev_size = dl.tell() - try: - yield - finally: - while True: - found = True - with open(debug_log, encoding='utf-8') as dl: - dl.seek(prev_size) - log = dl.read() - print_log = " - " + "\n - ".join(log.splitlines()) - for expected_msg in expected_msgs: - if re.search(re.escape(expected_msg), log, flags=re.MULTILINE) is None: - found = False - if found: - return - if time.time() >= time_end: - break - time.sleep(0.05) - self._raise_assertion_error('Expected messages "{}" does not partially match log:\n\n{}\n\n'.format(str(expected_msgs), print_log)) + + yield + + while True: + found = True + with open(debug_log, encoding='utf-8') as dl: + dl.seek(prev_size) + log = dl.read() + print_log = " - " + "\n - ".join(log.splitlines()) + for expected_msg in expected_msgs: + if re.search(re.escape(expected_msg), log, flags=re.MULTILINE) is None: + found = False + if found: + return + if time.time() >= time_end: + break + time.sleep(0.05) + self._raise_assertion_error('Expected messages "{}" does not partially match log:\n\n{}\n\n'.format(str(expected_msgs), print_log)) @contextlib.contextmanager def assert_memory_usage_stable(self, *, increase_allowed=0.03):