diff --git a/src/coins.h b/src/coins.h index 2be52ad171..4f1afb00de 100644 --- a/src/coins.h +++ b/src/coins.h @@ -437,6 +437,11 @@ public: private: CCoinsMap::iterator FetchCoins(const uint256 &txid); CCoinsMap::const_iterator FetchCoins(const uint256 &txid) const; + + /** + * By making the copy constructor private, we prevent accidentally using it when one intends to create a cache on top of a base cache. + */ + CCoinsViewCache(const CCoinsViewCache &); }; #endif // BITCOIN_COINS_H diff --git a/src/main.cpp b/src/main.cpp index 5c0f0116d6..675b8afd1d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1718,7 +1718,8 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin // Special case for the genesis block, skipping connection of its transactions // (its coinbase is unspendable) if (block.GetHash() == Params().HashGenesisBlock()) { - view.SetBestBlock(pindex->GetBlockHash()); + if (!fJustCheck) + view.SetBestBlock(pindex->GetBlockHash()); return true; }