Implement contains_key for PcdCommitments + change keys() return value

This commit is contained in:
NicolasCantu 2025-03-26 12:30:44 +01:00 committed by Nicolas Cantu
parent 6fc0a9b1ff
commit f88bae7354

View File

@ -234,6 +234,10 @@ impl PcdCommitments {
Ok(())
}
pub fn contains_key(&self, key: &str) -> bool {
self.0.contains_key(key)
}
pub fn get(&self, field: &str) -> Option<&[u8; 32]> {
self.0.get(field)
}
@ -250,8 +254,8 @@ impl PcdCommitments {
self.0.iter_mut()
}
pub fn keys(&self) -> Vec<String> {
self.0.keys().map(|k| k.to_owned()).collect()
pub fn keys(&self) -> Keys<String, [u8; 32]> {
self.0.keys()
}
/// Since BTreeMap keys order is deterministic, we can guarantee a consistent merkle tree