From 475a042bf2361826034629a789e53383aed96785 Mon Sep 17 00:00:00 2001 From: ksrichard Date: Fri, 8 Nov 2024 14:37:55 +0100 Subject: [PATCH] change comments --- .../lmdb_db/validator_node_store.rs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/base_layer/core/src/chain_storage/lmdb_db/validator_node_store.rs b/base_layer/core/src/chain_storage/lmdb_db/validator_node_store.rs index 44d018bab3..b9864d09aa 100644 --- a/base_layer/core/src/chain_storage/lmdb_db/validator_node_store.rs +++ b/base_layer/core/src/chain_storage/lmdb_db/validator_node_store.rs @@ -53,7 +53,7 @@ pub struct ValidatorNodeStore<'a, Txn> { db_validator_nodes_mapping: DatabaseRef, } -impl<'a, Txn: Deref>> ValidatorNodeStore<'a, Txn> { +impl<'a, Txn: Deref>> ValidatorNodeStore<'a, Txn> { pub fn new(txn: &'a Txn, db_height_to_vn: DatabaseRef, idx_public_key_to_shard: DatabaseRef) -> Self { Self { txn, @@ -70,7 +70,7 @@ impl ValidatorNodeStore<'_, WriteTransaction<'_>> { validator.public_key.as_bytes(), validator.commitment.as_bytes(), ]) - .expect("insert: Composite key length is incorrect"); + .expect("insert: Composite key length is incorrect"); lmdb_insert(self.txn, &self.db_validator_nodes, &key, &validator, "Validator node")?; let key = ShardIdIndexKey::try_from_parts(&[ @@ -78,7 +78,7 @@ impl ValidatorNodeStore<'_, WriteTransaction<'_>> { height.to_be_bytes().as_slice(), validator.commitment.as_bytes(), ]) - .expect("insert: Composite key length is incorrect"); + .expect("insert: Composite key length is incorrect"); lmdb_insert( self.txn, &self.db_validator_nodes_mapping, @@ -100,7 +100,7 @@ impl ValidatorNodeStore<'_, WriteTransaction<'_>> { public_key.as_bytes(), commitment.as_bytes(), ]) - .expect("delete: Composite key length is incorrect"); + .expect("delete: Composite key length is incorrect"); lmdb_delete(self.txn, &self.db_validator_nodes, &key, "validator_nodes")?; let key = ShardIdIndexKey::try_from_parts(&[ @@ -108,7 +108,7 @@ impl ValidatorNodeStore<'_, WriteTransaction<'_>> { height.to_be_bytes().as_slice(), commitment.as_bytes(), ]) - .expect("delete: Composite key length is incorrect"); + .expect("delete: Composite key length is incorrect"); lmdb_delete( self.txn, &self.db_validator_nodes_mapping, @@ -119,7 +119,7 @@ impl ValidatorNodeStore<'_, WriteTransaction<'_>> { } } -impl<'a, Txn: Deref>> ValidatorNodeStore<'a, Txn> { +impl<'a, Txn: Deref>> ValidatorNodeStore<'a, Txn> { fn db_read_cursor(&self) -> Result, ChainStorageError> { let cursor = self.txn.cursor(self.db_validator_nodes.clone())?; let access = self.txn.access(); @@ -155,7 +155,7 @@ impl<'a, Txn: Deref>> ValidatorNodeStore<'a, Txn> Ok(false) } - /// Returns validator nodes until a given epoch. + /// Returns validator nodes count until a given epoch. pub fn get_vn_count_until_epoch( &self, epoch: VnEpoch, @@ -172,7 +172,7 @@ impl<'a, Txn: Deref>> ValidatorNodeStore<'a, Txn> Ok(result) } - /// Returns validator nodes in a given epoch. + /// Returns validator nodes count in a given epoch. pub fn get_vn_count_in_epoch( &self, epoch: VnEpoch, @@ -217,7 +217,7 @@ impl<'a, Txn: Deref>> ValidatorNodeStore<'a, Txn> original_registration: vn.registration.clone(), minimum_value_promise: vn.minimum_value_promise, })); - }, + } None => return Ok(Vec::new()), } @@ -276,7 +276,7 @@ impl<'a, Txn: Deref>> ValidatorNodeStore<'a, Txn> return Ok(None); } Some(s) - }, + } None => return Ok(None), }; @@ -307,7 +307,7 @@ mod tests { const DBS: &[&str] = &["validator_node_store", "validator_node_index"]; - fn create_store<'a, Txn: Deref>>( + fn create_store<'a, Txn: Deref>>( db: &TempLmdbDatabase, txn: &'a Txn, ) -> ValidatorNodeStore<'a, Txn> {