mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-16 16:32:47 +00:00
test: Remove unused feature_segwit.py functions
Unused after commit c847dee1488a294c9a9632a00ba1134b21e41947
This commit is contained in:
parent
fa6b05c96f
commit
fa90b21430
@ -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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user