Skip to content

Commit

Permalink
Add overwrite_metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
iamyulong committed Nov 20, 2024
1 parent 7511806 commit 7647ee2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions radix-substate-store-impls/src/rocks_db_with_merkle_tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ impl RocksDBWithMerkleTreeSubstateStore {
})
.unwrap_or(Hash([0u8; Hash::LENGTH]))
}

pub fn overwrite_metadata(&mut self, meta: &Metadata) {
self.db
.put_cf(self.cf(META_CF), &[], scrypto_encode(meta).unwrap())
.unwrap();
}
}

impl SubstateDatabase for RocksDBWithMerkleTreeSubstateStore {
Expand Down Expand Up @@ -303,9 +309,9 @@ impl ReadableTreeStore for RocksDBWithMerkleTreeSubstateStore {
}

#[derive(Debug, Clone, Hash, PartialEq, Eq, ScryptoSbor)]
struct Metadata {
current_state_version: u64,
current_state_root_hash: Hash,
pub struct Metadata {
pub current_state_version: u64,
pub current_state_root_hash: Hash,
}

#[cfg(test)]
Expand Down

0 comments on commit 7647ee2

Please sign in to comment.