From f6e2da5fb7c6406c37612c838c998078ea8d2252 Mon Sep 17 00:00:00 2001 From: James O'Beirne Date: Tue, 25 Aug 2020 13:50:23 -0400 Subject: simplify ChainstateManager::SnapshotBlockhash() return semantics Don't return null snapshotblockhash values to avoid caller complexity/confusion. --- src/coins.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/coins.h') diff --git a/src/coins.h b/src/coins.h index d2eb42d8cf..feb441fd6a 100644 --- a/src/coins.h +++ b/src/coins.h @@ -20,6 +20,8 @@ #include #include +class ChainstateManager; + /** * A UTXO entry. * @@ -125,6 +127,7 @@ struct CCoinsCacheEntry CCoinsCacheEntry() : flags(0) {} explicit CCoinsCacheEntry(Coin&& coin_) : coin(std::move(coin_)), flags(0) {} + CCoinsCacheEntry(Coin&& coin_, unsigned char flag) : coin(std::move(coin_)), flags(flag) {} }; typedef std::unordered_map CCoinsMap; @@ -262,6 +265,15 @@ public: */ void AddCoin(const COutPoint& outpoint, Coin&& coin, bool possible_overwrite); + /** + * Emplace a coin into cacheCoins without performing any checks, marking + * the emplaced coin as dirty. + * + * NOT FOR GENERAL USE. Used only when loading coins from a UTXO snapshot. + * @sa ChainstateManager::PopulateAndValidateSnapshot() + */ + void EmplaceCoinInternalDANGER(COutPoint&& outpoint, Coin&& coin); + /** * Spend a coin. Pass moveto in order to get the deleted data. * If no unspent output exists for the passed outpoint, this call -- cgit v1.2.3