6#include <chainparams.h>
14#include <validation.h>
16#include <boost/test/unit_test.hpp>
36 .blocks_dir = m_args.GetBlocksDirPath(),
37 .notifications = notifications,
39 .
path = m_args.GetDataDirNet() /
"blocks" /
"index",
51 blockman.UpdateBlockInfo(params->GenesisBlock(), 0, pos);
74 LOCK(chainman.GetMutex());
75 file_number =
old_tip->GetBlockPos().nFile;
76 blockman.PruneOneBlockFile(file_number);
108 auto&
blockman = chainman->m_blockman;
160 auto&
blockman{chainman->m_blockman};
168 const auto expect_part{[&](
size_t offset,
size_t size) {
188 auto&
blockman{chainman->m_blockman};
215 expect_part_error(std::numeric_limits<size_t>::max(), std::numeric_limits<size_t>::max());
224 index.nStatus =
tip->nStatus;
225 index.nDataPos =
tip->nDataPos;
239 .blocks_dir = m_args.GetBlocksDirPath(),
240 .notifications = notifications,
242 .
path = m_args.GetDataDirNet() /
"blocks" /
"index",
BOOST_AUTO_TEST_CASE(blockmanager_find_block_pos)
BOOST_FIXTURE_TEST_CASE(blockmanager_scan_unlink_already_pruned_files, TestChain100Setup)
@ BLOCK_HAVE_DATA
full block available in blk*.dat
std::unique_ptr< const CChainParams > CreateChainParams(const ArgsManager &args, const ChainType chain)
Creates and returns a std::unique_ptr<CChainParams> of the chosen chain.
const CChainParams & Params()
Return the currently selected parameters.
#define Assert(val)
Identity function.
The block chain is a tree shaped structure starting with the genesis block at the root,...
CBlockIndex * pprev
pointer to the index of the predecessor of this block
const uint256 * phashBlock
pointer to the hash of the block, if any. Memory is owned by this CBlockIndex
Maintains a tree of blocks (stored in m_block_index) which is consulted to determine where the most-w...
kernel::BlockManagerOpts Options
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
BOOST_FIXTURE_TEST_SUITE(cuckoocache_tests, BasicTestingSetup)
Test Suite for CuckooCache.
BOOST_AUTO_TEST_SUITE_END()
static constexpr uint32_t STORAGE_HEADER_BYTES
Size of header written by WriteBlock before a serialized CBlock (8 bytes)
static const unsigned int MAX_BLOCKFILE_SIZE
The maximum size of a blk?????.dat file (since 0.8)
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
static constexpr TransactionSerParams TX_WITH_WITNESS
uint64_t GetSerializeSize(const T &t)
CScript GetScriptForRawPubKey(const CPubKey &pubKey)
Generate a P2PK script for the given pubkey.
Application-specific storage settings.
fs::path path
Location in the filesystem where leveldb data will be stored.
Testing fixture that pre-creates a 100-block REGTEST-mode block chain.
Testing setup that configures a complete environment.
An options struct for BlockManager, more ergonomically referred to as BlockManager::Options due to th...
const CChainParams & chainparams
std::unique_ptr< ChainstateManager > chainman
std::unique_ptr< node::Warnings > warnings
Manages all the node warnings.
std::function< bool()> shutdown_request
Function to request a shutdown.
util::SignalInterrupt * shutdown_signal
Interrupt object used to track whether node shutdown was requested.
std::atomic< int > exit_status
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
#define ASSERT_DEBUG_LOG(message)
BOOST_CHECK_NE(OneL.ToString(), ArrayToString(ZeroArray, 32))
BOOST_CHECK_EQUAL_COLLECTIONS(R1L.begin(), R1L.end(), R1Array, R1Array+uint256::size())
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.