diff options
author | João Barbosa <joao.paulo.barbosa@gmail.com> | 2017-08-13 15:04:57 +0100 |
---|---|---|
committer | João Barbosa <joao.paulo.barbosa@gmail.com> | 2017-08-14 23:06:06 +0100 |
commit | 8f2f1e0458d263dc9b51caad0adc0246e3580114 (patch) | |
tree | 80ea20ea2e2de84259af0d6486dae3084cb07e65 /src/qt/walletmodel.cpp | |
parent | aeb31756276034dd506fdf97c8aaade0e7e584f5 (diff) | |
download | bitcoin-8f2f1e0458d263dc9b51caad0adc0246e3580114.tar.xz |
wallet: Avoid second mapWallet lookup
Diffstat (limited to 'src/qt/walletmodel.cpp')
-rw-r--r-- | src/qt/walletmodel.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index ba0e1da0c7..d29b5c92a8 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -577,10 +577,11 @@ void WalletModel::getOutputs(const std::vector<COutPoint>& vOutpoints, std::vect LOCK2(cs_main, wallet->cs_wallet); for (const COutPoint& outpoint : vOutpoints) { - if (!wallet->mapWallet.count(outpoint.hash)) continue; - int nDepth = wallet->mapWallet[outpoint.hash].GetDepthInMainChain(); + auto it = wallet->mapWallet.find(outpoint.hash); + if (it == wallet->mapWallet.end()) continue; + int nDepth = it->second.GetDepthInMainChain(); if (nDepth < 0) continue; - COutput out(&wallet->mapWallet[outpoint.hash], outpoint.n, nDepth, true /* spendable */, true /* solvable */, true /* safe */); + COutput out(&it->second, outpoint.n, nDepth, true /* spendable */, true /* solvable */, true /* safe */); vOutputs.push_back(out); } } |