aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Morcos <morcos@chaincode.com>2016-01-07 16:31:12 -0500
committerAlex Morcos <morcos@chaincode.com>2016-01-07 16:31:12 -0500
commit9e697172542e2b01517e4025df2c23d0ed5447f4 (patch)
tree9a9db75e37ffc2c0ba0fd51e22a5646ed00e190f
parentf61766b37beb2fecbe3915a72a814cbdb107be0a (diff)
Make wallet descendant searching more efficient
-rw-r--r--src/wallet/wallet.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 1904361bae..448c9badaf 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -784,14 +784,14 @@ void CWallet::MarkConflicted(const uint256& hashBlock, const uint256& hashTx)
// Do not flush the wallet here for performance reasons
CWalletDB walletdb(strWalletFile, "r+", false);
- std::deque<uint256> todo;
+ std::set<uint256> todo;
std::set<uint256> done;
- todo.push_back(hashTx);
+ todo.insert(hashTx);
while (!todo.empty()) {
- uint256 now = todo.front();
- todo.pop_front();
+ uint256 now = *todo.begin();
+ todo.erase(now);
done.insert(now);
assert(mapWallet.count(now));
CWalletTx& wtx = mapWallet[now];
@@ -807,7 +807,7 @@ void CWallet::MarkConflicted(const uint256& hashBlock, const uint256& hashTx)
TxSpends::const_iterator iter = mapTxSpends.lower_bound(COutPoint(now, 0));
while (iter != mapTxSpends.end() && iter->first.hash == now) {
if (!done.count(iter->second)) {
- todo.push_back(iter->second);
+ todo.insert(iter->second);
}
iter++;
}