diff --git a/test/functional/assumevalid.py b/test/functional/assumevalid.py --- a/test/functional/assumevalid.py +++ b/test/functional/assumevalid.py @@ -70,6 +70,8 @@ def send_blocks_until_disconnected(self, node): """Keep sending blocks to the node until we're disconnected.""" for i in range(len(self.blocks)): + if not node.connection: + break try: node.send_message(msg_block(self.blocks[i])) except IOError as e: