From d26fc8ad7f7761ded06660485e73f40c2732f8fb Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Wed, 8 Jun 2022 17:33:02 +0200 Subject: [PATCH] filtering transactions improved --- src/wallet/wallet2.cpp | 14 ++++++++++++++ src/wallet/wallet2.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 54f88e1e..eb697c02 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -3234,6 +3234,20 @@ bool enum_container(iterator_t it_begin, iterator_t it_end, callback_t cb) return true; } //---------------------------------------------------------------------------------------------------- +bool wallet2::is_consolidating_transaction(const wallet_public::wallet_transfer_info& wti) +{ + if (!wti.is_income) + { + uint64_t income = 0; + for (uint64_t r : wti.td.rcv){income += r;} + uint64_t spend = 0; + for (uint64_t s : wti.td.spn) { spend += s; } + if (get_tx_fee(wti.tx) + spend = income) + return true; + } + return false; +} +//---------------------------------------------------------------------------------------------------- void wallet2::get_recent_transfers_history(std::vector& trs, size_t offset, size_t count, uint64_t& total, uint64_t& last_item_index, bool exclude_mining_txs, bool start_from_end) { if (!count || offset >= m_transfer_history.size()) diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index d34cc4e0..eec495a0 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -512,6 +512,7 @@ namespace tools const currency::account_base& get_account() const { return m_account; } void get_recent_transfers_history(std::vector& trs, size_t offset, size_t count, uint64_t& total, uint64_t& last_item_index, bool exclude_mining_txs = false, bool start_from_end = true); + bool is_consolidating_transaction(const wallet_public::wallet_transfer_info& wti); uint64_t get_recent_transfers_total_count(); uint64_t get_transfer_entries_count(); void get_unconfirmed_transfers(std::vector& trs, bool exclude_mining_txs = false);