aboutsummaryrefslogtreecommitdiff
path: root/src/coins.h
diff options
context:
space:
mode:
authorJames O'Beirne <james.obeirne@pm.me>2020-08-25 13:50:23 -0400
committerJames O'Beirne <james.obeirne@pm.me>2021-02-12 07:53:29 -0600
commitf6e2da5fb7c6406c37612c838c998078ea8d2252 (patch)
treea543e8de37216084fe3cc7a32234e873377003e5 /src/coins.h
parent7a6c46b37edb8bfa0085d202aa7e9427d5e4fceb (diff)
downloadbitcoin-f6e2da5fb7c6406c37612c838c998078ea8d2252.tar.xz
simplify ChainstateManager::SnapshotBlockhash() return semantics
Don't return null snapshotblockhash values to avoid caller complexity/confusion.
Diffstat (limited to 'src/coins.h')
-rw-r--r--src/coins.h12
1 files changed, 12 insertions, 0 deletions
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 <functional>
#include <unordered_map>
+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<COutPoint, CCoinsCacheEntry, SaltedOutpointHasher> CCoinsMap;
@@ -263,6 +266,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
* has no effect.