From d334133a07f040d6baabc1ac1ac971fd19c73a2d Mon Sep 17 00:00:00 2001
From: librelois <c@elo.tf>
Date: Mon, 17 May 2021 13:42:24 +0200
Subject: [PATCH] feat(modules): add param currency_params to apply and revert
 methods

---
 module/src/lib.rs | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/module/src/lib.rs b/module/src/lib.rs
index 85d1e9a..7ef782f 100644
--- a/module/src/lib.rs
+++ b/module/src/lib.rs
@@ -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"))
-- 
GitLab