diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2018-07-17 13:04:35 -0400 |
---|---|---|
committer | Russell Yanofsky <russ@yanofsky.org> | 2019-03-05 10:20:00 -0400 |
commit | b1b2b238928e7be044ad62cf1b222464907ece2c (patch) | |
tree | 50767a07bf5bdca1b6b4e2de761e90957febfaf0 /src/node/coin.cpp | |
parent | 4e4d9e9f85eaf9c3bec48559bd4cad3e8a9333ca (diff) |
Remove use of CCoinsViewMemPool::GetCoin in wallet code
This commit does not change behavior.
Diffstat (limited to 'src/node/coin.cpp')
-rw-r--r-- | src/node/coin.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/node/coin.cpp b/src/node/coin.cpp new file mode 100644 index 0000000000..bb98e63f3a --- /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 <node/coin.h> + +#include <txmempool.h> +#include <validation.h> + +void FindCoins(std::map<COutPoint, Coin>& 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(); + } + } +} |