Skip to content

Commit 9e69717

Browse files
committed
Make wallet descendant searching more efficient
1 parent f61766b commit 9e69717

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/wallet/wallet.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -784,14 +784,14 @@ void CWallet::MarkConflicted(const uint256& hashBlock, const uint256& hashTx)
784784
// Do not flush the wallet here for performance reasons
785785
CWalletDB walletdb(strWalletFile, "r+", false);
786786

787-
std::deque<uint256> todo;
787+
std::set<uint256> todo;
788788
std::set<uint256> done;
789789

790-
todo.push_back(hashTx);
790+
todo.insert(hashTx);
791791

792792
while (!todo.empty()) {
793-
uint256 now = todo.front();
794-
todo.pop_front();
793+
uint256 now = *todo.begin();
794+
todo.erase(now);
795795
done.insert(now);
796796
assert(mapWallet.count(now));
797797
CWalletTx& wtx = mapWallet[now];
@@ -807,7 +807,7 @@ void CWallet::MarkConflicted(const uint256& hashBlock, const uint256& hashTx)
807807
TxSpends::const_iterator iter = mapTxSpends.lower_bound(COutPoint(now, 0));
808808
while (iter != mapTxSpends.end() && iter->first.hash == now) {
809809
if (!done.count(iter->second)) {
810-
todo.push_back(iter->second);
810+
todo.insert(iter->second);
811811
}
812812
iter++;
813813
}

0 commit comments

Comments
 (0)