From fa90b21430b4f3bae6f4092a27e611bb06f2777f Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Thu, 12 Mar 2026 15:17:33 +0100 Subject: [PATCH] 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()