From dc19605ec7b1a04261bfeb4a86204fbf58adada1 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Fri, 6 Feb 2015 07:25:46 +0300 Subject: [PATCH] call NotifyTransactionChanged for the same prevout tx hash only once per tx commit --- src/wallet.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/wallet.cpp b/src/wallet.cpp index f1ac2911d1ec5..42e7a9ce64d8f 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -2025,14 +2025,17 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey, std: AddToWallet(wtxNew); // Notify that old coins are spent - set setCoins; + set updated_hahes; BOOST_FOREACH(const CTxIn& txin, wtxNew.vin) { + // notify only once + if(updated_hahes.find(txin.prevout.hash) != updated_hahes.end()) continue; + CWalletTx &coin = mapWallet[txin.prevout.hash]; coin.BindWallet(this); - NotifyTransactionChanged(this, coin.GetHash(), CT_UPDATED); + NotifyTransactionChanged(this, txin.prevout.hash, CT_UPDATED); + updated_hahes.insert(txin.prevout.hash); } - if (fFileBacked) delete pwalletdb; }