From fab5072ce1396484b9caa7320da4dc3c98070adc Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Thu, 12 Mar 2026 13:23:50 +0100 Subject: [PATCH 1/6] ci: Remove vulture --- ci/lint/01_install.sh | 3 +-- test/lint/README.md | 1 - test/lint/lint-python-dead-code.py | 41 ------------------------------ 3 files changed, 1 insertion(+), 44 deletions(-) delete mode 100755 test/lint/lint-python-dead-code.py diff --git a/ci/lint/01_install.sh b/ci/lint/01_install.sh index 4cf695b817b..9372df5a9bd 100755 --- a/ci/lint/01_install.sh +++ b/ci/lint/01_install.sh @@ -44,8 +44,7 @@ ${CI_RETRY_EXE} pip3 install \ lief==0.16.6 \ mypy==1.19.1 \ pyzmq==27.1.0 \ - ruff==0.15.5 \ - vulture==2.14 + ruff==0.15.5 SHELLCHECK_VERSION=v0.11.0 curl -sL "https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" | \ diff --git a/test/lint/README.md b/test/lint/README.md index e98522a7e60..08703ab8efb 100644 --- a/test/lint/README.md +++ b/test/lint/README.md @@ -52,7 +52,6 @@ or `--help`: | [`lint-python.py`](/test/lint/lint-python.py) | [lief](https://github.com/lief-project/LIEF) | [`lint-python.py`](/test/lint/lint-python.py) | [mypy](https://github.com/python/mypy) | [`lint-python.py`](/test/lint/lint-python.py) | [pyzmq](https://github.com/zeromq/pyzmq) -| [`lint-python-dead-code.py`](/test/lint/lint-python-dead-code.py) | [vulture](https://github.com/jendrikseipp/vulture) | [`lint-shell.py`](/test/lint/lint-shell.py) | [ShellCheck](https://github.com/koalaman/shellcheck) | `py_lint` | [ruff](https://github.com/astral-sh/ruff) | markdown link check | [mlc](https://github.com/becheran/mlc) diff --git a/test/lint/lint-python-dead-code.py b/test/lint/lint-python-dead-code.py deleted file mode 100755 index cd6471e2ab7..00000000000 --- a/test/lint/lint-python-dead-code.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (c) 2022-present The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -""" -Find dead Python code. -""" - -from subprocess import check_output, STDOUT, CalledProcessError - -FILES_ARGS = ['git', 'ls-files', '--', '*.py'] - - -def check_vulture_install(): - try: - check_output(["vulture", "--version"]) - except FileNotFoundError: - print("Skipping Python dead code linting since vulture is not installed. Install by running \"pip3 install vulture\"") - exit(0) - - -def main(): - check_vulture_install() - - files = check_output(FILES_ARGS, text=True).splitlines() - # --min-confidence 100 will only report code that is guaranteed to be unused within the analyzed files. - # Any value below 100 introduces the risk of false positives, which would create an unacceptable maintenance burden. - vulture_args = ['vulture', '--min-confidence=100'] + files - - try: - check_output(vulture_args, stderr=STDOUT, text=True) - except CalledProcessError as e: - print(e.output, end="") - print("Python dead code detection found some issues") - exit(1) - - -if __name__ == "__main__": - main() From fa803710e2783c92e803d0c4e57ae32b34947738 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Thu, 12 Mar 2026 14:53:18 +0100 Subject: [PATCH 2/6] test: Remove unused AddressType unused after commit c847dee1488a294c9a9632a00ba1134b21e41947 --- test/functional/test_framework/address.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/test/functional/test_framework/address.py b/test/functional/test_framework/address.py index 0f7de20b21f..f07019d2629 100644 --- a/test/functional/test_framework/address.py +++ b/test/functional/test_framework/address.py @@ -8,7 +8,6 @@ - bech32 segwit v0 P2WPKH and P2WSH addresses. - bech32m segwit v1 P2TR addresses.""" -import enum import unittest from .script import ( @@ -37,13 +36,6 @@ ADDRESS_BCRT1_UNSPENDABLE_DESCRIPTOR = 'addr(bcrt1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqq # Coins sent to this address can be spent with a witness stack of just OP_TRUE ADDRESS_BCRT1_P2WSH_OP_TRUE = 'bcrt1qft5p2uhsdcdc3l2ua4ap5qqfg4pjaqlp250x7us7a8qqhrxrxfsqseac85' - -class AddressType(enum.Enum): - bech32 = 'bech32' - p2sh_segwit = 'p2sh-segwit' - legacy = 'legacy' # P2PKH - - b58chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' From fa388a35855cc53d1a48d464c1bdcf793a0e2968 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Thu, 12 Mar 2026 15:10:28 +0100 Subject: [PATCH 3/6] test: Remove unused self.p2p_conn_index = 1 Was never used --- test/functional/test_framework/test_node.py | 1 - 1 file changed, 1 deletion(-) diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index 4bcf01e37c0..f2032bc458a 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -120,7 +120,6 @@ class TestNode(): """ self.index = i - self.p2p_conn_index = 1 self.datadir_path = datadir_path self.bitcoinconf = self.datadir_path / "bitcoin.conf" self.stdout_dir = self.datadir_path / "stdout" From fa7bac94d87a1b25f8b33ebd29ce47bf442f137e Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Thu, 12 Mar 2026 14:59:03 +0100 Subject: [PATCH 4/6] test: Remove unused wait_for_addr, firstAddrnServices, on_addr Unused after commit be25ac3092b7755e26e1ec6c33a27cd0e3dd9eac --- test/functional/p2p_node_network_limited.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/functional/p2p_node_network_limited.py b/test/functional/p2p_node_network_limited.py index 8140823f58a..8e1062cde2e 100755 --- a/test/functional/p2p_node_network_limited.py +++ b/test/functional/p2p_node_network_limited.py @@ -28,15 +28,9 @@ from test_framework.util import ( NODE_NETWORK_LIMITED_MIN_BLOCKS = 288 class P2PIgnoreInv(P2PInterface): - firstAddrnServices = 0 def on_inv(self, message): # The node will send us invs for other blocks. Ignore them. pass - def on_addr(self, message): - self.firstAddrnServices = message.addrs[0].nServices - def wait_for_addr(self, timeout=5): - test_function = lambda: self.last_message.get("addr") - self.wait_until(test_function, timeout=timeout) def send_getdata_for_block(self, blockhash): getdata_request = msg_getdata() getdata_request.inv.append(CInv(MSG_BLOCK, int(blockhash, 16))) From fa6b05c96ffb6cef42bf8907759d0d99f97a2e22 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Thu, 12 Mar 2026 15:07:50 +0100 Subject: [PATCH 5/6] test: Remove unused CUSTOM_._COUNT Unused after commit cf3ab8e1d0a2f2bdf72e61e2c2dcb35987e5b9bd --- test/functional/mempool_updatefromblock.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/functional/mempool_updatefromblock.py b/test/functional/mempool_updatefromblock.py index 11571f6f430..a5b2b6ced9a 100755 --- a/test/functional/mempool_updatefromblock.py +++ b/test/functional/mempool_updatefromblock.py @@ -19,9 +19,6 @@ from test_framework.mempool_util import DEFAULT_CLUSTER_LIMIT MAX_DISCONNECTED_TX_POOL_BYTES = 20_000_000 -CUSTOM_ANCESTOR_COUNT = 100 -CUSTOM_DESCENDANT_COUNT = CUSTOM_ANCESTOR_COUNT - class MempoolUpdateFromBlockTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 1 From fa90b21430b4f3bae6f4092a27e611bb06f2777f Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Thu, 12 Mar 2026 15:17:33 +0100 Subject: [PATCH 6/6] test: Remove unused feature_segwit.py functions Unused after commit c847dee1488a294c9a9632a00ba1134b21e41947 --- test/functional/feature_segwit.py | 65 ------------------------------- 1 file changed, 65 deletions(-) diff --git a/test/functional/feature_segwit.py b/test/functional/feature_segwit.py index dc5dde9ca51..35c9459c675 100755 --- a/test/functional/feature_segwit.py +++ b/test/functional/feature_segwit.py @@ -29,11 +29,7 @@ from test_framework.script import ( OP_TRUE, ) from test_framework.script_util import ( - key_to_p2pk_script, - key_to_p2wpkh_script, keys_to_multisig_script, - script_to_p2sh_script, - script_to_p2wsh_script, ) from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( @@ -67,9 +63,6 @@ def find_spendable_utxo(node, min_value): raise AssertionError(f"Unspent output equal or higher than {min_value} not found") -txs_mined = {} # txindex from txid to blockhash - - class SegWitTest(BitcoinTestFramework): def set_test_params(self): self.setup_clean_chain = True @@ -298,64 +291,6 @@ class SegWitTest(BitcoinTestFramework): # Mine a block to clear the gbt cache again. self.generate(self.nodes[0], 1) - def mine_and_test_listunspent(self, script_list, ismine): - utxo = find_spendable_utxo(self.nodes[0], 50) - tx = CTransaction() - tx.vin.append(CTxIn(COutPoint(int('0x' + utxo['txid'], 0), utxo['vout']))) - for i in script_list: - tx.vout.append(CTxOut(10000000, i)) - signresults = self.nodes[0].signrawtransactionwithwallet(tx.serialize_without_witness().hex())['hex'] - txid = self.nodes[0].sendrawtransaction(hexstring=signresults, maxfeerate=0) - txs_mined[txid] = self.generate(self.nodes[0], 1)[0] - watchcount = 0 - spendcount = 0 - for i in self.nodes[0].listunspent(): - if i['txid'] == txid: - watchcount += 1 - if i['spendable']: - spendcount += 1 - if ismine == 2: - assert_equal(spendcount, len(script_list)) - elif ismine == 1: - assert_equal(watchcount, len(script_list)) - assert_equal(spendcount, 0) - else: - assert_equal(watchcount, 0) - return txid - - def p2sh_address_to_script(self, v): - bare = CScript(bytes.fromhex(v['hex'])) - p2sh = CScript(bytes.fromhex(v['scriptPubKey'])) - p2wsh = script_to_p2wsh_script(bare) - p2sh_p2wsh = script_to_p2sh_script(p2wsh) - return [bare, p2sh, p2wsh, p2sh_p2wsh] - - def p2pkh_address_to_script(self, v): - pubkey = bytes.fromhex(v['pubkey']) - p2wpkh = key_to_p2wpkh_script(pubkey) - p2sh_p2wpkh = script_to_p2sh_script(p2wpkh) - p2pk = key_to_p2pk_script(pubkey) - p2pkh = CScript(bytes.fromhex(v['scriptPubKey'])) - p2sh_p2pk = script_to_p2sh_script(p2pk) - p2sh_p2pkh = script_to_p2sh_script(p2pkh) - p2wsh_p2pk = script_to_p2wsh_script(p2pk) - p2wsh_p2pkh = script_to_p2wsh_script(p2pkh) - p2sh_p2wsh_p2pk = script_to_p2sh_script(p2wsh_p2pk) - p2sh_p2wsh_p2pkh = script_to_p2sh_script(p2wsh_p2pkh) - return [p2wpkh, p2sh_p2wpkh, p2pk, p2pkh, p2sh_p2pk, p2sh_p2pkh, p2wsh_p2pk, p2wsh_p2pkh, p2sh_p2wsh_p2pk, p2sh_p2wsh_p2pkh] - - def create_and_mine_tx_from_txids(self, txids, success=True): - tx = CTransaction() - for i in txids: - txraw = self.nodes[0].getrawtransaction(i, 0, txs_mined[i]) - txtmp = tx_from_hex(txraw) - for j in range(len(txtmp.vout)): - tx.vin.append(CTxIn(COutPoint(int('0x' + i, 0), j))) - tx.vout.append(CTxOut(0, CScript())) - signresults = self.nodes[0].signrawtransactionwithwallet(tx.serialize_without_witness().hex())['hex'] - self.nodes[0].sendrawtransaction(hexstring=signresults, maxfeerate=0) - self.generate(self.nodes[0], 1) - if __name__ == '__main__': SegWitTest(__file__).main()