Skip to content

Commit

Permalink
fix: use same instance of randomx factory for statemachine and valida…
Browse files Browse the repository at this point in the history
…tion (#4947)

Description
---
Uses same instance of `RadomXFactory` for the State machine and difficulty validator 

Motivation and Context
---
This allows the status line to report the correct number of rx VMs

How Has This Been Tested?
---
Manually
  • Loading branch information
sdbondi authored Nov 23, 2022
1 parent 68f990f commit 9aed188
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion applications/tari_base_node/src/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ pub struct BaseNodeBootstrapper<'a, B> {
pub mempool: Mempool,
pub rules: ConsensusManager,
pub factories: CryptoFactories,
pub randomx_factory: RandomXFactory,
pub interrupt_signal: ShutdownSignal,
}

Expand Down Expand Up @@ -154,7 +155,7 @@ where B: BlockchainBackend + 'static
base_node_config.state_machine.clone(),
self.rules,
self.factories,
RandomXFactory::new(self.app_config.base_node.max_randomx_vms),
self.randomx_factory,
self.app_config.base_node.bypass_range_proof_verification,
))
.build()
Expand Down
3 changes: 2 additions & 1 deletion applications/tari_base_node/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ async fn build_node_context(
rules.clone(),
validators,
app_config.base_node.storage,
DifficultyCalculator::new(rules.clone(), randomx_factory),
DifficultyCalculator::new(rules.clone(), randomx_factory.clone()),
)
.map_err(|err| {
if let ChainStorageError::DatabaseResyncRequired(reason) = err {
Expand Down Expand Up @@ -262,6 +262,7 @@ async fn build_node_context(
mempool,
rules: rules.clone(),
factories: factories.clone(),
randomx_factory,
interrupt_signal: interrupt_signal.clone(),
}
.bootstrap()
Expand Down

0 comments on commit 9aed188

Please sign in to comment.