diff --git a/src/coins.h b/src/coins.h --- a/src/coins.h +++ b/src/coins.h @@ -210,6 +210,10 @@ uint256 GetBestBlock() const override; void SetBestBlock(const uint256 &hashBlock); bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock) override; + CCoinsViewCursor *Cursor() const override { + throw std::logic_error( + "CCoinsViewCache cursor iteration not supported."); + } /** * Check if we have the given utxo already loaded in this cache. diff --git a/src/init.cpp b/src/init.cpp --- a/src/init.cpp +++ b/src/init.cpp @@ -155,7 +155,6 @@ // the caller. }; -static CCoinsViewDB *pcoinsdbview = nullptr; static CCoinsViewErrorCatcher *pcoinscatcher = nullptr; static std::unique_ptr globalVerifyHandle; diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -19,6 +19,7 @@ #include "rpc/tojson.h" #include "streams.h" #include "sync.h" +#include "txdb.h" #include "txmempool.h" #include "util.h" #include "utilstrencodings.h" @@ -1014,7 +1015,7 @@ CCoinsStats stats; FlushStateToDisk(); - if (GetUTXOStats(pcoinsTip, stats)) { + if (GetUTXOStats(pcoinsdbview, stats)) { ret.push_back(Pair("height", int64_t(stats.nHeight))); ret.push_back(Pair("bestblock", stats.hashBlock.GetHex())); ret.push_back(Pair("transactions", int64_t(stats.nTransactions))); diff --git a/src/validation.h b/src/validation.h --- a/src/validation.h +++ b/src/validation.h @@ -36,6 +36,7 @@ class CBlockTreeDB; class CBloomFilter; class CChainParams; +class CCoinsViewDB; class CConnman; class CInv; class Config; @@ -631,11 +632,18 @@ /** The currently-connected chain of blocks (protected by cs_main). */ extern CChain chainActive; -/** Global variable that points to the active CCoinsView (protected by cs_main) +/** + * Global variable that points to the coins database (protected by cs_main) + */ +extern CCoinsViewDB *pcoinsdbview; + +/** + * Global variable that points to the active CCoinsView (protected by cs_main) */ extern CCoinsViewCache *pcoinsTip; -/** Global variable that points to the active block tree (protected by cs_main) +/** + * Global variable that points to the active block tree (protected by cs_main) */ extern CBlockTreeDB *pblocktree; diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -158,6 +158,7 @@ return chain.Genesis(); } +CCoinsViewDB *pcoinsdbview = nullptr; CCoinsViewCache *pcoinsTip = nullptr; CBlockTreeDB *pblocktree = nullptr;