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

Code before:
            "-debugexclude=rand",
            "-uacomment=testnode%d" % i,
        ]
        if self.descriptors is None:
            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.default_to_v2:
            self.args.append("-v2transport=1")

        self.cli = TestNodeCLI(bitcoin_cli, self.datadir_path)
        self.use_cli = use_cli
        self.start_perf = start_perf

        self.running = False
        self.process = None
        self.rpc_connected = False
        self.rpc = None
        self.url = None
        self.log = logging.getLogger('TestFramework.node%d' % i)
        self.cleanup_on_exit = True # Whether to kill the node when this object goes away
        # Cache perf subprocesses here by their data output filename.
        self.perf_subprocesses = {}

        self.p2ps = []
        self.timeout_factor = timeout_factor

        self.mocktime = None

    AddressKeyPair = collections.namedtuple('AddressKeyPair', ['address', 'key'])
    PRIV_KEYS = [
            # address , privkey
            AddressKeyPair('mjTkW3DjgyZck4KbiRusZsqTgaYTxdSz6z', 'cVpF924EspNh8KjYsfhgY96mmxvT6DgdWiTYMtMjuM74hJaU5psW'),

Review comment (suggestion):
i'm not sure we want to keep `default_to_v2`. It's kinda unused now, and I'm not sure future tests would ever find it useful.

Code after:
            "-debugexclude=rand",
            "-uacomment=testnode%d" % i,
        ]
        if self.descriptors is None:
            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:
                self.args.append("-v2transport=1")
            else:
                self.args.append("-v2transport=0")
        else:
            # v2transport requested but not supported for node
            assert not v2transport

        self.cli = TestNodeCLI(bitcoin_cli, self.datadir_path)
        self.use_cli = use_cli
        self.start_perf = start_perf

        self.running = False
        self.process = None
        self.rpc_connected = False
        self.rpc = None
        self.url = None
        self.log = logging.getLogger('TestFramework.node%d' % i)
        self.cleanup_on_exit = True # Whether to kill the node when this object goes away
        # Cache perf subprocesses here by their data output filename.
        self.perf_subprocesses = {}

        self.p2ps = []
        self.timeout_factor = timeout_factor