49 struct CacheCoinSnapshot {
54 bool operator==(
const CacheCoinSnapshot&)
const =
default;
59 std::vector<CacheCoinSnapshot>
snapshot;
62 for (
const auto& [outpoint, entry] : cacheCoins) {
63 snapshot.emplace_back(outpoint, entry.IsDirty(), entry.IsFresh(), entry.coin);
66 std::ranges::sort(
snapshot, std::less<>{}, &CacheCoinSnapshot::outpoint);
115 seed_cache.AddCoin(outpoint, std::move(*coin),
true);
117 tx.
vin.emplace_back(outpoint);
138 const bool is_db{
db !=
nullptr};
294 bool is_spent =
false;
411 .cache_bytes = 1
_MiB,
442 .cache_bytes = 1
_MiB,
bool MoneyRange(const CAmount &nValue)
int64_t CAmount
Amount in satoshis (Can be negative)
constexpr int32_t DEFAULT_PREVOUTFETCH_THREADS
std::vector< CTransactionRef > vtx
CCoinsView that adds a memory cache for transactions to another CCoinsView.
CCoinsViewCache(CCoinsView *in_base, bool deterministic=false)
void SetBestBlock(const uint256 &block_hash)
void BatchWrite(CoinsViewCacheCursor &cursor, const uint256 &block_hash) override
Do a bulk modification (multiple Coin changes + BestBlock change).
CCoinsView backed by the coin database (chainstate/)
Pure abstract view on the open txout dataset.
An outpoint - a combination of a transaction hash and an index n into its vout.
The basic transaction that is broadcasted on the network and contained in blocks.
An output of a transaction.
bool IsSpent() const
Either this coin never existed (see e.g.
static CoinsViewEmpty & Get()
CCoinsViewCache subclass that asynchronously fetches most block input prevouts in parallel during Con...
T ConsumeIntegralInRange(T min, T max)
SipHash-1-3-UJ based hasher for the coins cache and related coins containers.
static constexpr script_verify_flags from_int(value_type f)
static transaction_identifier FromUint256(const uint256 &id)
NotNull is intended to be used to denote that a smart pointer type can not hold a nullptr value.
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.
std::pair< const COutPoint, CCoinsCacheEntry > CoinsCachePair
std::unordered_map< COutPoint, CCoinsCacheEntry, SaltedCoinsCacheHasher, 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...
CCoinsMap::allocator_type::ResourceType CCoinsMapMemoryResource
void TestCoinsView(FuzzedDataProvider &fuzzed_data_provider, CCoinsViewCache &coins_view_cache, CCoinsView *backend_coins_view)
void initialize_coins_view()
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
#define LIMITED_WHILE(condition, limit)
Can be used to limit a theoretically unbounded loop.
bool CheckTxInputs(const CTransaction &tx, TxValidationState &state, const CCoinsViewCache &inputs, int nSpendHeight, CAmount &txfee)
Check whether all inputs of this transaction are valid (no double spends and amounts) This does not m...
bool operator==(const CNetAddr &a, const CNetAddr &b)
TxValidationState ValidateInputsStandardness(const CTransaction &tx, const CCoinsViewCache &mapInputs)
Check transaction inputs.
bool IsWitnessStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs)
Check if the transaction is over standard P2WSH resources limit: 3600bytes witnessScript size,...
constexpr TransactionSerParams TX_WITH_WITNESS
static CTransactionRef MakeTransactionRef(Tx &&txIn)
A Coin in one level of the coins database caching hierarchy.
static void SetFresh(CoinsCachePair &pair, CoinsCachePair &sentinel) noexcept
static void SetDirty(CoinsCachePair &pair, CoinsCachePair &sentinel) noexcept
A mutable version of CTransaction.
Txid GetHash() const
Compute the hash of this CMutableTransaction.
Cursor for iterating over the linked list of flagged entries in CCoinsViewCache.
User-controlled performance and debug options.
Application-specific storage settings.
fs::path path
Location in the filesystem where leveldb data will be stored.
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
SeedRandomStateForTest(SeedRand::ZEROS)
bool ContainsSpentInput(const CTransaction &tx, const CCoinsViewCache &inputs) noexcept
uint256 ConsumeUInt256(FuzzedDataProvider &fuzzed_data_provider) noexcept
size_t CallOneOf(FuzzedDataProvider &fuzzed_data_provider, Callables... callables)
@ ZEROS
Seed with a compile time constant of zeros.
bool CheckTransaction(const CTransaction &tx, TxValidationState &state)
int64_t GetTransactionSigOpCost(const CTransaction &tx, const CCoinsViewCache &inputs, script_verify_flags flags)
Compute total signature operation cost of a transaction.
unsigned int GetP2SHSigOpCount(const CTransaction &tx, const CCoinsViewCache &inputs)
Count ECDSA signature operations in pay-to-script-hash inputs.
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
FuzzedDataProvider & fuzzed_data_provider