From 7639443aa16489f79b9b16a5c3807c277686494c Mon Sep 17 00:00:00 2001 From: Benoit Lavenier <benoit.lavenier@e-is.pro> Date: Fri, 19 May 2023 10:19:03 +0200 Subject: [PATCH] [enh] add `get_tx_history_bma_written_by_times()` [fix] rename `get_transactions_history_for_bma()` into 'get_txs_history_bma()' [fix] rename `get_written_transactions_for_bma()` into 'get_tx_history_bma_written_by_blocks()' and change from/to into Option<u32> [fix] rename `get_pending_transactions_for_bma()` into 'get_txs_history_bma_mempool()' --- module/src/lib.rs | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/module/src/lib.rs b/module/src/lib.rs index b0bf725..4186be1 100644 --- a/module/src/lib.rs +++ b/module/src/lib.rs @@ -85,9 +85,9 @@ pub trait DuniterModule: 'static + Sized { async fn start(self) -> anyhow::Result<()>; - // Needed for BMA only + /// Get TX full history of a pubkey. Needed for BMA only #[doc(hidden)] - fn get_transactions_history_for_bma( + fn get_txs_history_bma( _dbs_pool: &fast_threadpool::ThreadPoolSyncHandler<SharedDbs<FileBackend>>, _profile_path_opt: Option<&Path>, _pubkey: PublicKey, @@ -95,20 +95,31 @@ pub trait DuniterModule: 'static + Sized { Ok(None) } - // Needed for BMA only + /// Get TX history of a pubkey from a block range. Needed for BMA only #[doc(hidden)] - fn get_written_transactions_for_bma( + fn get_tx_history_bma_written_by_blocks( _profile_path_opt: Option<&Path>, _pubkey: PublicKey, - _start_block: u32, - _end_block: u32, + _from: Option<u32>, + _to: Option<u32>, ) -> KvResult<Option<TxsHistoryForBma>> { Ok(None) } - // Needed for BMA only + /// Get TX history of a pubkey from a median_time range. Needed for BMA only + #[doc(hidden)] + fn get_tx_history_bma_written_by_times( + _profile_path_opt: Option<&Path>, + _pubkey: PublicKey, + _from: Option<u64>, + _to: Option<u64>, + ) -> KvResult<Option<TxsHistoryForBma>> { + Ok(None) + } + + /// Get TX inside the mempool of a pubkey. Needed for BMA only #[doc(hidden)] - fn get_pending_transactions_for_bma( + fn get_txs_history_bma_mempool( _dbs_pool: &fast_threadpool::ThreadPoolSyncHandler<SharedDbs<FileBackend>>, _pubkey: PublicKey, ) -> KvResult<Option<TxsHistoryForBma>> { @@ -293,13 +304,13 @@ macro_rules! plug_duniter_modules { // Needed for BMA only #[allow(dead_code)] #[doc(hidden)] - fn get_transactions_history_for_bma( + fn get_txs_history_bma( dbs_pool: &fast_threadpool::ThreadPoolSyncHandler<SharedDbs<FileBackend>>, profile_path_opt: Option<&Path>, pubkey: PublicKey, ) -> KvResult<TxsHistoryForBma> { $( - if let Some(txs_history) = <$M>::get_transactions_history_for_bma(dbs_pool, profile_path_opt, pubkey)? { + if let Some(txs_history) = <$M>::get_txs_history_bma(dbs_pool, profile_path_opt, pubkey)? { return Ok(txs_history); } )* -- GitLab