Skip to content
Snippets Groups Projects
Commit d334133a authored by Éloïs's avatar Éloïs
Browse files

feat(modules): add param currency_params to apply and revert methods

parent 4ce40a98
No related branches found
No related tags found
No related merge requests found
Pipeline #12431 canceled
......@@ -26,7 +26,10 @@ pub mod public_ips;
use dubp::{
block::DubpBlockV10,
common::prelude::{BlockNumber, Blockstamp},
common::{
currency_params::CurrencyParameters,
prelude::{BlockNumber, Blockstamp},
},
crypto::{hashs::Hash, keys::ed25519::PublicKey},
documents::transaction::TransactionDocumentV10,
};
......@@ -51,6 +54,7 @@ pub trait DuniterModule: 'static + Sized {
fn apply_block(
_block: &DubpBlockV10,
_conf: &DuniterCoreConf,
_currency_params: CurrencyParameters,
_profile_path_opt: Option<&Path>,
) -> KvResult<()> {
unreachable!()
......@@ -61,6 +65,7 @@ pub trait DuniterModule: 'static + Sized {
fn revert_block(
_block: &DubpBlockV10,
_conf: &DuniterCoreConf,
_currency_params: CurrencyParameters,
_profile_path_opt: Option<&Path>,
) -> KvResult<()> {
unreachable!()
......@@ -119,6 +124,7 @@ macro_rules! plug_duniter_modules {
fn apply_block_modules(
block: Arc<DubpBlockV10>,
conf: Arc<duniter_conf::DuniterCoreConf>,
currency_params: CurrencyParameters,
dbs_pool: &fast_threadpool::ThreadPoolSyncHandler<SharedDbs<FileBackend>>,
profile_path_opt: Option<std::path::PathBuf>,
) -> KvResult<()> {
......@@ -131,6 +137,7 @@ macro_rules! plug_duniter_modules {
.launch(move |_| <$M>::apply_block(
&block_arc_clone,
&conf_arc_clone,
currency_params,
profile_path_opt_clone.as_deref()
))
.expect("thread pool disconnected"))
......@@ -149,6 +156,7 @@ macro_rules! plug_duniter_modules {
fn apply_chunk_of_blocks_modules(
blocks: Arc<[DubpBlockV10]>,
conf: Arc<duniter_conf::DuniterCoreConf>,
currency_params: CurrencyParameters,
dbs_pool: &fast_threadpool::ThreadPoolSyncHandler<SharedDbs<FileBackend>>,
profile_path_opt: Option<std::path::PathBuf>,
) -> KvResult<()> {
......@@ -161,7 +169,7 @@ macro_rules! plug_duniter_modules {
.launch(move |_| {
use std::ops::Deref as _;
for block in blocks_arc_clone.deref() {
<$M>::apply_block(&block, &conf_arc_clone, profile_path_opt_clone.as_deref())?;
<$M>::apply_block(&block, &conf_arc_clone, currency_params, profile_path_opt_clone.as_deref())?;
}
Ok::<_, KvError>(())
})
......@@ -181,6 +189,7 @@ macro_rules! plug_duniter_modules {
fn revert_block_modules(
block: Arc<DubpBlockV10>,
conf: Arc<duniter_conf::DuniterCoreConf>,
currency_params: CurrencyParameters,
dbs_pool: &fast_threadpool::ThreadPoolSyncHandler<SharedDbs<FileBackend>>,
profile_path_opt: Option<std::path::PathBuf>,
) -> KvResult<()> {
......@@ -193,6 +202,7 @@ macro_rules! plug_duniter_modules {
.launch(move |_| <$M>::revert_block(
&block_arc_clone,
&conf_arc_clone,
currency_params,
profile_path_opt_clone.as_deref()
))
.expect("thread pool disconnected"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment