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

Commit

Permalink
fix(in_mem): fix the clone logic (#14038)
Browse files Browse the repository at this point in the history
  • Loading branch information
yjhmelody authored Apr 29, 2023
1 parent de80d01 commit 74b2c92
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 74b2c92

Please sign in to comment.