aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2023-03-21 14:44:27 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2023-03-21 21:05:53 +0000
commit7a4a03d9d3413258b00122d56675d3a029b52013 (patch)
treea7297f0bd08f2a0a7dcdcc7b5eb828e934b57600 /src/wallet
parentMerge pull request #8775 (diff)
downloadmonero-7a4a03d9d3413258b00122d56675d3a029b52013.tar.xz
wallet2: do not commit transactions more than once
Fixes #8793
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet2.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index e61bfa9f0..227ea19bd 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -6745,6 +6745,24 @@ void wallet2::commit_tx(pending_tx& ptx)
crypto::hash txid;
txid = get_transaction_hash(ptx.tx);
+
+ // if it's already processed, bail
+ if (std::find_if(m_transfers.begin(), m_transfers.end(), [&txid](const transfer_details &td) { return td.m_txid == txid; }) != m_transfers.end())
+ {
+ MDEBUG("Transaction " << txid << " already processed");
+ return;
+ }
+ if (m_unconfirmed_txs.find(txid) != m_unconfirmed_txs.end())
+ {
+ MDEBUG("Transaction " << txid << " already processed");
+ return;
+ }
+ if (m_confirmed_txs.find(txid) != m_confirmed_txs.end())
+ {
+ MDEBUG("Transaction " << txid << " already processed");
+ return;
+ }
+
crypto::hash payment_id = crypto::null_hash;
std::vector<cryptonote::tx_destination_entry> dests;
uint64_t amount_in = 0;