Skip to content
Snippets Groups Projects
Commit 7639443a authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[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()'
parent eb45dec5
Branches
No related tags found
1 merge request!2[enh] add `get_written_transactions_for_bma()` and `get_pending_transactions_for_bma()`
Pipeline #31865 failed
...@@ -85,9 +85,9 @@ pub trait DuniterModule: 'static + Sized { ...@@ -85,9 +85,9 @@ pub trait DuniterModule: 'static + Sized {
async fn start(self) -> anyhow::Result<()>; async fn start(self) -> anyhow::Result<()>;
// Needed for BMA only /// Get TX full history of a pubkey. Needed for BMA only
#[doc(hidden)] #[doc(hidden)]
fn get_transactions_history_for_bma( fn get_txs_history_bma(
_dbs_pool: &fast_threadpool::ThreadPoolSyncHandler<SharedDbs<FileBackend>>, _dbs_pool: &fast_threadpool::ThreadPoolSyncHandler<SharedDbs<FileBackend>>,
_profile_path_opt: Option<&Path>, _profile_path_opt: Option<&Path>,
_pubkey: PublicKey, _pubkey: PublicKey,
...@@ -95,20 +95,31 @@ pub trait DuniterModule: 'static + Sized { ...@@ -95,20 +95,31 @@ pub trait DuniterModule: 'static + Sized {
Ok(None) Ok(None)
} }
// Needed for BMA only /// Get TX history of a pubkey from a block range. Needed for BMA only
#[doc(hidden)] #[doc(hidden)]
fn get_written_transactions_for_bma( fn get_tx_history_bma_written_by_blocks(
_profile_path_opt: Option<&Path>, _profile_path_opt: Option<&Path>,
_pubkey: PublicKey, _pubkey: PublicKey,
_start_block: u32, _from: Option<u32>,
_end_block: u32, _to: Option<u32>,
) -> KvResult<Option<TxsHistoryForBma>> { ) -> KvResult<Option<TxsHistoryForBma>> {
Ok(None) Ok(None)
} }
// Needed for BMA only /// Get TX history of a pubkey from a median_time range. Needed for BMA only
#[doc(hidden)] #[doc(hidden)]
fn get_pending_transactions_for_bma( 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_txs_history_bma_mempool(
_dbs_pool: &fast_threadpool::ThreadPoolSyncHandler<SharedDbs<FileBackend>>, _dbs_pool: &fast_threadpool::ThreadPoolSyncHandler<SharedDbs<FileBackend>>,
_pubkey: PublicKey, _pubkey: PublicKey,
) -> KvResult<Option<TxsHistoryForBma>> { ) -> KvResult<Option<TxsHistoryForBma>> {
...@@ -293,13 +304,13 @@ macro_rules! plug_duniter_modules { ...@@ -293,13 +304,13 @@ macro_rules! plug_duniter_modules {
// Needed for BMA only // Needed for BMA only
#[allow(dead_code)] #[allow(dead_code)]
#[doc(hidden)] #[doc(hidden)]
fn get_transactions_history_for_bma( fn get_txs_history_bma(
dbs_pool: &fast_threadpool::ThreadPoolSyncHandler<SharedDbs<FileBackend>>, dbs_pool: &fast_threadpool::ThreadPoolSyncHandler<SharedDbs<FileBackend>>,
profile_path_opt: Option<&Path>, profile_path_opt: Option<&Path>,
pubkey: PublicKey, pubkey: PublicKey,
) -> KvResult<TxsHistoryForBma> { ) -> 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); return Ok(txs_history);
} }
)* )*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment