diff --git a/test/functional/feature_blocksign.py b/test/functional/feature_blocksign.py index 0701016eb9..836c16a69b 100755 --- a/test/functional/feature_blocksign.py +++ b/test/functional/feature_blocksign.py @@ -171,7 +171,7 @@ class BlockSignTest(BitcoinTestFramework): self.nodes[i].submitblock(result["hex"]) # All nodes should be synced in blocks and transactions(mempool should be empty) - self.sync_all() + self.sync_all(expect_disconnected=True) def mine_blocks(self, num_blocks, transactions): for i in range(num_blocks): diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index 1ffcadf204..29406955e5 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -604,7 +604,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): self.connect_nodes(1, 2) self.sync_all() - def sync_blocks(self, nodes=None, wait=1, timeout=60): + def sync_blocks(self, nodes=None, wait=1, timeout=60, expect_disconnected=False): """ Wait until everybody has the same tip. sync_blocks needs to be called with an rpc_connections set that has least @@ -618,8 +618,8 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): best_hash = [x.getbestblockhash() for x in rpc_connections] if best_hash.count(best_hash[0]) == len(rpc_connections): return - # Check that each peer has at least one connection - assert (all([len(x.getpeerinfo()) for x in rpc_connections])) + if not expect_disconnected: + assert (all([len(x.getpeerinfo()) for x in rpc_connections])) time.sleep(wait) raise AssertionError("Block sync timed out after {}s:{}".format( timeout, @@ -649,8 +649,8 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): "".join("\n {!r}".format(m) for m in pool), )) - def sync_all(self, nodes=None): - self.sync_blocks(nodes) + def sync_all(self, nodes=None, expect_disconnected=False): + self.sync_blocks(nodes, expect_disconnected=expect_disconnected) self.sync_mempools(nodes) def wait_until(self, test_function, timeout=60):