fix(in_mem): fix the clone logic (#14038)

This commit is contained in:
yjh
2023-04-29 18:06:42 +08:00
committed by GitHub
parent 202836cb47
commit 1eb2e4f390
+1 -7
View File
@@ -114,6 +114,7 @@ struct BlockchainStorage<Block: BlockT> {
}
/// In-memory blockchain. Supports concurrent reads.
#[derive(Clone)]
pub struct Blockchain<Block: BlockT> {
storage: Arc<RwLock<BlockchainStorage<Block>>>,
}
@@ -124,13 +125,6 @@ impl<Block: BlockT> Default for Blockchain<Block> {
}
}
impl<Block: BlockT + Clone> Clone for Blockchain<Block> {
fn clone(&self) -> Self {
let storage = Arc::new(RwLock::new(self.storage.read().clone()));
Blockchain { storage }
}
}
impl<Block: BlockT> Blockchain<Block> {
/// Get header hash of given block.
pub fn id(&self, id: BlockId<Block>) -> Option<Block::Hash> {