From d1973bbebe573182365b9d1ce3e34a8159f9d100 Mon Sep 17 00:00:00 2001 From: jjy Date: Sun, 7 Apr 2019 19:19:03 +0800 Subject: [PATCH] refactor: ChainState use tx_pool_config.txs_verify_cache_size --- shared/src/chain_state.rs | 9 ++------- shared/src/shared.rs | 1 - 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/shared/src/chain_state.rs b/shared/src/chain_state.rs index 60d69d39ed..d983bf1548 100644 --- a/shared/src/chain_state.rs +++ b/shared/src/chain_state.rs @@ -36,12 +36,7 @@ pub struct ChainState { } impl ChainState { - pub fn new( - store: &Arc, - consensus: Arc, - txs_verify_cache_size: usize, - tx_pool_config: TxPoolConfig, - ) -> Self { + pub fn new(store: &Arc, consensus: Arc, tx_pool_config: TxPoolConfig) -> Self { // check head in store or save the genesis block as head let tip_header = { let genesis = consensus.genesis_block(); @@ -54,8 +49,8 @@ impl ChainState { } }; + let txs_verify_cache = LruCache::new(tx_pool_config.txs_verify_cache_size); let tx_pool = TxPool::new(tx_pool_config); - let txs_verify_cache = LruCache::new(txs_verify_cache_size); let tip_number = tip_header.number(); let proposal_window = consensus.tx_proposal_window(); diff --git a/shared/src/shared.rs b/shared/src/shared.rs index 6c40c8c5d6..a53628448d 100644 --- a/shared/src/shared.rs +++ b/shared/src/shared.rs @@ -44,7 +44,6 @@ impl Shared { let chain_state = Arc::new(Mutex::new(ChainState::new( &store, Arc::clone(&consensus), - txs_verify_cache_size, tx_pool_config, )));