use std::sync::Arc; use super::{ ClientDB, DBError, }; use super::POW_CHAIN_DB_COLUMN as DB_COLUMN; pub struct PoWChainStore where T: ClientDB { db: Arc, } impl PoWChainStore { pub fn new(db: Arc) -> Self { Self { db, } } pub fn put_block_hash(&self, hash: &[u8]) -> Result<(), DBError> { self.db.put(DB_COLUMN, hash, &[0]) } pub fn block_hash_exists(&self, hash: &[u8]) -> Result { self.db.exists(DB_COLUMN, hash) } } // TODO: add tests once a memory-db is implemented