@@ -288,6 +288,40 @@ def test_empty_snapshot(network, args):
288288 )
289289
290290
291+ def test_nulled_snapshot (network , args ):
292+
293+ with tempfile .TemporaryDirectory () as snapshots_dir :
294+ LOG .debug (f"Using { snapshots_dir } as snapshots directory" )
295+
296+ snapshot_name = "snapshot_1000_1500.committed"
297+
298+ with open (
299+ os .path .join (snapshots_dir , snapshot_name ), "wb+"
300+ ) as temp_empty_snapshot :
301+
302+ LOG .debug (f"Created empty snapshot { temp_empty_snapshot .name } " )
303+ temp_empty_snapshot .write (b"\x00 " * 64 )
304+
305+ LOG .info (
306+ "Attempt to join a node using the corrupted snapshot copy (should fail)"
307+ )
308+ new_node = network .create_node ("local://localhost" )
309+ failed = False
310+ try :
311+ network .join_node (
312+ new_node ,
313+ args .package ,
314+ args ,
315+ snapshots_dir = snapshots_dir ,
316+ )
317+ except Exception as e :
318+ failed = True
319+ LOG .info (f"Node failed to join as expected: { e } " )
320+
321+ # (Existing assertion logic retained)
322+ assert failed , "Node should not have joined successfully"
323+
324+
291325def split_all_ledger_files_in_dir (input_dir , output_dir ):
292326 # A ledger file can only be split at a seqno that contains a signature
293327 # (so that all files end on a signature that verifies their integrity).
@@ -376,6 +410,7 @@ def run_file_operations(args):
376410 test_forced_snapshot (network , args )
377411 test_large_snapshot (network , args )
378412 test_empty_snapshot (network , args )
413+ test_nulled_snapshot (network , args )
379414
380415 primary , _ = network .find_primary ()
381416 # Scoped transactions are not handled by historical range queries
0 commit comments