5 #include <chainparams.h> 14 #include <boost/test/unit_test.hpp> 21 BOOST_REQUIRE(coin_stats_index.Init());
30 BOOST_CHECK(!coin_stats_index.LookUpStats(*block_index));
34 BOOST_CHECK(!coin_stats_index.BlockUntilSyncedToCurrentChain());
36 BOOST_REQUIRE(coin_stats_index.StartBackgroundSync());
46 BOOST_CHECK(coin_stats_index.LookUpStats(*genesis_block_index));
49 BOOST_CHECK(coin_stats_index.LookUpStats(*block_index));
52 std::vector<CMutableTransaction> noTxns;
53 CreateAndProcessBlock(noTxns, script_pub_key);
56 BOOST_CHECK(coin_stats_index.BlockUntilSyncedToCurrentChain());
63 BOOST_CHECK(coin_stats_index.LookUpStats(*new_block_index));
76 coin_stats_index.Stop();
87 BOOST_REQUIRE(index.Init());
88 BOOST_REQUIRE(index.StartBackgroundSync());
90 std::shared_ptr<const CBlock> new_block;
94 const CBlock block = this->CreateBlock({}, script_pub_key, chainstate);
96 new_block = std::make_shared<CBlock>(block);
114 BOOST_REQUIRE(index.Init());
116 BOOST_REQUIRE(index.StartBackgroundSync());
CCoinsViewCache & CoinsTip() EXCLUSIVE_LOCKS_REQUIRED(
util::SignalInterrupt * shutdown
Interrupt object used to track whether node shutdown was requested.
BOOST_FIXTURE_TEST_CASE(coinstatsindex_initial_sync, TestChain100Setup)
std::unique_ptr< ValidationSignals > validation_signals
Issues calls about blocks and transactions.
void IndexWaitSynced(const BaseIndex &index, const util::SignalInterrupt &interrupt)
Block until the index is synced to the current chain.
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system...
Chainstate stores and provides an API to update our local knowledge of the current best chain...
static void BlockConnected(ChainstateRole role, CValidationInterface &obj, const std::shared_ptr< const CBlock > &block, const CBlockIndex *pindex)
bool ActivateBestChain(BlockValidationState &state, std::shared_ptr< const CBlock > pblock=nullptr) LOCKS_EXCLUDED(DisconnectResult DisconnectBlock(const CBlock &block, const CBlockIndex *pindex, CCoinsViewCache &view) EXCLUSIVE_LOCKS_REQUIRED(boo ConnectBlock)(const CBlock &block, BlockValidationState &state, CBlockIndex *pindex, CCoinsViewCache &view, bool fJustCheck=false) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Find the best known block, and make it the tip of the block chain.
BOOST_AUTO_TEST_SUITE_END()
CoinStatsIndex maintains statistics on the UTXO set.
bool CheckBlock(const CBlock &block, BlockValidationState &state, const Consensus::Params &consensusParams, bool fCheckPOW, bool fCheckMerkleRoot)
Functions for validating blocks and updating the block tree.
Testing fixture that pre-creates a 100-block REGTEST-mode block chain.
std::vector< unsigned char > ToByteVector(const T &in)
std::unique_ptr< Chain > MakeChain(node::NodeContext &node)
Return implementation of Chain interface.
The block chain is a tree shaped structure starting with the genesis block at the root...
const CChainParams & Params()
Return the currently selected parameters.
Serialized script, used inside transaction inputs and outputs.
BOOST_AUTO_TEST_SUITE(cuckoocache_tests)
Test Suite for CuckooCache.
const Consensus::Params & GetConsensus() const
CCoinsView that adds a memory cache for transactions to another CCoinsView.
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate...
std::unique_ptr< ChainstateManager > chainman
#define Assert(val)
Identity function.
#define BOOST_CHECK(expr)