Skip to content

Commit

Permalink
fix(in_mem): fix the clone logic (paritytech#14038)
Browse files Browse the repository at this point in the history
  • Loading branch information
yjhmelody authored and nathanwhit committed Jul 19, 2023
1 parent 6565645 commit 9d3eba6
Showing 1 changed file with 1 addition and 7 deletions.
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

0 comments on commit 9d3eba6

Please sign in to comment.