6
6
7
7
import struct
8
8
9
- from test_framework .blocktools import create_transaction
10
9
from test_framework .messages import (
11
10
CBlock ,
12
11
COutPoint ,
15
14
from test_framework .muhash import MuHash3072
16
15
from test_framework .test_framework import BitcoinTestFramework
17
16
from test_framework .util import assert_equal
17
+ from test_framework .wallet import MiniWallet
18
18
19
19
class UTXOSetHashTest (BitcoinTestFramework ):
20
20
def set_test_params (self ):
21
21
self .num_nodes = 1
22
22
self .setup_clean_chain = True
23
23
24
- def skip_test_if_missing_module (self ):
25
- self .skip_if_no_wallet ()
26
-
27
24
def test_deterministic_hash_results (self ):
28
25
self .log .info ("Test deterministic UTXO set hash results" )
29
26
@@ -35,18 +32,17 @@ def test_muhash_implementation(self):
35
32
self .log .info ("Test MuHash implementation consistency" )
36
33
37
34
node = self .nodes [0 ]
35
+ wallet = MiniWallet (node )
38
36
39
37
# Generate 100 blocks and remove the first since we plan to spend its
40
38
# coinbase
41
- block_hashes = node .generate (100 )
39
+ block_hashes = wallet . generate ( 1 ) + node .generate (99 )
42
40
blocks = list (map (lambda block : FromHex (CBlock (), node .getblock (block , False )), block_hashes ))
43
- spending = blocks .pop (0 )
41
+ blocks .pop (0 )
44
42
45
43
# Create a spending transaction and mine a block which includes it
46
- tx = create_transaction (node , spending .vtx [0 ].rehash (), node .getnewaddress (), amount = 49 )
47
- txid = node .sendrawtransaction (hexstring = tx .serialize_with_witness ().hex (), maxfeerate = 0 )
48
-
49
- tx_block = node .generateblock (output = node .getnewaddress (), transactions = [txid ])
44
+ txid = wallet .send_self_transfer (from_node = node )['txid' ]
45
+ tx_block = node .generateblock (output = wallet .get_address (), transactions = [txid ])
50
46
blocks .append (FromHex (CBlock (), node .getblock (tx_block ['hash' ], False )))
51
47
52
48
# Serialize the outputs that should be in the UTXO set and add them to
0 commit comments