Skip to content

Commit

Permalink
Merge pull request #2008 from radixdlt/feature/add-overwrite-metadta
Browse files Browse the repository at this point in the history
Add overwrite_metadata
  • Loading branch information
iamyulong authored Nov 20, 2024
2 parents 7511806 + 7647ee2 commit c3aa433
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 c3aa433

Please sign in to comment.