Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

fix(in_mem): fix the clone logic #14038

Merged
merged 1 commit into from
Apr 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions client/api/src/in_mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>>>,
}
Expand All @@ -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> {
Expand Down