mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-08-09 14:33:18 +00:00
fix(indexer): seed breakpoint meta only on fresh store
`RISC0_DEV_MODE=1 RISC0_SKIP_BUILD=1 cargo test -p storage -p indexer_core`
This commit is contained in:
parent
14da3e04c8
commit
3a86bcaf37
@ -88,9 +88,11 @@ impl RocksDBIO {
|
|||||||
|
|
||||||
let dbio = Self { db };
|
let dbio = Self { db };
|
||||||
|
|
||||||
// First breakpoint setup
|
// Seed the genesis snapshot once; reopening must not clobber breakpoint meta.
|
||||||
dbio.put_breakpoint(0, initial_state)?;
|
if dbio.get_meta_last_breakpoint_id()?.is_none() {
|
||||||
dbio.put_meta_last_breakpoint_id(0)?;
|
dbio.put_breakpoint(0, initial_state)?;
|
||||||
|
dbio.put_meta_last_breakpoint_id(0)?;
|
||||||
|
}
|
||||||
|
|
||||||
Ok(dbio)
|
Ok(dbio)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -471,3 +471,14 @@ fn account_map() {
|
|||||||
|
|
||||||
assert_eq!(acc1_tx_limited_hashes.as_slice(), &tx_hash_res[1..5]);
|
assert_eq!(acc1_tx_limited_hashes.as_slice(), &tx_hash_res[1..5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn reopen_preserves_breakpoint_meta() {
|
||||||
|
let temp_dir = tempdir().unwrap();
|
||||||
|
{
|
||||||
|
let dbio = RocksDBIO::open_or_create(temp_dir.path(), &initial_state()).unwrap();
|
||||||
|
dbio.put_meta_last_breakpoint_id(5).unwrap();
|
||||||
|
} // drop releases the RocksDB lock
|
||||||
|
let dbio = RocksDBIO::open_or_create(temp_dir.path(), &initial_state()).unwrap();
|
||||||
|
assert_eq!(dbio.get_meta_last_breakpoint_id().unwrap(), Some(5));
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user