Repository: bitcoin/bitcoin
File: test/functional/test_framework/test_node.py (Python)

Code before:
        self.rpc_timeout = timewait
        self.binaries = binaries
        self.coverage_dir = coverage_dir
        self.cwd = cwd
        self.has_explicit_bind = False
        if extra_conf is not None:
            append_config(self.datadir_path, extra_conf)
            # Remember if there is bind=... in the config file.
            self.has_explicit_bind = any(e.startswith("bind=") for e in extra_conf)
        # Most callers will just need to add extra args to the standard list below.
        # For those callers that need more flexibility, they can just set the args property directly.
        # Note that common args are set in the config file (see initialize_datadir)
        self.extra_args = extra_args
        self.version = version
        # Configuration for logging is set as command-line args rather than in the bitcoin.conf file.
        # This means that starting a bitcoind using the temp dir to debug a failed test won't
        # spam debug.log.
        self.args = self.binaries.node_argv() + [
            f"-datadir={self.datadir_path}",
            "-logtimemicros",
            "-debug",
            "-debugexclude=libevent",
            "-debugexclude=leveldb",
            "-debugexclude=rand",
            "-uacomment=testnode%d" % i,  # required for subversion uniqueness across peers
        ]
        if uses_wallet is not None and not uses_wallet:
            self.args.append("-disablewallet")

        # Use valgrind, expect for previous release binaries
        if use_valgrind and version is None:
            default_suppressions_file = Path(__file__).parents[3] / "contrib" / "valgrind.supp"
            suppressions_file = os.getenv("VALGRIND_SUPPRESSIONS_FILE",
                                          default_suppressions_file)
            self.args = ["valgrind", "--suppressions={}".format(suppressions_file),
                         "--gen-suppressions=all", "--exit-on-first-error=yes",
                         "--error-exitcode=1", "--quiet"] + self.args

        if self.version_is_at_least(190000):
            self.args.append("-logthreadnames")
        if self.version_is_at_least(219900):
            self.args.append("-logsourcelocations")
        if self.version_is_at_least(239000):
            self.args.append("-loglevel=trace")

        # Default behavior from global -v2transport flag is added to args to persist it over restarts.
        # May be overwritten in individual tests, using extra_args.
        self.default_to_v2 = v2transport
        if self.version_is_at_least(260000):
            # 26.0 and later support v2transport
            if v2transport:

Review comment (suggestion):
this has to be guarded, see e.g. the `logthreadnames` below

Code after:
        self.rpc_timeout = timewait
        self.binaries = binaries
        self.coverage_dir = coverage_dir
        self.cwd = cwd
        self.has_explicit_bind = False
        if extra_conf is not None:
            append_config(self.datadir_path, extra_conf)
            # Remember if there is bind=... in the config file.
            self.has_explicit_bind = any(e.startswith("bind=") for e in extra_conf)
        # Most callers will just need to add extra args to the standard list below.
        # For those callers that need more flexibility, they can just set the args property directly.
        # Note that common args are set in the config file (see initialize_datadir)
        self.extra_args = extra_args
        self.version = version
        # Configuration for logging is set as command-line args rather than in the bitcoin.conf file.
        # This means that starting a bitcoind using the temp dir to debug a failed test won't
        # spam debug.log.
        self.args = self.binaries.node_argv() + [
            f"-datadir={self.datadir_path}",
            "-logtimemicros",
            "-debug",
            "-debugexclude=libevent",
            "-debugexclude=leveldb",
            "-debugexclude=rand",
            "-uacomment=testnode%d" % i,  # required for subversion uniqueness across peers
        ]
        if uses_wallet is not None and not uses_wallet:
            self.args.append("-disablewallet")

        # Use valgrind, expect for previous release binaries
        if use_valgrind and version is None:
            default_suppressions_file = Path(__file__).parents[3] / "contrib" / "valgrind.supp"
            suppressions_file = os.getenv("VALGRIND_SUPPRESSIONS_FILE",
                                          default_suppressions_file)
            self.args = ["valgrind", "--suppressions={}".format(suppressions_file),
                         "--gen-suppressions=all", "--exit-on-first-error=yes",
                         "--error-exitcode=1", "--quiet"] + self.args

        if self.version_is_at_least(190000):
            self.args.append("-logthreadnames")
        if self.version_is_at_least(219900):
            self.args.append("-logsourcelocations")
        if self.version_is_at_least(239000):
            self.args.append("-loglevel=trace")
        if self.version_is_at_least(299900):
            self.args.append("-nologratelimit")

        # Default behavior from global -v2transport flag is added to args to persist it over restarts.
        # May be overwritten in individual tests, using extra_args.
        self.default_to_v2 = v2transport
        if self.version_is_at_least(260000):