77to a hash that has been compiled into bitcoind.
88
99The assumeutxo value generated and used here is committed to in
10- `CRegTestParams::m_assumeutxo_data` in `src/chainparams.cpp`.
10+ `CRegTestParams::m_assumeutxo_data` in `src/kernel/ chainparams.cpp`.
1111
1212## Possible test improvements
1313
4040 assert_equal ,
4141 assert_raises_rpc_error ,
4242)
43- from test_framework .wallet import getnewdestination
44-
43+ from test_framework .wallet import (
44+ getnewdestination ,
45+ MiniWallet ,
46+ )
4547
4648START_HEIGHT = 199
4749SNAPSHOT_BASE_HEIGHT = 299
@@ -98,18 +100,18 @@ def expected_error(log_msg="", rpc_details=""):
98100
99101 self .log .info (" - snapshot file with alternated UTXO data" )
100102 cases = [
101- [b"\xff " * 32 , 0 , "05030e506678f2eca8d624ffed97090ab3beadad1b51ee6e5985ba91c5720e37 " ], # wrong outpoint hash
102- [(1 ).to_bytes (4 , "little" ), 32 , "7d29cfe2c1e242bc6f103878bb70cfffa8b4dac20dbd001ff6ce24b7de2d2399 " ], # wrong outpoint index
103- [b"\x81 " , 36 , "f03939a195531f96d5dff983e294a1af62af86049fa7a19a7627246f237c03f1 " ], # wrong coin code VARINT((coinbase ? 1 : 0) | (height << 1))
104- [b"\x83 " , 36 , "e4577da84590fb288c0f7967e89575e1b0aa46624669640f6f5dfef028d39930 " ], # another wrong coin code
103+ [b"\xff " * 32 , 0 , "7d52155c9a9fdc4525b637ef6170568e5dad6fabd0b1fdbb9432010b8453095b " ], # wrong outpoint hash
104+ [(1 ).to_bytes (4 , "little" ), 32 , "9f4d897031ab8547665b4153317ae2fdbf0130c7840b66427ebc48b881cb80ad " ], # wrong outpoint index
105+ [b"\x81 " , 36 , "3da966ba9826fb6d2604260e01607b55ba44e1a5de298606b08704bc62570ea8 " ], # wrong coin code VARINT((coinbase ? 1 : 0) | (height << 1))
106+ [b"\x80 " , 36 , "091e893b3ccb4334378709578025356c8bcb0a623f37c7c4e493133c988648e5 " ], # another wrong coin code
105107 ]
106108
107109 for content , offset , wrong_hash in cases :
108110 with open (bad_snapshot_path , "wb" ) as f :
109111 f .write (valid_snapshot_contents [:(32 + 8 + offset )])
110112 f .write (content )
111113 f .write (valid_snapshot_contents [(32 + 8 + offset + len (content )):])
112- expected_error (log_msg = f"[snapshot] bad snapshot content hash: expected 61d9c2b29a2571a5fe285fe2d8554f91f93309666fc9b8223ee96338de25ff53 , got { wrong_hash } " )
114+ expected_error (log_msg = f"[snapshot] bad snapshot content hash: expected a4bf3407ccb2cc0145c49ebba8fa91199f8a3903daf0883875941497d2493c27 , got { wrong_hash } " )
113115
114116 def test_invalid_chainstate_scenarios (self ):
115117 self .log .info ("Test different scenarios of invalid snapshot chainstate in datadir" )
@@ -145,6 +147,8 @@ def run_test(self):
145147 n1 = self .nodes [1 ]
146148 n2 = self .nodes [2 ]
147149
150+ self .mini_wallet = MiniWallet (n0 )
151+
148152 # Mock time for a deterministic chain
149153 for n in self .nodes :
150154 n .setmocktime (n .getblockheader (n .getbestblockhash ())['time' ])
@@ -157,6 +161,8 @@ def run_test(self):
157161 # isn't waiting forever to see the header of the snapshot's base block
158162 # while disconnected from n0.
159163 for i in range (100 ):
164+ if i % 3 == 0 :
165+ self .mini_wallet .send_self_transfer (from_node = n0 )
160166 self .generate (n0 , nblocks = 1 , sync_fun = self .no_op )
161167 newblock = n0 .getblock (n0 .getbestblockhash (), 0 )
162168
@@ -178,8 +184,8 @@ def run_test(self):
178184
179185 assert_equal (
180186 dump_output ['txoutset_hash' ],
181- '61d9c2b29a2571a5fe285fe2d8554f91f93309666fc9b8223ee96338de25ff53' )
182- assert_equal (dump_output [' nchaintx' ], 300 )
187+ "a4bf3407ccb2cc0145c49ebba8fa91199f8a3903daf0883875941497d2493c27" )
188+ assert_equal (dump_output [" nchaintx" ], 334 )
183189 assert_equal (n0 .getblockchaininfo ()["blocks" ], SNAPSHOT_BASE_HEIGHT )
184190
185191 # Mine more blocks on top of the snapshot that n1 hasn't yet seen. This
0 commit comments