Changeset View
Changeset View
Standalone View
Standalone View
src/test/validation_tests.cpp
Show All 22 Lines | static CBlock makeLargeDummyBlock(const size_t num_tx) { | ||||
CTransaction tx; | CTransaction tx; | ||||
for (size_t i = 0; i < num_tx; i++) { | for (size_t i = 0; i < num_tx; i++) { | ||||
block.vtx.push_back(MakeTransactionRef(tx)); | block.vtx.push_back(MakeTransactionRef(tx)); | ||||
} | } | ||||
return block; | return block; | ||||
} | } | ||||
BOOST_FIXTURE_TEST_SUITE(validation_tests, BasicTestingSetup) | BOOST_FIXTURE_TEST_SUITE(validation_tests, TestingSetup) | ||||
/** Test that LoadExternalBlockFile works with the buffer size set | /** Test that LoadExternalBlockFile works with the buffer size set | ||||
below the size of a large block. Currently, LoadExternalBlockFile has the | below the size of a large block. Currently, LoadExternalBlockFile has the | ||||
buffer size for CBufferedFile set to 2 * MAX_TX_SIZE. Test with a value | buffer size for CBufferedFile set to 2 * MAX_TX_SIZE. Test with a value | ||||
of 10 * MAX_TX_SIZE. */ | of 10 * MAX_TX_SIZE. */ | ||||
BOOST_AUTO_TEST_CASE(validation_load_external_block_file) { | BOOST_AUTO_TEST_CASE(validation_load_external_block_file) { | ||||
FILE *fp = tmpfile(); | boost::filesystem::path tmpfile_name = | ||||
pathTemp / strprintf("vlebf_test_%lu_%i", (unsigned long)GetTime(), | |||||
(int)(GetRand(100000))); | |||||
FILE *fp = fopen(tmpfile_name.string().c_str(), "wb+"); | |||||
BOOST_CHECK(fp != nullptr); | |||||
const Config &config = GetConfig(); | const Config &config = GetConfig(); | ||||
const CChainParams &chainparams = config.GetChainParams(); | 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(chainparams.MessageStart(), | size_t nwritten = fwrite(chainparams.MessageStart(), | ||||
Show All 27 Lines |