From b1b2b238928e7be044ad62cf1b222464907ece2c Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Tue, 17 Jul 2018 13:04:35 -0400 Subject: Remove use of CCoinsViewMemPool::GetCoin in wallet code This commit does not change behavior. --- src/node/coin.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/node/coin.cpp (limited to 'src/node/coin.cpp') diff --git a/src/node/coin.cpp b/src/node/coin.cpp new file mode 100644 index 000000000..bb98e63f3 --- /dev/null +++ b/src/node/coin.cpp @@ -0,0 +1,22 @@ +// Copyright (c) 2019 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include + +#include +#include + +void FindCoins(std::map& coins) +{ + LOCK2(cs_main, ::mempool.cs); + assert(pcoinsTip); + CCoinsViewCache& chain_view = *::pcoinsTip; + CCoinsViewMemPool mempool_view(&chain_view, ::mempool); + for (auto& coin : coins) { + if (!mempool_view.GetCoin(coin.first, coin.second)) { + // Either the coin is not in the CCoinsViewCache or is spent. Clear it. + coin.second.Clear(); + } + } +} -- cgit v1.2.3