diff --git a/src/main_loop/proof_upgrader.rs b/src/main_loop/proof_upgrader.rs index fa641742..45ab532b 100644 --- a/src/main_loop/proof_upgrader.rs +++ b/src/main_loop/proof_upgrader.rs @@ -181,7 +181,7 @@ impl UpgradeJob { } }; - let _new_update_job: UpdateMutatorSetDataJob = { + let new_update_job: UpdateMutatorSetDataJob = { let mut global_state = global_state_lock.lock_guard_mut().await; // Did we receive a new block while proving? If so, perform an // update also, if this was requested (and we have a single proof) @@ -245,8 +245,10 @@ impl UpgradeJob { } }; + let _new_update_job = UpgradeJob::UpdateMutatorSetData(new_update_job); + warn!("We should perform an upgrade now. But that isn't implemented yet"); - // TODO: Make recursive call here. + // TODO: Make recursive call here. Or use a proof queue. } /// Execute the proof upgrade. diff --git a/src/models/blockchain/block/mutator_set_update.rs b/src/models/blockchain/block/mutator_set_update.rs index 6fc3f862..0d444a9f 100644 --- a/src/models/blockchain/block/mutator_set_update.rs +++ b/src/models/blockchain/block/mutator_set_update.rs @@ -1,6 +1,5 @@ use anyhow::bail; use anyhow::Result; -use num_traits::Zero; use serde::Deserialize; use serde::Serialize; @@ -24,20 +23,6 @@ impl MutatorSetUpdate { } } - /// Return the number of removal records - pub(crate) fn num_removals(&self) -> usize { - self.removals.len() - } - - /// Return the number of removal records - pub(crate) fn num_additions(&self) -> usize { - self.additions.len() - } - - pub(crate) fn is_empty(&self) -> bool { - self.num_removals().is_zero() && self.num_additions().is_zero() - } - /// Apply a mutator-set-update to a mutator-set-accumulator. Changes the mutator /// set accumulator according to the provided addition and removal records. pub fn apply_to_accumulator(&self, ms_accumulator: &mut MutatorSetAccumulator) -> Result<()> { @@ -81,3 +66,26 @@ impl MutatorSetUpdate { Ok(()) } } + +#[cfg(test)] +mod tests { + use num_traits::Zero; + + use super::*; + + impl MutatorSetUpdate { + /// Return the number of removal records + pub(crate) fn num_removals(&self) -> usize { + self.removals.len() + } + + /// Return the number of removal records + pub(crate) fn num_additions(&self) -> usize { + self.additions.len() + } + + pub(crate) fn is_empty(&self) -> bool { + self.num_removals().is_zero() && self.num_additions().is_zero() + } + } +} diff --git a/src/rpc_server.rs b/src/rpc_server.rs index 010199f1..73a6ba72 100644 --- a/src/rpc_server.rs +++ b/src/rpc_server.rs @@ -21,14 +21,12 @@ use tokio::sync::mpsc::error::SendError; use tracing::error; use tracing::info; use twenty_first::math::digest::Digest; -use twenty_first::util_types::algebraic_hasher::AlgebraicHasher; use crate::config_models::network::Network; use crate::models::blockchain::block::block_header::BlockHeader; use crate::models::blockchain::block::block_height::BlockHeight; use crate::models::blockchain::block::block_info::BlockInfo; use crate::models::blockchain::block::block_selector::BlockSelector; -use crate::models::blockchain::shared::Hash; use crate::models::blockchain::transaction::transaction_output::UtxoNotificationMedium; use crate::models::blockchain::type_scripts::neptune_coins::NeptuneCoins; use crate::models::channel::RPCServerToMain; @@ -37,7 +35,6 @@ use crate::models::peer::PeerInfo; use crate::models::peer::PeerStanding; use crate::models::proof_abstractions::timestamp::Timestamp; use crate::models::state::transaction_kernel_id::TransactionKernelId; -use crate::models::state::tx_proving_capability; use crate::models::state::tx_proving_capability::TxProvingCapability; use crate::models::state::wallet::address::KeyType; use crate::models::state::wallet::address::ReceivingAddress;