14#include <boost/test/unit_test.hpp>
24CBlock CreateBlock() noexcept
26 static constexpr auto NUM_TXS{100};
35 tx.
vin.emplace_back(txid, 0);
48 for (
const auto& in : tx->vin) {
51 cache.EmplaceCoinInternalDANGER(
COutPoint{in.prevout}, std::move(coin));
62 for (
const auto& tx : block.vtx) {
63 if (tx->IsCoinBase()) {
66 for (
const auto& in : tx->vin) {
67 const auto& outpoint{in.prevout};
83 const auto block{CreateBlock()};
88 const auto& outpoint{block.
vtx[1]->vin[0].prevout};
96 for (
const auto& tx : block.
vtx) {
97 for (
const auto& in : tx->
vin) {
110 const auto block{CreateBlock()};
117 const auto& outpoint{block.
vtx[1]->vin[0].prevout};
128 const auto block{CreateBlock()};
135 for (
const auto& tx : block.
vtx) {
136 for (
const auto& in : tx->
vin) {
149 const auto block{CreateBlock()};
153 for (
const auto& tx : block.
vtx) {
154 for (
const auto& in : tx->
vin) {
std::vector< CTransactionRef > vtx
CCoinsView that adds a memory cache for transactions to another CCoinsView.
unsigned int GetCacheSize() const
Size of the cache (in number of transaction outputs)
void SetBestBlock(const uint256 &hashBlock)
bool HaveCoinInCache(const COutPoint &outpoint) const
Check if we have the given utxo already loaded in this cache.
const Coin & AccessCoin(const COutPoint &output) const
Return a reference to Coin in the cache, or coinEmpty if not found.
CCoinsView backed by the coin database (chainstate/)
Abstract view on the open txout dataset.
An outpoint - a combination of a transaction hash and an index n into its vout.
CTxOut out
unspent transaction output
CCoinsViewCache overlay that avoids populating/mutating parent cache layers on cache misses.
static transaction_identifier FromUint256(const uint256 &id)
BOOST_AUTO_TEST_CASE(fetch_inputs_from_db)
BOOST_AUTO_TEST_SUITE_END()
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
static CTransactionRef MakeTransactionRef(Tx &&txIn)
A mutable version of CTransaction.
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.