@@ -395,6 +395,40 @@ def test_empty_snapshot(network, args):
395395 )
396396
397397
398+ def test_nulled_snapshot (network , args ):
399+
400+ with tempfile .TemporaryDirectory () as snapshots_dir :
401+ LOG .debug (f"Using { snapshots_dir } as snapshots directory" )
402+
403+ snapshot_name = "snapshot_1000_1500.committed"
404+
405+ with open (
406+ os .path .join (snapshots_dir , snapshot_name ), "wb+"
407+ ) as temp_empty_snapshot :
408+
409+ LOG .debug (f"Created empty snapshot { temp_empty_snapshot .name } " )
410+ temp_empty_snapshot .write (b"\x00 " * 64 )
411+
412+ LOG .info (
413+ "Attempt to join a node using the corrupted snapshot copy (should fail)"
414+ )
415+ new_node = network .create_node ("local://localhost" )
416+ failed = False
417+ try :
418+ network .join_node (
419+ new_node ,
420+ args .package ,
421+ args ,
422+ snapshots_dir = snapshots_dir ,
423+ )
424+ except Exception as e :
425+ failed = True
426+ LOG .info (f"Node failed to join as expected: { e } " )
427+
428+ # (Existing assertion logic retained)
429+ assert failed , "Node should not have joined successfully"
430+
431+
398432def split_all_ledger_files_in_dir (input_dir , output_dir ):
399433 # A ledger file can only be split at a seqno that contains a signature
400434 # (so that all files end on a signature that verifies their integrity).
@@ -486,6 +520,7 @@ def run_file_operations(args):
486520 test_large_snapshot (network , args )
487521 test_snapshot_access (network , args )
488522 test_empty_snapshot (network , args )
523+ test_nulled_snapshot (network , args )
489524
490525 primary , _ = network .find_primary ()
491526 # Scoped transactions are not handled by historical range queries
0 commit comments