Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance Mempool performance #226

Merged
merged 103 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
5981bd5
Split mempool atomic validate and insert transaction in 3 steps
tiram88 Jul 16, 2023
846bd38
Merge branch 'master' into mempool-perf
tiram88 Jul 16, 2023
1b18e11
Process tx relay flow received txs in batch
tiram88 Jul 17, 2023
84c1743
Use a single blocking task per MiningManagerProxy fn
tiram88 Jul 18, 2023
a2c8e5b
Merge branch 'master' into mempool-perf
tiram88 Jul 18, 2023
563baaf
Split parallel txs validation in chunks of max block mass
tiram88 Jul 18, 2023
d842040
Merge branch 'master' into mempool-perf
tiram88 Jul 20, 2023
4f3d1de
Merge branch 'master' into mempool-perf
tiram88 Jul 20, 2023
49d74eb
Abstract expire_low_priority_transactions into Pool trait
tiram88 Jul 26, 2023
4b36529
Merge branch 'master' into mempool-perf
tiram88 Aug 12, 2023
2b4d41d
Merge branch 'master' into mempool-perf
tiram88 Aug 25, 2023
0cb6619
Making room in the mempool for a new transaction won't remove chained…
tiram88 Aug 26, 2023
6ebde53
Refine lock granularity on Mempool and Consensus while processing uno…
tiram88 Aug 29, 2023
ff59ac9
Fix failing test
tiram88 Aug 29, 2023
974a980
Enhance performance & refine lock granularity on Mempool and Consensu…
tiram88 Aug 30, 2023
b725080
Merge branch 'master' into mempool-perf
tiram88 Aug 30, 2023
b814876
Comments
tiram88 Aug 31, 2023
68e341d
Merge branch 'master' into mempool-perf
tiram88 Sep 1, 2023
bd13f22
Fix upper bound of transactions chunk
tiram88 Sep 1, 2023
eab8c8e
Ensure a chunk has at least 1 tx
tiram88 Sep 1, 2023
f7b58d2
Prevent add twice the same tx to the mempool
tiram88 Sep 1, 2023
13b4e43
Clear transaction entries before revalidation
tiram88 Sep 1, 2023
9026043
Add some logs and comments
tiram88 Sep 1, 2023
82cb48a
Add logs to debug transactions removals
tiram88 Sep 5, 2023
77af21d
On accepted block do not remove orphan tx redeemers
tiram88 Sep 5, 2023
41397ba
Add 2 TODOs
tiram88 Sep 5, 2023
54e8b39
Fix a bug of high priority transactions being unexpectedly orphaned o…
tiram88 Sep 6, 2023
f6225aa
Refactor transaction removal reason into an enum
tiram88 Sep 6, 2023
ece7e97
Add an accepted transaction ids cache to the mempool and use it to pr…
tiram88 Sep 7, 2023
ea17aaa
Improve the filtering of unknown transactions in tx relay
tiram88 Sep 7, 2023
46fb8df
Enhance tx removal logging
tiram88 Sep 7, 2023
5b5ef5d
Merge branch 'master' into mempool-perf
tiram88 Sep 7, 2023
8522ced
Add mempool stats
tiram88 Sep 7, 2023
61ca786
Process new and unorphaned blocks in topological order
tiram88 Sep 10, 2023
5ba09f5
Run revalidation of HP txs in a dedicated task
tiram88 Sep 10, 2023
2df3029
Some profiling and debug logs
tiram88 Sep 10, 2023
254a7e8
Run expiration of LP txs in a dedicated task
tiram88 Sep 10, 2023
375f78d
remove some stopwatch calls which were timing locks
michaelsutton Sep 11, 2023
004beb6
crucial: fix exploding complexity of `handle_new_block_transactions`/…
michaelsutton Sep 11, 2023
f8d4401
fixes in `on_new_block`
michaelsutton Sep 11, 2023
c32b660
refactor block template cache into `Inner`
michaelsutton Sep 11, 2023
625cf12
make `block_template_cache` a non-blocking call (never blocks)
michaelsutton Sep 11, 2023
205e934
Log build_block_template retries
tiram88 Sep 12, 2023
674481f
While revalidating HP txs, only recheck transaction entries
tiram88 Sep 12, 2023
8420832
Fix accepted count during revalidation
tiram88 Sep 12, 2023
78fefb3
mempool bmk: use client pools + various improvements
michaelsutton Sep 13, 2023
5bd630c
Merge branch 'mempool-perf' of https:/tiram88/rusty-kaspa…
tiram88 Sep 13, 2023
118559e
Improve the topological sorting of transactions
tiram88 Sep 13, 2023
9302574
Return transaction descendants BFS ordered + some optimizations
tiram88 Sep 14, 2023
b63b586
Group expiration and revalidation of mempool txs in one task
tiram88 Sep 14, 2023
55273ab
Refine the schedule of the cleaning task
tiram88 Sep 14, 2023
a9a93a0
ignore perf logs
michaelsutton Sep 15, 2023
782315f
maintain mempool ready transactions in a dedicated set
michaelsutton Sep 15, 2023
0614dcb
Bound the returned candidate transactions to a maximum
tiram88 Sep 15, 2023
66b2ea0
Merge pull request #4 from michaelsutton/mempool-perf-2
tiram88 Sep 15, 2023
21e3d1c
Reduces the max execution time of build block template
tiram88 Sep 17, 2023
9c0acba
lint
tiram88 Sep 17, 2023
e320045
Add mempool lock granularity to get_all_transactions
tiram88 Sep 17, 2023
84b0476
Restore block template cache lifetime & make it customizable in devne…
tiram88 Sep 17, 2023
8212a05
Restore block template cache lifetime & make it customizable in devne…
tiram88 Sep 17, 2023
403c6b0
Merge branch 'mempool-perf' of https:/tiram88/rusty-kaspa…
tiram88 Sep 17, 2023
01c8f9c
Relax a bit the BBT maximum attempts constraint
tiram88 Sep 18, 2023
d024904
Refactor multiple `contained_by_txs` fns into one generic
tiram88 Sep 19, 2023
1f0c44e
Test selector transaction rejects & fix empty template returned by `s…
tiram88 Sep 19, 2023
bb56c70
Log some mempool metrics
tiram88 Sep 19, 2023
1156ee7
Merge branch 'master' into mempool-perf
tiram88 Sep 19, 2023
14da8a2
Handle new block and then new block template
tiram88 Sep 20, 2023
92bb8dd
turn tx selector into an ongoing process with persistent state (wip: …
michaelsutton Sep 21, 2023
0e54b66
use tx selector for BBT (wip: virtual processor retry logic)
michaelsutton Sep 21, 2023
d231134
virtual processor selector retry logic
michaelsutton Sep 21, 2023
9a015d1
make BBT fallible by some selector criteria + comments and some docs
michaelsutton Sep 21, 2023
58e0ed5
add an infallible mode to virtual processor `build_block_template()`
michaelsutton Sep 21, 2023
827b9fa
constants for tx selector successful decision
michaelsutton Sep 21, 2023
db0cddf
Add e-tps to logged mempool metrics
tiram88 Sep 21, 2023
08456c6
avoid realloc
michaelsutton Sep 21, 2023
099497b
Address review comments
tiram88 Sep 22, 2023
70a91ec
Merge pull request #5 from michaelsutton/mempool-perf-3
tiram88 Sep 22, 2023
bb724e6
Use number of ready txs in e-tps & enhance mempool lock
tiram88 Sep 22, 2023
66dbca8
Ignore failing send for clean tokio shutdown
tiram88 Sep 22, 2023
abd3143
Log double spends
tiram88 Sep 23, 2023
c29680f
Log tx script cache stats (wip)
tiram88 Sep 24, 2023
6f8b024
Ease atomic lock ordering & enhance counter updates
tiram88 Sep 24, 2023
87f20f0
Enhance tx throughput stats log line
tiram88 Sep 26, 2023
bc6bdc6
More robust management of cached data life cycle
tiram88 Sep 26, 2023
1c7357d
Log mempool sampled instead of exact lengths
tiram88 Sep 26, 2023
fd4731e
avoid passing consensus to orphan pool
michaelsutton Sep 28, 2023
8bec918
rename ro `validate_transaction_unacceptance` and move to before the …
michaelsutton Oct 3, 2023
a99d3d8
rename `cleaning` -> `mempool_scanning`
michaelsutton Oct 5, 2023
f161b1c
keep intervals aligned using a round-up formula (rather than a loop)
michaelsutton Oct 5, 2023
41e4a94
design fix: avoid exposing full collections as mut. This violates enc…
michaelsutton Oct 5, 2023
316f9d1
minor: close all pool receivers on op error
michaelsutton Oct 5, 2023
8ce99e7
`remove_transaction`: no need to manually update parent-child relatio…
michaelsutton Oct 5, 2023
4faf2fa
encapsulate `remove_transaction_utxos` into `transaction_pool`
michaelsutton Oct 5, 2023
7be8b61
no need to `remove_redeemers_of` for the initial removed tx since thi…
michaelsutton Oct 5, 2023
e6142e7
inline `remove_from_transaction_pool_and_update_orphans`
michaelsutton Oct 5, 2023
044fa3d
remove redeemers of expired low-prio txs + register scan time and daa…
michaelsutton Oct 5, 2023
969fae4
change mempool monitor logs to debug
michaelsutton Oct 5, 2023
d01ebd6
Merge branch 'master' into mempool-perf
michaelsutton Oct 6, 2023
acc3016
Merge branch 'master' into mempool-perf
michaelsutton Oct 6, 2023
2e11cf6
make tps logging more accurate
michaelsutton Oct 6, 2023
cc51b62
Merge branch 'master' into mempool-perf
michaelsutton Oct 6, 2023
5aff480
import bmk improvements from mempool-perf-stats branch
michaelsutton Oct 6, 2023
099aa40
make `config.block_template_cache_lifetime` non-feature dependent
michaelsutton Oct 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 25 additions & 4 deletions consensus/core/src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::sync::Arc;

use crate::{
acceptance_data::AcceptanceData,
block::{Block, BlockTemplate},
block::{Block, BlockTemplate, TemplateBuildMode, TemplateTransactionSelector},
block_count::BlockCount,
blockstatus::BlockStatus,
coinbase::MinerData,
Expand All @@ -27,7 +27,12 @@ pub type BlockValidationFuture = BoxFuture<'static, BlockProcessResult<BlockStat
/// Abstracts the consensus external API
#[allow(unused_variables)]
pub trait ConsensusApi: Send + Sync {
fn build_block_template(&self, miner_data: MinerData, txs: Vec<Transaction>) -> Result<BlockTemplate, RuleError> {
fn build_block_template(
&self,
miner_data: MinerData,
tx_selector: Box<dyn TemplateTransactionSelector>,
build_mode: TemplateBuildMode,
) -> Result<BlockTemplate, RuleError> {
unimplemented!()
}

Expand All @@ -40,8 +45,24 @@ pub trait ConsensusApi: Send + Sync {
}

/// Populates the mempool transaction with maximally found UTXO entry data and proceeds to full transaction
/// validation if all are found. If validation is successful, also [`transaction.calculated_fee`] is expected to be populated
fn validate_mempool_transaction_and_populate(&self, transaction: &mut MutableTransaction) -> TxResult<()> {
/// validation if all are found. If validation is successful, also [`transaction.calculated_fee`] is expected to be populated.
fn validate_mempool_transaction(&self, transaction: &mut MutableTransaction) -> TxResult<()> {
unimplemented!()
}

/// Populates the mempool transactions with maximally found UTXO entry data and proceeds to full transactions
/// validation if all are found. If validation is successful, also [`transaction.calculated_fee`] is expected to be populated.
fn validate_mempool_transactions_in_parallel(&self, transactions: &mut [MutableTransaction]) -> Vec<TxResult<()>> {
unimplemented!()
}

/// Populates the mempool transaction with maximally found UTXO entry data.
fn populate_mempool_transaction(&self, transaction: &mut MutableTransaction) -> TxResult<()> {
unimplemented!()
}

/// Populates the mempool transactions with maximally found UTXO entry data.
fn populate_mempool_transactions_in_parallel(&self, transactions: &mut [MutableTransaction]) -> Vec<TxResult<()>> {
unimplemented!()
}

Expand Down
34 changes: 33 additions & 1 deletion consensus/core/src/block.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
use std::sync::Arc;

use crate::{coinbase::MinerData, header::Header, tx::Transaction};
use crate::{
coinbase::MinerData,
header::Header,
tx::{Transaction, TransactionId},
};
use kaspa_hashes::Hash;

/// A mutable block structure where header and transactions within can still be mutated.
Expand Down Expand Up @@ -64,6 +68,34 @@ impl Block {
}
}

/// An abstraction for a recallable transaction selector with persistent state
pub trait TemplateTransactionSelector {
/// Expected to return a batch of transactions which were not previously selected.
/// The batch will typically contain sufficient transactions to fill the block
/// mass (along with the previously unrejected txs), or will drain the selector
fn select_transactions(&mut self) -> Vec<Transaction>;

/// Should be used to report invalid transactions obtained from the *most recent*
/// `select_transactions` call. Implementors should use this call to internally
/// track the selection state and discard the rejected tx from internal occupation calculations
fn reject_selection(&mut self, tx_id: TransactionId);

/// Determine whether this was an overall successful selection episode
fn is_successful(&self) -> bool;
}

/// Block template build mode
#[derive(Clone, Copy, Debug)]
pub enum TemplateBuildMode {
/// Block template build can possibly fail if `TemplateTransactionSelector::is_successful` deems the operation unsuccessful.
///
/// In such a case, the build fails with `BlockRuleError::InvalidTransactionsInNewBlock`.
Standard,

/// Block template build always succeeds. The built block contains only the validated transactions.
Infallible,
}

/// A block template for miners.
#[derive(Debug, Clone)]
pub struct BlockTemplate {
Expand Down
3 changes: 3 additions & 0 deletions consensus/core/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ pub struct Config {

pub externalip: Option<IpAddress>,

pub block_template_cache_lifetime: Option<u64>,

#[cfg(feature = "devnet-prealloc")]
pub initial_utxo_set: Arc<UtxoCollection>,
}
Expand All @@ -82,6 +84,7 @@ impl Config {
user_agent_comments: Default::default(),
externalip: None,
p2p_listen_address: ContextualNetAddress::unspecified(),
block_template_cache_lifetime: None,

#[cfg(feature = "devnet-prealloc")]
initial_utxo_set: Default::default(),
Expand Down
4 changes: 2 additions & 2 deletions consensus/core/src/errors/block.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::fmt::Display;
use std::{collections::HashMap, fmt::Display};

use crate::{
constants,
Expand Down Expand Up @@ -140,7 +140,7 @@ pub enum RuleError {
InvalidTransactionsInUtxoContext(usize, usize),

#[error("invalid transactions in new block template")]
InvalidTransactionsInNewBlock(Vec<(TransactionId, TxRuleError)>),
InvalidTransactionsInNewBlock(HashMap<TransactionId, TxRuleError>),

#[error("DAA window data has only {0} entries")]
InsufficientDaaWindowSize(usize),
Expand Down
6 changes: 6 additions & 0 deletions consensus/core/src/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,12 @@ impl<T: AsRef<Transaction>> MutableTransaction<T> {
}
}

impl<T: AsRef<Transaction>> AsRef<Transaction> for MutableTransaction<T> {
fn as_ref(&self) -> &Transaction {
self.tx.as_ref()
}
}

/// Private struct used to wrap a [`MutableTransaction`] as a [`VerifiableTransaction`]
struct MutableTransactionVerifiableWrapper<'a, T: AsRef<Transaction>> {
inner: &'a MutableTransaction<T>,
Expand Down
6 changes: 6 additions & 0 deletions consensus/src/consensus/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use kaspa_database::{
registry::DatabaseStorePrefixes,
};

use kaspa_txscript::caches::TxScriptCacheCounters;
use parking_lot::RwLock;
use rocksdb::WriteBatch;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -153,6 +154,7 @@ pub struct Factory {
db_parallelism: usize,
notification_root: Arc<ConsensusNotificationRoot>,
counters: Arc<ProcessingCounters>,
tx_script_cache_counters: Arc<TxScriptCacheCounters>,
}

impl Factory {
Expand All @@ -163,6 +165,7 @@ impl Factory {
db_parallelism: usize,
notification_root: Arc<ConsensusNotificationRoot>,
counters: Arc<ProcessingCounters>,
tx_script_cache_counters: Arc<TxScriptCacheCounters>,
) -> Self {
let mut config = config.clone();
#[cfg(feature = "devnet-prealloc")]
Expand All @@ -175,6 +178,7 @@ impl Factory {
db_parallelism,
notification_root,
counters,
tx_script_cache_counters,
}
}
}
Expand Down Expand Up @@ -208,6 +212,7 @@ impl ConsensusFactory for Factory {
session_lock.clone(),
self.notification_root.clone(),
self.counters.clone(),
self.tx_script_cache_counters.clone(),
entry.creation_timestamp,
));

Expand Down Expand Up @@ -236,6 +241,7 @@ impl ConsensusFactory for Factory {
session_lock.clone(),
self.notification_root.clone(),
self.counters.clone(),
self.tx_script_cache_counters.clone(),
entry.creation_timestamp,
));

Expand Down
32 changes: 26 additions & 6 deletions consensus/src/consensus/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use crate::{
use kaspa_consensus_core::{
acceptance_data::AcceptanceData,
api::{BlockValidationFuture, ConsensusApi},
block::{Block, BlockTemplate},
block::{Block, BlockTemplate, TemplateBuildMode, TemplateTransactionSelector},
block_count::BlockCount,
blockhash::BlockHashExtensions,
blockstatus::BlockStatus,
Expand Down Expand Up @@ -70,6 +70,7 @@ use kaspa_consensusmanager::{SessionLock, SessionReadGuard};
use kaspa_database::prelude::StoreResultExtensions;
use kaspa_hashes::Hash;
use kaspa_muhash::MuHash;
use kaspa_txscript::caches::TxScriptCacheCounters;

use std::thread::{self, JoinHandle};
use std::{
Expand Down Expand Up @@ -132,6 +133,7 @@ impl Consensus {
pruning_lock: SessionLock,
notification_root: Arc<ConsensusNotificationRoot>,
counters: Arc<ProcessingCounters>,
tx_script_cache_counters: Arc<TxScriptCacheCounters>,
creation_timestamp: u64,
) -> Self {
let params = &config.params;
Expand All @@ -147,7 +149,7 @@ impl Consensus {
// Services and managers
//

let services = ConsensusServices::new(db.clone(), storage.clone(), config.clone());
let services = ConsensusServices::new(db.clone(), storage.clone(), config.clone(), tx_script_cache_counters);

//
// Processor channels
Expand Down Expand Up @@ -353,8 +355,13 @@ impl Consensus {
}

impl ConsensusApi for Consensus {
fn build_block_template(&self, miner_data: MinerData, txs: Vec<Transaction>) -> Result<BlockTemplate, RuleError> {
self.virtual_processor.build_block_template(miner_data, txs)
fn build_block_template(
&self,
miner_data: MinerData,
tx_selector: Box<dyn TemplateTransactionSelector>,
build_mode: TemplateBuildMode,
) -> Result<BlockTemplate, RuleError> {
self.virtual_processor.build_block_template(miner_data, tx_selector, build_mode)
}

fn validate_and_insert_block(&self, block: Block) -> BlockValidationFuture {
Expand All @@ -367,11 +374,24 @@ impl ConsensusApi for Consensus {
Box::pin(result)
}

fn validate_mempool_transaction_and_populate(&self, transaction: &mut MutableTransaction) -> TxResult<()> {
self.virtual_processor.validate_mempool_transaction_and_populate(transaction)?;
fn validate_mempool_transaction(&self, transaction: &mut MutableTransaction) -> TxResult<()> {
self.virtual_processor.validate_mempool_transaction(transaction)?;
Ok(())
}

fn validate_mempool_transactions_in_parallel(&self, transactions: &mut [MutableTransaction]) -> Vec<TxResult<()>> {
self.virtual_processor.validate_mempool_transactions_in_parallel(transactions)
}

fn populate_mempool_transaction(&self, transaction: &mut MutableTransaction) -> TxResult<()> {
self.virtual_processor.populate_mempool_transaction(transaction)?;
Ok(())
}

fn populate_mempool_transactions_in_parallel(&self, transactions: &mut [MutableTransaction]) -> Vec<TxResult<()>> {
self.virtual_processor.populate_mempool_transactions_in_parallel(transactions)
}

fn calculate_transaction_mass(&self, transaction: &Transaction) -> u64 {
self.services.mass_calculator.calc_tx_mass(transaction)
}
Expand Down
9 changes: 8 additions & 1 deletion consensus/src/consensus/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use crate::{
};

use itertools::Itertools;
use kaspa_txscript::caches::TxScriptCacheCounters;
use std::sync::Arc;

pub type DbGhostdagManager =
Expand Down Expand Up @@ -65,7 +66,12 @@ pub struct ConsensusServices {
}

impl ConsensusServices {
pub fn new(db: Arc<DB>, storage: Arc<ConsensusStorage>, config: Arc<Config>) -> Arc<Self> {
pub fn new(
db: Arc<DB>,
storage: Arc<ConsensusStorage>,
config: Arc<Config>,
tx_script_cache_counters: Arc<TxScriptCacheCounters>,
) -> Arc<Self> {
let params = &config.params;

let statuses_service = MTStatusesService::new(storage.statuses_store.clone());
Expand Down Expand Up @@ -144,6 +150,7 @@ impl ConsensusServices {
params.ghostdag_k,
params.coinbase_payload_script_public_key_max_len,
params.coinbase_maturity,
tx_script_cache_counters,
);

let pruning_point_manager = PruningPointManager::new(
Expand Down
39 changes: 33 additions & 6 deletions consensus/src/consensus/test_consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,17 @@ impl TestConsensus {
/// Creates a test consensus instance based on `config` with the provided `db` and `notification_sender`
pub fn with_db(db: Arc<DB>, config: &Config, notification_sender: Sender<Notification>) -> Self {
let notification_root = Arc::new(ConsensusNotificationRoot::new(notification_sender));
let counters = Arc::new(ProcessingCounters::default());
let consensus = Arc::new(Consensus::new(db, Arc::new(config.clone()), Default::default(), notification_root, counters, 0));
let counters = Default::default();
let tx_script_cache_counters = Default::default();
let consensus = Arc::new(Consensus::new(
db,
Arc::new(config.clone()),
Default::default(),
notification_root,
counters,
tx_script_cache_counters,
0,
));
let block_builder = TestBlockBuilder::new(consensus.virtual_processor.clone());

Self { params: config.params.clone(), consensus, block_builder, db_lifetime: Default::default() }
Expand All @@ -60,8 +69,17 @@ impl TestConsensus {
pub fn with_notifier(config: &Config, notification_sender: Sender<Notification>) -> Self {
let (db_lifetime, db) = create_temp_db!(ConnBuilder::default());
let notification_root = Arc::new(ConsensusNotificationRoot::new(notification_sender));
let counters = Arc::new(ProcessingCounters::default());
let consensus = Arc::new(Consensus::new(db, Arc::new(config.clone()), Default::default(), notification_root, counters, 0));
let counters = Default::default();
let tx_script_cache_counters = Default::default();
let consensus = Arc::new(Consensus::new(
db,
Arc::new(config.clone()),
Default::default(),
notification_root,
counters,
tx_script_cache_counters,
0,
));
let block_builder = TestBlockBuilder::new(consensus.virtual_processor.clone());

Self { consensus, block_builder, params: config.params.clone(), db_lifetime }
Expand All @@ -72,8 +90,17 @@ impl TestConsensus {
let (db_lifetime, db) = create_temp_db!(ConnBuilder::default());
let (dummy_notification_sender, _) = async_channel::unbounded();
let notification_root = Arc::new(ConsensusNotificationRoot::new(dummy_notification_sender));
let counters = Arc::new(ProcessingCounters::default());
let consensus = Arc::new(Consensus::new(db, Arc::new(config.clone()), Default::default(), notification_root, counters, 0));
let counters = Default::default();
let tx_script_cache_counters = Default::default();
let consensus = Arc::new(Consensus::new(
db,
Arc::new(config.clone()),
Default::default(),
notification_root,
counters,
tx_script_cache_counters,
0,
));
let block_builder = TestBlockBuilder::new(consensus.virtual_processor.clone());

Self { consensus, block_builder, params: config.params.clone(), db_lifetime }
Expand Down
Loading