mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore(blockchain_tree): wrap tree database in Arc (#1843)
This commit is contained in:
@ -17,7 +17,7 @@ use std::sync::Arc;
|
||||
#[derive(Debug)]
|
||||
pub struct TreeExternals<DB, C, EF> {
|
||||
/// The database, used to commit the canonical chain, or unwind it.
|
||||
pub db: DB,
|
||||
pub db: Arc<DB>,
|
||||
/// The consensus engine.
|
||||
pub consensus: C,
|
||||
/// The executor factory to execute blocks with.
|
||||
@ -28,7 +28,12 @@ pub struct TreeExternals<DB, C, EF> {
|
||||
|
||||
impl<DB, C, EF> TreeExternals<DB, C, EF> {
|
||||
/// Create new tree externals.
|
||||
pub fn new(db: DB, consensus: C, executor_factory: EF, chain_spec: Arc<ChainSpec>) -> Self {
|
||||
pub fn new(
|
||||
db: Arc<DB>,
|
||||
consensus: C,
|
||||
executor_factory: EF,
|
||||
chain_spec: Arc<ChainSpec>,
|
||||
) -> Self {
|
||||
Self { db, consensus, executor_factory, chain_spec }
|
||||
}
|
||||
}
|
||||
|
||||
@ -645,7 +645,7 @@ mod tests {
|
||||
|
||||
fn setup_externals(
|
||||
exec_res: Vec<PostState>,
|
||||
) -> TreeExternals<Arc<Env<WriteMap>>, Arc<TestConsensus>, TestExecutorFactory> {
|
||||
) -> TreeExternals<Env<WriteMap>, Arc<TestConsensus>, TestExecutorFactory> {
|
||||
let db = create_test_rw_db();
|
||||
let consensus = Arc::new(TestConsensus::default());
|
||||
let chain_spec = Arc::new(
|
||||
|
||||
Reference in New Issue
Block a user