aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-01-13 14:47:01 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-01-13 14:47:42 +0000
commit2112060d0340c0d8e9eae4bd6591b6e4074849fc (patch)
tree20487b4957138116660f6f21e259ad2e58ae4880 /src/wallet/wallet2.cpp
parentMerge pull request #5045 (diff)
downloadmonero-2112060d0340c0d8e9eae4bd6591b6e4074849fc.tar.xz
wallet2: fix duplicate tx notifications for pool txes
Diffstat (limited to '')
-rw-r--r--src/wallet/wallet2.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 2080c1832..a0af1e84a 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -610,7 +610,7 @@ std::string strjoin(const std::vector<size_t> &V, const char *sep)
return ss.str();
}
-static void emplace_or_replace(std::unordered_multimap<crypto::hash, tools::wallet2::pool_payment_details> &container,
+static bool emplace_or_replace(std::unordered_multimap<crypto::hash, tools::wallet2::pool_payment_details> &container,
const crypto::hash &key, const tools::wallet2::pool_payment_details &pd)
{
auto range = container.equal_range(key);
@@ -619,10 +619,11 @@ static void emplace_or_replace(std::unordered_multimap<crypto::hash, tools::wall
if (i->second.m_pd.m_tx_hash == pd.m_pd.m_tx_hash && i->second.m_pd.m_subaddr_index == pd.m_pd.m_subaddr_index)
{
i->second = pd;
- return;
+ return false;
}
}
container.emplace(key, pd);
+ return true;
}
void drop_from_short_history(std::list<crypto::hash> &short_chain_history, size_t N)
@@ -1939,6 +1940,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
return;
}
+ bool all_same = true;
for (const auto& i : tx_money_got_in_outs)
{
payment_details payment;
@@ -1951,7 +1953,8 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
payment.m_coinbase = miner_tx;
payment.m_subaddr_index = i.first;
if (pool) {
- emplace_or_replace(m_unconfirmed_payments, payment_id, pool_payment_details{payment, double_spend_seen});
+ if (emplace_or_replace(m_unconfirmed_payments, payment_id, pool_payment_details{payment, double_spend_seen}))
+ all_same = false;
if (0 != m_callback)
m_callback->on_unconfirmed_money_received(height, txid, tx, payment.m_amount, payment.m_subaddr_index);
}
@@ -1959,6 +1962,10 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
m_payments.emplace(payment_id, payment);
LOG_PRINT_L2("Payment found in " << (pool ? "pool" : "block") << ": " << payment_id << " / " << payment.m_tx_hash << " / " << payment.m_amount);
}
+
+ // if it's a pool tx and we already had it, don't notify again
+ if (pool && all_same)
+ notify = false;
}
if (notify)