def assert_start_raises_init_error(self, i, dirname, extra_args=None, expected_msg=None):
    with tempfile.SpooledTemporaryFile(max_size=(2 ** 16)) as log_stderr:
        try:
            self.start_node(i, dirname, extra_args, stderr=log_stderr)
            self.stop_node(i)
        except Exception as e:
            assert ('bitcoind exited' in str(e))
            self.nodes[i].running = False
            self.nodes[i].process = None
            if (expected_msg is not None):
                log_stderr.seek(0)
                stderr = log_stderr.read().decode('utf-8')
                if (expected_msg not in stderr):
                    raise AssertionError(((('Expected error "' + expected_msg) + '" not found in:\n') + stderr))
        else:
            if (expected_msg is None):
                assert_msg = 'bitcoind should have exited with an error'
            else:
                assert_msg = ('bitcoind should have exited with expected error ' + expected_msg)
            raise AssertionError(assert_msg)
def assert_start_raises_init_error(self, i, dirname, extra_args=None, expected_msg=None):
    with tempfile.SpooledTemporaryFile(max_size=(2 ** 16)) as log_stderr:
        try:
            self.start_node(i, dirname, extra_args, stderr=log_stderr)
            self.stop_node(i)
        except Exception as e:
            assert ('bitcoind exited' in str(e))
            self.nodes[i].running = False
            self.nodes[i].process = None
            if (expected_msg is not None):
                log_stderr.seek(0)
                stderr = log_stderr.read().decode('utf-8')
                if (expected_msg not in stderr):
                    raise AssertionError(((('Expected error "' + expected_msg) + '" not found in:\n') + stderr))
        else:
            if (expected_msg is None):
                assert_msg = 'bitcoind should have exited with an error'
            else:
                assert_msg = ('bitcoind should have exited with expected error ' + expected_msg)
            raise AssertionError(assert_msg)