Bitcoin Core 30.99.0
P2P Digital Currency
coins.cpp
Go to the documentation of this file.
1// Copyright (c) 2012-present The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#include <coins.h>
6
8#include <logging.h>
9#include <random.h>
10#include <util/trace.h>
11
12TRACEPOINT_SEMAPHORE(utxocache, add);
13TRACEPOINT_SEMAPHORE(utxocache, spent);
14TRACEPOINT_SEMAPHORE(utxocache, uncache);
15
16std::optional<Coin> CCoinsView::GetCoin(const COutPoint& outpoint) const { return std::nullopt; }
18std::vector<uint256> CCoinsView::GetHeadBlocks() const { return std::vector<uint256>(); }
20{
21 for (auto it{cursor.Begin()}; it != cursor.End(); it = cursor.NextAndMaybeErase(*it)) { }
22}
23
24std::unique_ptr<CCoinsViewCursor> CCoinsView::Cursor() const { return nullptr; }
25
26bool CCoinsView::HaveCoin(const COutPoint &outpoint) const
27{
28 return GetCoin(outpoint).has_value();
29}
30
32std::optional<Coin> CCoinsViewBacked::GetCoin(const COutPoint& outpoint) const { return base->GetCoin(outpoint); }
33bool CCoinsViewBacked::HaveCoin(const COutPoint &outpoint) const { return base->HaveCoin(outpoint); }
35std::vector<uint256> CCoinsViewBacked::GetHeadBlocks() const { return base->GetHeadBlocks(); }
36void CCoinsViewBacked::SetBackend(CCoinsView &viewIn) { base = &viewIn; }
37void CCoinsViewBacked::BatchWrite(CoinsViewCacheCursor& cursor, const uint256& hashBlock) { base->BatchWrite(cursor, hashBlock); }
38std::unique_ptr<CCoinsViewCursor> CCoinsViewBacked::Cursor() const { return base->Cursor(); }
40
41CCoinsViewCache::CCoinsViewCache(CCoinsView* baseIn, bool deterministic) :
42 CCoinsViewBacked(baseIn), m_deterministic(deterministic),
43 cacheCoins(0, SaltedOutpointHasher(/*deterministic=*/deterministic), CCoinsMap::key_equal{}, &m_cache_coins_memory_resource)
44{
45 m_sentinel.second.SelfRef(m_sentinel);
46}
47
50}
51
52CCoinsMap::iterator CCoinsViewCache::FetchCoin(const COutPoint &outpoint) const {
53 const auto [ret, inserted] = cacheCoins.try_emplace(outpoint);
54 if (inserted) {
55 if (auto coin{base->GetCoin(outpoint)}) {
56 ret->second.coin = std::move(*coin);
57 cachedCoinsUsage += ret->second.coin.DynamicMemoryUsage();
58 if (ret->second.coin.IsSpent()) { // TODO GetCoin cannot return spent coins
59 // The parent only has an empty entry for this outpoint; we can consider our version as fresh.
61 }
62 } else {
63 cacheCoins.erase(ret);
64 return cacheCoins.end();
65 }
66 }
67 return ret;
68}
69
70std::optional<Coin> CCoinsViewCache::GetCoin(const COutPoint& outpoint) const
71{
72 if (auto it{FetchCoin(outpoint)}; it != cacheCoins.end() && !it->second.coin.IsSpent()) return it->second.coin;
73 return std::nullopt;
74}
75
76void CCoinsViewCache::AddCoin(const COutPoint &outpoint, Coin&& coin, bool possible_overwrite) {
77 assert(!coin.IsSpent());
78 if (coin.out.scriptPubKey.IsUnspendable()) return;
79 CCoinsMap::iterator it;
80 bool inserted;
81 std::tie(it, inserted) = cacheCoins.emplace(std::piecewise_construct, std::forward_as_tuple(outpoint), std::tuple<>());
82 bool fresh = false;
83 if (!possible_overwrite) {
84 if (!it->second.coin.IsSpent()) {
85 throw std::logic_error("Attempted to overwrite an unspent coin (when possible_overwrite is false)");
86 }
87 // If the coin exists in this cache as a spent coin and is DIRTY, then
88 // its spentness hasn't been flushed to the parent cache. We're
89 // re-adding the coin to this cache now but we can't mark it as FRESH.
90 // If we mark it FRESH and then spend it before the cache is flushed
91 // we would remove it from this cache and would never flush spentness
92 // to the parent cache.
93 //
94 // Re-adding a spent coin can happen in the case of a re-org (the coin
95 // is 'spent' when the block adding it is disconnected and then
96 // re-added when it is also added in a newly connected block).
97 //
98 // If the coin doesn't exist in the current cache, or is spent but not
99 // DIRTY, then it can be marked FRESH.
100 fresh = !it->second.IsDirty();
101 }
102 if (!inserted) {
103 cachedCoinsUsage -= it->second.coin.DynamicMemoryUsage();
104 }
105 it->second.coin = std::move(coin);
107 if (fresh) CCoinsCacheEntry::SetFresh(*it, m_sentinel);
108 cachedCoinsUsage += it->second.coin.DynamicMemoryUsage();
109 TRACEPOINT(utxocache, add,
110 outpoint.hash.data(),
111 (uint32_t)outpoint.n,
112 (uint32_t)it->second.coin.nHeight,
113 (int64_t)it->second.coin.out.nValue,
114 (bool)it->second.coin.IsCoinBase());
115}
116
118 const auto mem_usage{coin.DynamicMemoryUsage()};
119 auto [it, inserted] = cacheCoins.try_emplace(std::move(outpoint), std::move(coin));
120 if (inserted) {
122 cachedCoinsUsage += mem_usage;
123 }
124}
125
126void AddCoins(CCoinsViewCache& cache, const CTransaction &tx, int nHeight, bool check_for_overwrite) {
127 bool fCoinbase = tx.IsCoinBase();
128 const Txid& txid = tx.GetHash();
129 for (size_t i = 0; i < tx.vout.size(); ++i) {
130 bool overwrite = check_for_overwrite ? cache.HaveCoin(COutPoint(txid, i)) : fCoinbase;
131 // Coinbase transactions can always be overwritten, in order to correctly
132 // deal with the pre-BIP30 occurrences of duplicate coinbase transactions.
133 cache.AddCoin(COutPoint(txid, i), Coin(tx.vout[i], nHeight, fCoinbase), overwrite);
134 }
135}
136
137bool CCoinsViewCache::SpendCoin(const COutPoint &outpoint, Coin* moveout) {
138 CCoinsMap::iterator it = FetchCoin(outpoint);
139 if (it == cacheCoins.end()) return false;
140 cachedCoinsUsage -= it->second.coin.DynamicMemoryUsage();
141 TRACEPOINT(utxocache, spent,
142 outpoint.hash.data(),
143 (uint32_t)outpoint.n,
144 (uint32_t)it->second.coin.nHeight,
145 (int64_t)it->second.coin.out.nValue,
146 (bool)it->second.coin.IsCoinBase());
147 if (moveout) {
148 *moveout = std::move(it->second.coin);
149 }
150 if (it->second.IsFresh()) {
151 cacheCoins.erase(it);
152 } else {
154 it->second.coin.Clear();
155 }
156 return true;
157}
158
159static const Coin coinEmpty;
160
161const Coin& CCoinsViewCache::AccessCoin(const COutPoint &outpoint) const {
162 CCoinsMap::const_iterator it = FetchCoin(outpoint);
163 if (it == cacheCoins.end()) {
164 return coinEmpty;
165 } else {
166 return it->second.coin;
167 }
168}
169
170bool CCoinsViewCache::HaveCoin(const COutPoint &outpoint) const {
171 CCoinsMap::const_iterator it = FetchCoin(outpoint);
172 return (it != cacheCoins.end() && !it->second.coin.IsSpent());
173}
174
175bool CCoinsViewCache::HaveCoinInCache(const COutPoint &outpoint) const {
176 CCoinsMap::const_iterator it = cacheCoins.find(outpoint);
177 return (it != cacheCoins.end() && !it->second.coin.IsSpent());
178}
179
181 if (hashBlock.IsNull())
183 return hashBlock;
184}
185
186void CCoinsViewCache::SetBestBlock(const uint256 &hashBlockIn) {
187 hashBlock = hashBlockIn;
188}
189
191{
192 for (auto it{cursor.Begin()}; it != cursor.End(); it = cursor.NextAndMaybeErase(*it)) {
193 if (!it->second.IsDirty()) { // TODO a cursor can only contain dirty entries
194 continue;
195 }
196 auto [itUs, inserted]{cacheCoins.try_emplace(it->first)};
197 if (inserted) {
198 if (it->second.IsFresh() && it->second.coin.IsSpent()) {
199 cacheCoins.erase(itUs); // TODO fresh coins should have been removed at spend
200 } else {
201 // The parent cache does not have an entry, while the child cache does.
202 // Move the data up and mark it as dirty.
203 CCoinsCacheEntry& entry{itUs->second};
204 assert(entry.coin.DynamicMemoryUsage() == 0);
205 if (cursor.WillErase(*it)) {
206 // Since this entry will be erased,
207 // we can move the coin into us instead of copying it
208 entry.coin = std::move(it->second.coin);
209 } else {
210 entry.coin = it->second.coin;
211 }
212 cachedCoinsUsage += entry.coin.DynamicMemoryUsage();
214 // We can mark it FRESH in the parent if it was FRESH in the child
215 // Otherwise it might have just been flushed from the parent's cache
216 // and already exist in the grandparent
217 if (it->second.IsFresh()) CCoinsCacheEntry::SetFresh(*itUs, m_sentinel);
218 }
219 } else {
220 // Found the entry in the parent cache
221 if (it->second.IsFresh() && !itUs->second.coin.IsSpent()) {
222 // The coin was marked FRESH in the child cache, but the coin
223 // exists in the parent cache. If this ever happens, it means
224 // the FRESH flag was misapplied and there is a logic error in
225 // the calling code.
226 throw std::logic_error("FRESH flag misapplied to coin that exists in parent cache");
227 }
228
229 if (itUs->second.IsFresh() && it->second.coin.IsSpent()) {
230 // The grandparent cache does not have an entry, and the coin
231 // has been spent. We can just delete it from the parent cache.
232 cachedCoinsUsage -= itUs->second.coin.DynamicMemoryUsage();
233 cacheCoins.erase(itUs);
234 } else {
235 // A normal modification.
236 cachedCoinsUsage -= itUs->second.coin.DynamicMemoryUsage();
237 if (cursor.WillErase(*it)) {
238 // Since this entry will be erased,
239 // we can move the coin into us instead of copying it
240 itUs->second.coin = std::move(it->second.coin);
241 } else {
242 itUs->second.coin = it->second.coin;
243 }
244 cachedCoinsUsage += itUs->second.coin.DynamicMemoryUsage();
246 // NOTE: It isn't safe to mark the coin as FRESH in the parent
247 // cache. If it already existed and was spent in the parent
248 // cache then marking it FRESH would prevent that spentness
249 // from being flushed to the grandparent.
250 }
251 }
252 }
253 hashBlock = hashBlockIn;
254}
255
256void CCoinsViewCache::Flush(bool will_reuse_cache)
257{
258 auto cursor{CoinsViewCacheCursor(m_sentinel, cacheCoins, /*will_erase=*/true)};
259 base->BatchWrite(cursor, hashBlock);
260 cacheCoins.clear();
261 if (will_reuse_cache) {
263 }
265}
266
268{
269 auto cursor{CoinsViewCacheCursor(m_sentinel, cacheCoins, /*will_erase=*/false)};
270 base->BatchWrite(cursor, hashBlock);
271 if (m_sentinel.second.Next() != &m_sentinel) {
272 /* BatchWrite must clear flags of all entries */
273 throw std::logic_error("Not all unspent flagged entries were cleared");
274 }
275}
276
278{
279 CCoinsMap::iterator it = cacheCoins.find(hash);
280 if (it != cacheCoins.end() && !it->second.IsDirty() && !it->second.IsFresh()) {
281 cachedCoinsUsage -= it->second.coin.DynamicMemoryUsage();
282 TRACEPOINT(utxocache, uncache,
283 hash.hash.data(),
284 (uint32_t)hash.n,
285 (uint32_t)it->second.coin.nHeight,
286 (int64_t)it->second.coin.out.nValue,
287 (bool)it->second.coin.IsCoinBase());
288 cacheCoins.erase(it);
289 }
290}
291
292unsigned int CCoinsViewCache::GetCacheSize() const {
293 return cacheCoins.size();
294}
295
297{
298 if (!tx.IsCoinBase()) {
299 for (unsigned int i = 0; i < tx.vin.size(); i++) {
300 if (!HaveCoin(tx.vin[i].prevout)) {
301 return false;
302 }
303 }
304 }
305 return true;
306}
307
309{
310 // Cache should be empty when we're calling this.
311 assert(cacheCoins.size() == 0);
312 cacheCoins.~CCoinsMap();
313 m_cache_coins_memory_resource.~CCoinsMapMemoryResource();
315 ::new (&cacheCoins) CCoinsMap{0, SaltedOutpointHasher{/*deterministic=*/m_deterministic}, CCoinsMap::key_equal{}, &m_cache_coins_memory_resource};
316}
317
319{
320 size_t recomputed_usage = 0;
321 size_t count_flagged = 0;
322 for (const auto& [_, entry] : cacheCoins) {
323 unsigned attr = 0;
324 if (entry.IsDirty()) attr |= 1;
325 if (entry.IsFresh()) attr |= 2;
326 if (entry.coin.IsSpent()) attr |= 4;
327 // Only 5 combinations are possible.
328 assert(attr != 2 && attr != 4 && attr != 7);
329
330 // Recompute cachedCoinsUsage.
331 recomputed_usage += entry.coin.DynamicMemoryUsage();
332
333 // Count the number of entries we expect in the linked list.
334 if (entry.IsDirty() || entry.IsFresh()) ++count_flagged;
335 }
336 // Iterate over the linked list of flagged entries.
337 size_t count_linked = 0;
338 for (auto it = m_sentinel.second.Next(); it != &m_sentinel; it = it->second.Next()) {
339 // Verify linked list integrity.
340 assert(it->second.Next()->second.Prev() == it);
341 assert(it->second.Prev()->second.Next() == it);
342 // Verify they are actually flagged.
343 assert(it->second.IsDirty() || it->second.IsFresh());
344 // Count the number of entries actually in the list.
345 ++count_linked;
346 }
347 assert(count_linked == count_flagged);
348 assert(recomputed_usage == cachedCoinsUsage);
349}
350
353
354const Coin& AccessByTxid(const CCoinsViewCache& view, const Txid& txid)
355{
356 COutPoint iter(txid, 0);
357 while (iter.n < MAX_OUTPUTS_PER_BLOCK) {
358 const Coin& alternate = view.AccessCoin(iter);
359 if (!alternate.IsSpent()) return alternate;
360 ++iter.n;
361 }
362 return coinEmpty;
363}
364
365template <typename ReturnType, typename Func>
366static ReturnType ExecuteBackedWrapper(Func func, const std::vector<std::function<void()>>& err_callbacks)
367{
368 try {
369 return func();
370 } catch(const std::runtime_error& e) {
371 for (const auto& f : err_callbacks) {
372 f();
373 }
374 LogError("Error reading from database: %s\n", e.what());
375 // Starting the shutdown sequence and returning false to the caller would be
376 // interpreted as 'entry not found' (as opposed to unable to read data), and
377 // could lead to invalid interpretation. Just exit immediately, as we can't
378 // continue anyway, and all writes should be atomic.
379 std::abort();
380 }
381}
382
383std::optional<Coin> CCoinsViewErrorCatcher::GetCoin(const COutPoint& outpoint) const
384{
385 return ExecuteBackedWrapper<std::optional<Coin>>([&]() { return CCoinsViewBacked::GetCoin(outpoint); }, m_err_callbacks);
386}
387
389{
390 return ExecuteBackedWrapper<bool>([&]() { return CCoinsViewBacked::HaveCoin(outpoint); }, m_err_callbacks);
391}
int ret
CCoinsView backed by another CCoinsView.
Definition: coins.h:342
void BatchWrite(CoinsViewCacheCursor &cursor, const uint256 &hashBlock) override
Do a bulk modification (multiple Coin changes + BestBlock change).
Definition: coins.cpp:37
bool HaveCoin(const COutPoint &outpoint) const override
Just check whether a given outpoint is unspent.
Definition: coins.cpp:33
size_t EstimateSize() const override
Estimate database size (0 if not implemented)
Definition: coins.cpp:39
uint256 GetBestBlock() const override
Retrieve the block hash whose state this CCoinsView currently represents.
Definition: coins.cpp:34
std::optional< Coin > GetCoin(const COutPoint &outpoint) const override
Retrieve the Coin (unspent transaction output) for a given outpoint.
Definition: coins.cpp:32
void SetBackend(CCoinsView &viewIn)
Definition: coins.cpp:36
std::unique_ptr< CCoinsViewCursor > Cursor() const override
Get a cursor to iterate over the whole state.
Definition: coins.cpp:38
CCoinsView * base
Definition: coins.h:344
std::vector< uint256 > GetHeadBlocks() const override
Retrieve the range of blocks that may have been only partially written.
Definition: coins.cpp:35
CCoinsViewBacked(CCoinsView *viewIn)
Definition: coins.cpp:31
CCoinsView that adds a memory cache for transactions to another CCoinsView.
Definition: coins.h:361
void Sync()
Push the modifications applied to this cache to its base while retaining the contents of this cache (...
Definition: coins.cpp:267
CCoinsViewCache(CCoinsView *baseIn, bool deterministic=false)
Definition: coins.cpp:41
const bool m_deterministic
Definition: coins.h:363
uint256 hashBlock
Make mutable so that we can "fill the cache" even from Get-methods declared as "const".
Definition: coins.h:370
CCoinsMapMemoryResource m_cache_coins_memory_resource
Definition: coins.h:371
bool SpendCoin(const COutPoint &outpoint, Coin *moveto=nullptr)
Spend a coin.
Definition: coins.cpp:137
void Uncache(const COutPoint &outpoint)
Removes the UTXO with the given outpoint from the cache, if it is not modified.
Definition: coins.cpp:277
bool HaveInputs(const CTransaction &tx) const
Check whether all prevouts of the transaction are present in the UTXO set represented by this view.
Definition: coins.cpp:296
void AddCoin(const COutPoint &outpoint, Coin &&coin, bool possible_overwrite)
Add a coin.
Definition: coins.cpp:76
unsigned int GetCacheSize() const
Calculate the size of the cache (in number of transaction outputs)
Definition: coins.cpp:292
uint256 GetBestBlock() const override
Retrieve the block hash whose state this CCoinsView currently represents.
Definition: coins.cpp:180
size_t cachedCoinsUsage
Definition: coins.h:377
void Flush(bool will_reuse_cache=true)
Push the modifications applied to this cache to its base and wipe local state.
Definition: coins.cpp:256
void SetBestBlock(const uint256 &hashBlock)
Definition: coins.cpp:186
CCoinsMap::iterator FetchCoin(const COutPoint &outpoint) const
Definition: coins.cpp:52
bool HaveCoinInCache(const COutPoint &outpoint) const
Check if we have the given utxo already loaded in this cache.
Definition: coins.cpp:175
CoinsCachePair m_sentinel
Definition: coins.h:373
size_t DynamicMemoryUsage() const
Calculate the size of the cache (in bytes)
Definition: coins.cpp:48
void BatchWrite(CoinsViewCacheCursor &cursor, const uint256 &hashBlock) override
Do a bulk modification (multiple Coin changes + BestBlock change).
Definition: coins.cpp:190
void EmplaceCoinInternalDANGER(COutPoint &&outpoint, Coin &&coin)
Emplace a coin into cacheCoins without performing any checks, marking the emplaced coin as dirty.
Definition: coins.cpp:117
bool HaveCoin(const COutPoint &outpoint) const override
Just check whether a given outpoint is unspent.
Definition: coins.cpp:170
void SanityCheck() const
Run an internal sanity check on the cache data structure. *‍/.
Definition: coins.cpp:318
CCoinsMap cacheCoins
Definition: coins.h:374
std::optional< Coin > GetCoin(const COutPoint &outpoint) const override
Retrieve the Coin (unspent transaction output) for a given outpoint.
Definition: coins.cpp:70
const Coin & AccessCoin(const COutPoint &output) const
Return a reference to Coin in the cache, or coinEmpty if not found.
Definition: coins.cpp:161
void ReallocateCache()
Force a reallocation of the cache map.
Definition: coins.cpp:308
std::optional< Coin > GetCoin(const COutPoint &outpoint) const override
Retrieve the Coin (unspent transaction output) for a given outpoint.
Definition: coins.cpp:383
std::vector< std::function< void()> > m_err_callbacks
A list of callbacks to execute upon leveldb read error.
Definition: coins.h:523
bool HaveCoin(const COutPoint &outpoint) const override
Just check whether a given outpoint is unspent.
Definition: coins.cpp:388
Abstract view on the open txout dataset.
Definition: coins.h:308
virtual std::optional< Coin > GetCoin(const COutPoint &outpoint) const
Retrieve the Coin (unspent transaction output) for a given outpoint.
Definition: coins.cpp:16
virtual void BatchWrite(CoinsViewCacheCursor &cursor, const uint256 &hashBlock)
Do a bulk modification (multiple Coin changes + BestBlock change).
Definition: coins.cpp:19
virtual std::vector< uint256 > GetHeadBlocks() const
Retrieve the range of blocks that may have been only partially written.
Definition: coins.cpp:18
virtual bool HaveCoin(const COutPoint &outpoint) const
Just check whether a given outpoint is unspent.
Definition: coins.cpp:26
virtual size_t EstimateSize() const
Estimate database size (0 if not implemented)
Definition: coins.h:336
virtual std::unique_ptr< CCoinsViewCursor > Cursor() const
Get a cursor to iterate over the whole state.
Definition: coins.cpp:24
virtual uint256 GetBestBlock() const
Retrieve the block hash whose state this CCoinsView currently represents.
Definition: coins.cpp:17
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:29
uint32_t n
Definition: transaction.h:32
Txid hash
Definition: transaction.h:31
The basic transaction that is broadcasted on the network and contained in blocks.
Definition: transaction.h:281
const std::vector< CTxOut > vout
Definition: transaction.h:292
bool IsCoinBase() const
Definition: transaction.h:341
const Txid & GetHash() const LIFETIMEBOUND
Definition: transaction.h:328
const std::vector< CTxIn > vin
Definition: transaction.h:291
An output of a transaction.
Definition: transaction.h:140
A UTXO entry.
Definition: coins.h:33
bool IsSpent() const
Either this coin never existed (see e.g.
Definition: coins.h:81
constexpr bool IsNull() const
Definition: uint256.h:48
constexpr const std::byte * data() const
256-bit opaque blob.
Definition: uint256.h:195
static const Coin coinEmpty
Definition: coins.cpp:159
TRACEPOINT_SEMAPHORE(utxocache, add)
static const uint64_t MAX_OUTPUTS_PER_BLOCK
Definition: coins.cpp:352
static const uint64_t MIN_TRANSACTION_OUTPUT_WEIGHT
Definition: coins.cpp:351
static ReturnType ExecuteBackedWrapper(Func func, const std::vector< std::function< void()> > &err_callbacks)
Definition: coins.cpp:366
const Coin & AccessByTxid(const CCoinsViewCache &view, const Txid &txid)
Utility function to find any unspent output with a given txid.
Definition: coins.cpp:354
void AddCoins(CCoinsViewCache &cache, const CTransaction &tx, int nHeight, bool check_for_overwrite)
Utility function to add all of a transaction's outputs to a cache.
Definition: coins.cpp:126
std::unordered_map< COutPoint, CCoinsCacheEntry, SaltedOutpointHasher, std::equal_to< COutPoint >, PoolAllocator< CoinsCachePair, sizeof(CoinsCachePair)+sizeof(void *) *4 > > CCoinsMap
PoolAllocator's MAX_BLOCK_SIZE_BYTES parameter here uses sizeof the data, and adds the size of 4 poin...
Definition: coins.h:229
CCoinsMap::allocator_type::ResourceType CCoinsMapMemoryResource
Definition: coins.h:231
static const unsigned int MAX_BLOCK_WEIGHT
The maximum allowed weight for a block, see BIP 141 (network rule)
Definition: consensus.h:15
static const int WITNESS_SCALE_FACTOR
Definition: consensus.h:21
#define LogError(...)
Definition: logging.h:394
unsigned int nHeight
static size_t DynamicUsage(const int8_t &v)
Dynamic memory usage for built-in types is zero.
Definition: memusage.h:31
bool Func(const std::string &str, std::span< const char > &sp)
Parse a function call.
Definition: parsing.cpp:24
uint64_t GetSerializeSize(const T &t)
Definition: serialize.h:1095
A Coin in one level of the coins database caching hierarchy.
Definition: coins.h:109
static void SetFresh(CoinsCachePair &pair, CoinsCachePair &sentinel) noexcept
Definition: coins.h:178
static void SetDirty(CoinsCachePair &pair, CoinsCachePair &sentinel) noexcept
Definition: coins.h:177
Cursor for iterating over the linked list of flagged entries in CCoinsViewCache.
Definition: coins.h:266
CoinsCachePair * NextAndMaybeErase(CoinsCachePair &current) noexcept
Return the next entry after current, possibly erasing current.
Definition: coins.h:283
bool WillErase(CoinsCachePair &current) const noexcept
Definition: coins.h:299
CoinsCachePair * Begin() const noexcept
Definition: coins.h:279
CoinsCachePair * End() const noexcept
Definition: coins.h:280
#define TRACEPOINT(context,...)
Definition: trace.h:56
consteval auto _(util::TranslatedLiteral str)
Definition: translation.h:79
assert(!tx.IsCoinBase())