Fix: manually impl Clone for BlockchainProvider (#8474)

This commit is contained in:
James Prestwich
2024-05-29 15:12:06 +01:00
committed by GitHub
parent 0d20503905
commit 53bcb2c9ee

View File

@@ -65,7 +65,6 @@ pub use consistent_view::{ConsistentDbView, ConsistentViewError};
/// This type serves as the main entry point for interacting with the blockchain and provides data
/// from database storage and from the blockchain tree (pending state etc.) It is a simple wrapper
/// type that holds an instance of the database and the blockchain tree.
#[derive(Clone)]
#[allow(missing_debug_implementations)]
pub struct BlockchainProvider<DB> {
/// Provider type used to access the database.
@@ -76,6 +75,16 @@ pub struct BlockchainProvider<DB> {
chain_info: ChainInfoTracker,
}
impl<DB> Clone for BlockchainProvider<DB> {
fn clone(&self) -> Self {
Self {
database: self.database.clone(),
tree: self.tree.clone(),
chain_info: self.chain_info.clone(),
}
}
}
impl<DB> BlockchainProvider<DB> {
/// Create new provider instance that wraps the database and the blockchain tree, using the
/// provided latest header to initialize the chain info tracker.