@@ -73,17 +73,12 @@ def test_invalid_snapshot_scenarios(self, valid_snapshot_path):
7373 bad_snapshot_path = valid_snapshot_path + '.mod'
7474
7575 self .log .info (" - snapshot file refering to a block that is not in the assumeutxo parameters" )
76- # we can only test this with a block that is already known, as otherwise the `loadtxoutset` RPC
77- # would time out (waiting to see the hash in the headers chain), rather than error immediately
78- bad_snapshot_height = SNAPSHOT_BASE_HEIGHT - 1
76+ bad_snapshot_block_hash = self .nodes [0 ].getblockhash (SNAPSHOT_BASE_HEIGHT - 1 )
7977 with open (bad_snapshot_path , 'wb' ) as f :
80- bad_snapshot_block_hash = self .nodes [0 ].getblockhash (bad_snapshot_height )
8178 # block hash of the snapshot base is stored right at the start (first 32 bytes)
8279 f .write (bytes .fromhex (bad_snapshot_block_hash )[::- 1 ] + valid_snapshot_contents [32 :])
83-
84- expected_log = f"assumeutxo height in snapshot metadata not recognized ({ bad_snapshot_height } ) - refusing to load snapshot"
85- with self .nodes [1 ].assert_debug_log ([expected_log ]):
86- assert_raises_rpc_error (- 32603 , "Unable to load UTXO snapshot" , self .nodes [1 ].loadtxoutset , bad_snapshot_path )
80+ error_details = f"assumeutxo block hash in snapshot metadata not recognized ({ bad_snapshot_block_hash } )"
81+ assert_raises_rpc_error (- 32603 , f"Unable to load UTXO snapshot, { error_details } " , self .nodes [1 ].loadtxoutset , bad_snapshot_path )
8782
8883 self .log .info (" - snapshot file with wrong number of coins" )
8984 valid_num_coins = struct .unpack ("<I" , valid_snapshot_contents [32 :32 + 4 ])[0 ]
0 commit comments