Changeset View
Changeset View
Standalone View
Standalone View
src/test/validation_tests.cpp
Show First 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
BOOST_AUTO_TEST_CASE(validation_load_external_block_file) { | BOOST_AUTO_TEST_CASE(validation_load_external_block_file) { | ||||
fs::path tmpfile_name = gArgs.GetDataDirNet() / "block.dat"; | fs::path tmpfile_name = gArgs.GetDataDirNet() / "block.dat"; | ||||
FILE *fp = fopen(fs::PathToString(tmpfile_name).c_str(), "wb+"); | FILE *fp = fopen(fs::PathToString(tmpfile_name).c_str(), "wb+"); | ||||
BOOST_CHECK(fp != nullptr); | BOOST_CHECK(fp != nullptr); | ||||
const Config &config = GetConfig(); | const CChainParams &chainparams = m_node.chainman->GetParams(); | ||||
const CChainParams &chainparams = config.GetChainParams(); | |||||
// serialization format is: | // serialization format is: | ||||
// message start magic, size of block, block | // message start magic, size of block, block | ||||
size_t nwritten = fwrite(std::begin(chainparams.DiskMagic()), | size_t nwritten = fwrite(std::begin(chainparams.DiskMagic()), | ||||
CMessageHeader::MESSAGE_START_SIZE, 1, fp); | CMessageHeader::MESSAGE_START_SIZE, 1, fp); | ||||
BOOST_CHECK_EQUAL(nwritten, 1UL); | BOOST_CHECK_EQUAL(nwritten, 1UL); | ||||
Show All 11 Lines | BOOST_AUTO_TEST_CASE(validation_load_external_block_file) { | ||||
{ | { | ||||
CAutoFile outs(fp, SER_DISK, CLIENT_VERSION); | CAutoFile outs(fp, SER_DISK, CLIENT_VERSION); | ||||
outs << size; | outs << size; | ||||
outs << block; | outs << block; | ||||
outs.release(); | outs.release(); | ||||
} | } | ||||
fseek(fp, 0, SEEK_SET); | fseek(fp, 0, SEEK_SET); | ||||
BOOST_CHECK_NO_THROW({ | BOOST_CHECK_NO_THROW( | ||||
m_node.chainman->ActiveChainstate().LoadExternalBlockFile(config, fp, | { m_node.chainman->ActiveChainstate().LoadExternalBlockFile(fp, 0); }); | ||||
0); | |||||
}); | |||||
} | } | ||||
//! Test retrieval of valid assumeutxo values. | //! Test retrieval of valid assumeutxo values. | ||||
BOOST_AUTO_TEST_CASE(test_assumeutxo) { | BOOST_AUTO_TEST_CASE(test_assumeutxo) { | ||||
const auto params = CreateChainParams(CBaseChainParams::REGTEST); | const auto params = CreateChainParams(CBaseChainParams::REGTEST); | ||||
// These heights don't have assumeutxo configurations associated, per the | // These heights don't have assumeutxo configurations associated, per the | ||||
// contents of chainparams.cpp. | // contents of chainparams.cpp. | ||||
Show All 21 Lines |