Skip to content

Commit fab1fb7

Browse files
author
MarcoFalke
committed
[qa] blockchain: Pass on closed connection during generate call
1 parent c68a9a6 commit fab1fb7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/functional/blockchain.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"""
1919

2020
from decimal import Decimal
21+
import http.client
2122
import subprocess
2223

2324
from test_framework.test_framework import BitcoinTestFramework
@@ -28,6 +29,7 @@
2829
assert_is_hex_string,
2930
assert_is_hash_string,
3031
bitcoind_processes,
32+
BITCOIND_PROC_WAIT_TIMEOUT,
3133
)
3234

3335

@@ -140,9 +142,12 @@ def _test_stopatheight(self):
140142
assert_equal(self.nodes[0].getblockcount(), 206)
141143
self.log.debug('Node should not stop at this height')
142144
assert_raises(subprocess.TimeoutExpired, lambda: bitcoind_processes[0].wait(timeout=3))
143-
self.nodes[0].generate(1)
145+
try:
146+
self.nodes[0].generate(1)
147+
except (ConnectionError, http.client.BadStatusLine):
148+
pass # The node already shut down before response
144149
self.log.debug('Node should stop at this height...')
145-
bitcoind_processes[0].wait(timeout=3)
150+
bitcoind_processes[0].wait(timeout=BITCOIND_PROC_WAIT_TIMEOUT)
146151
self.nodes[0] = self.start_node(0, self.options.tmpdir)
147152
assert_equal(self.nodes[0].getblockcount(), 207)
148153

0 commit comments

Comments
 (0)