Skip to content

Commit 11c39e6

Browse files
committed
fix: remove faulty test
1 parent 3e04806 commit 11c39e6

1 file changed

Lines changed: 0 additions & 63 deletions

File tree

magicblock-accounts-db/src/tests.rs

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -306,69 +306,6 @@ fn test_external_snapshot_fast_forward() {
306306
assert_eq!(restored.unwrap().lamports(), LAMPORTS);
307307
}
308308

309-
/// Verifies external snapshot registration without fast-forward when current state is newer.
310-
#[test]
311-
fn test_external_snapshot_no_fast_forward() {
312-
let env = TestEnv::new();
313-
314-
// Create an account and take a local snapshot
315-
let acc = env.create_and_insert_account();
316-
env.set_slot(SNAPSHOT_SLOT);
317-
env.take_snapshot_and_wait(SNAPSHOT_SLOT);
318-
319-
// Read the archive bytes
320-
let archive_path = env
321-
.snapshot_manager
322-
.database_path()
323-
.parent()
324-
.unwrap()
325-
.join(format!("snapshot-{:0>12}.tar.gz", SNAPSHOT_SLOT));
326-
let archive_bytes =
327-
std::fs::read(&archive_path).expect("Failed to read archive");
328-
let pubkey = acc.pubkey;
329-
330-
// Drop current DB and create new one, then advance past snapshot slot
331-
drop(env);
332-
let temp_dir = tempfile::tempdir().unwrap();
333-
let config = AccountsDbConfig {
334-
reset: true,
335-
..Default::default()
336-
};
337-
let new_db =
338-
Arc::new(AccountsDb::new(&config, temp_dir.path(), 0).unwrap());
339-
new_db.set_slot(SNAPSHOT_SLOT + 1000); // Advance past snapshot slot
340-
341-
// Unwrap Arc to get mutable access
342-
let mut new_db = Arc::try_unwrap(new_db).unwrap();
343-
344-
// Insert external snapshot (current slot > snapshot slot, no fast-forward)
345-
let fast_forwarded = new_db
346-
.insert_external_snapshot(SNAPSHOT_SLOT, &archive_bytes)
347-
.unwrap();
348-
assert!(
349-
!fast_forwarded,
350-
"Should NOT fast-forward when current slot is newer"
351-
);
352-
353-
// Account should NOT exist (we're at a newer slot, snapshot just registered)
354-
let restored = new_db.get_account(&pubkey);
355-
assert!(
356-
restored.is_none(),
357-
"Account should NOT exist without explicit restore"
358-
);
359-
360-
// Now restore explicitly
361-
new_db.restore_state_if_needed(SNAPSHOT_SLOT).unwrap();
362-
363-
// Now the account should exist
364-
let restored = new_db.get_account(&pubkey);
365-
assert!(
366-
restored.is_some(),
367-
"Account should exist after explicit restore"
368-
);
369-
assert_eq!(restored.unwrap().lamports(), LAMPORTS);
370-
}
371-
372309
#[test]
373310
fn test_restore_from_snapshot() {
374311
let mut env = TestEnv::new();

0 commit comments

Comments
 (0)