mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 03:31:03 +00:00
fix(in_mem): fix the clone logic (#14038)
This commit is contained in:
@@ -114,6 +114,7 @@ struct BlockchainStorage<Block: BlockT> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// In-memory blockchain. Supports concurrent reads.
|
/// In-memory blockchain. Supports concurrent reads.
|
||||||
|
#[derive(Clone)]
|
||||||
pub struct Blockchain<Block: BlockT> {
|
pub struct Blockchain<Block: BlockT> {
|
||||||
storage: Arc<RwLock<BlockchainStorage<Block>>>,
|
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> {
|
impl<Block: BlockT> Blockchain<Block> {
|
||||||
/// Get header hash of given block.
|
/// Get header hash of given block.
|
||||||
pub fn id(&self, id: BlockId<Block>) -> Option<Block::Hash> {
|
pub fn id(&self, id: BlockId<Block>) -> Option<Block::Hash> {
|
||||||
|
|||||||
Reference in New Issue
Block a user