5 #include <chainparams.h> 12 #include <boost/test/unit_test.hpp> 40 int64_t max_time = -1;
44 int64_t mtp_time = -1;
48 bool cur_active{
false}, next_active{
false};
55 cur_active = next_active =
false;
84 BOOST_CHECK(!chain->findAncestorByHeight(active[10]->GetBlockHash(), 20));
95 BOOST_CHECK(!chain->findAncestorByHash(active[10]->GetBlockHash(), active[20]->GetBlockHash()));
102 auto* orig_tip = active.Tip();
103 for (
int i = 0; i < 10; ++i) {
105 m_node.
chainman->ActiveChainstate().InvalidateBlock(state, active.Tip());
108 coinbaseKey.MakeNewKey(
true);
109 for (
int i = 0; i < 20; ++i) {
121 uint256 active_hash, orig_hash;
Helper for findBlock to selectively return pieces of block data.
std::unique_ptr< interfaces::Chain > chain
BOOST_AUTO_TEST_CASE(findBlock)
An in-memory indexed chain of blocks.
int Height() const
Return the maximal height in the chain.
uint256 GetBlockHash() const
FoundBlock & data(CBlock &data)
Read block data from disk.
BOOST_FIXTURE_TEST_SUITE(cuckoocache_tests, BasicTestingSetup)
Test Suite for CuckooCache.
BOOST_AUTO_TEST_SUITE_END()
FoundBlock & maxTime(int64_t &max_time)
int64_t GetBlockTimeMax() const
Testing fixture that pre-creates a 100-block REGTEST-mode block chain.
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
#define BOOST_CHECK_EQUAL(v1, v2)
CBlockIndex * Tip() const
Returns the index entry for the tip of this chain, or nullptr if none.
FoundBlock & hash(uint256 &hash)
CScript GetScriptForRawPubKey(const CPubKey &pubKey)
Generate a P2PK script for the given pubkey.
FoundBlock & inActiveChain(bool &in_active_chain)
Return whether block is in the active (most-work) chain.
FoundBlock & height(int &height)
FoundBlock & mtpTime(int64_t &mtp_time)
full block available in blk*.dat
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate...
FoundBlock & nextBlock(const FoundBlock &next_block)
Return next block in the active chain if current block is in the active chain.
FoundBlock & time(int64_t &time)
std::unique_ptr< ChainstateManager > chainman
#define Assert(val)
Identity function.
#define BOOST_CHECK(expr)