more tweaks based on review

This commit is contained in:
Yeastplume 2022-12-05 11:14:46 +00:00
parent b1beca4206
commit 2a599027f5
3 changed files with 7 additions and 7 deletions

View file

@ -153,7 +153,7 @@ fn test_wallet_tx_filtering(
// Amounts // Amounts
let mut tx_query_args = RetrieveTxQueryArgs::default(); let mut tx_query_args = RetrieveTxQueryArgs::default();
tx_query_args.min_amount_inc = Some(60_000_000_000 - 59_963_300_000); tx_query_args.min_amount = Some(60_000_000_000 - 59_963_300_000);
let tx_results = api let tx_results = api
.retrieve_txs(mask, true, None, None, Some(tx_query_args))? .retrieve_txs(mask, true, None, None, Some(tx_query_args))?
.1; .1;
@ -161,7 +161,7 @@ fn test_wallet_tx_filtering(
// amount, should see as above with coinbases excluded // amount, should see as above with coinbases excluded
let mut tx_query_args = RetrieveTxQueryArgs::default(); let mut tx_query_args = RetrieveTxQueryArgs::default();
tx_query_args.min_amount_inc = Some(60_000_000_000 - 59_963_300_000); tx_query_args.min_amount = Some(60_000_000_000 - 59_963_300_000);
tx_query_args.max_amount = Some(60_000_000_000 - 1); tx_query_args.max_amount = Some(60_000_000_000 - 1);
let tx_results = api let tx_results = api
.retrieve_txs(mask, true, None, None, Some(tx_query_args))? .retrieve_txs(mask, true, None, None, Some(tx_query_args))?
@ -170,7 +170,7 @@ fn test_wallet_tx_filtering(
// Amount - should only see coinbase (incoming) // Amount - should only see coinbase (incoming)
let mut tx_query_args = RetrieveTxQueryArgs::default(); let mut tx_query_args = RetrieveTxQueryArgs::default();
tx_query_args.min_amount_inc = Some(60_000_000_000); tx_query_args.min_amount = Some(60_000_000_000);
let tx_results = api let tx_results = api
.retrieve_txs(mask, true, None, None, Some(tx_query_args))? .retrieve_txs(mask, true, None, None, Some(tx_query_args))?
.1; .1;

View file

@ -205,7 +205,7 @@ pub struct RetrieveTxQueryArgs {
/// lower bound on the total amount (amount_credited - amount_debited), inclusive /// lower bound on the total amount (amount_credited - amount_debited), inclusive
#[serde(with = "secp_ser::opt_string_or_u64")] #[serde(with = "secp_ser::opt_string_or_u64")]
#[serde(default)] #[serde(default)]
pub min_amount_inc: Option<u64>, pub min_amount: Option<u64>,
/// higher bound on the total amount (amount_credited - amount_debited), inclusive /// higher bound on the total amount (amount_credited - amount_debited), inclusive
#[serde(with = "secp_ser::opt_string_or_u64")] #[serde(with = "secp_ser::opt_string_or_u64")]
#[serde(default)] #[serde(default)]
@ -238,7 +238,7 @@ impl Default for RetrieveTxQueryArgs {
include_received_only: Some(false), include_received_only: Some(false),
include_coinbase_only: Some(false), include_coinbase_only: Some(false),
include_reverted_only: Some(false), include_reverted_only: Some(false),
min_amount_inc: None, min_amount: None,
max_amount: None, max_amount: None,
min_creation_timestamp: None, min_creation_timestamp: None,
max_creation_timestamp: None, max_creation_timestamp: None,

View file

@ -202,7 +202,7 @@ where
} }
}) })
.filter(|tx_entry| { .filter(|tx_entry| {
if let Some(v) = query_args.min_amount_inc { if let Some(v) = query_args.min_amount {
if tx_entry.tx_type == TxLogEntryType::TxSent if tx_entry.tx_type == TxLogEntryType::TxSent
|| tx_entry.tx_type == TxLogEntryType::TxSentCancelled || tx_entry.tx_type == TxLogEntryType::TxSentCancelled
{ {
@ -340,7 +340,7 @@ where
K: Keychain + 'a, K: Keychain + 'a,
{ {
let mut txs; let mut txs;
// Adding in new tranasction list query logic. If `tx_id` or `tx_slate_id` // Adding in new transaction list query logic. If `tx_id` or `tx_slate_id`
// is provided, then `query_args` is ignored and old logic is followed. // is provided, then `query_args` is ignored and old logic is followed.
if query_args.is_some() && tx_id.is_none() && tx_slate_id.is_none() { if query_args.is_some() && tx_id.is_none() && tx_slate_id.is_none() {
txs = apply_advanced_tx_list_filtering(wallet, &query_args.unwrap()) txs = apply_advanced_tx_list_filtering(wallet, &query_args.unwrap())