Convert coordinator/substrate/db to use create_db macro (#436)

* chore: implement create_db for substrate (fix broken branch)

* Correct rebase artifacts

* chore: remove todo statement

* chore: rename BlockDb to NextBlock

* chore: return empty tuple instead of empty array for event storage

* Finish rebasing

* .Minor tweaks to remove leftover variables

These may be rebase artifacts.

---------

Co-authored-by: Luke Parker <lukeparker5132@gmail.com>
This commit is contained in:
David Bell
2023-12-08 14:12:16 +04:00
committed by GitHub
parent a6947d6d21
commit 16b22dd105
3 changed files with 53 additions and 99 deletions

View File

@@ -23,7 +23,7 @@ use processor_messages::coordinator::cosign_block_msg;
use crate::{
p2p::{CosignedBlock, P2pMessageKind, P2p},
substrate::SubstrateDb,
substrate::LatestCosignedBlock,
};
create_db! {
@@ -67,9 +67,9 @@ impl<D: Db> CosignEvaluator<D> {
let mut db_lock = self.db.lock().await;
let mut txn = db_lock.txn();
if highest_block > SubstrateDb::<D>::latest_cosigned_block(&txn) {
if highest_block > LatestCosignedBlock::latest_cosigned_block(&txn) {
log::info!("setting latest cosigned block to {}", highest_block);
SubstrateDb::<D>::set_latest_cosigned_block(&mut txn, highest_block);
LatestCosignedBlock::set(&mut txn, &highest_block);
}
txn.commit();
}