Changeset View
Changeset View
Standalone View
Standalone View
src/test/miner_tests.cpp
Show First 20 Lines • Show All 705 Lines • ▼ Show 20 Lines | |||||
BOOST_AUTO_TEST_CASE(BlockAssembler_construction) { | BOOST_AUTO_TEST_CASE(BlockAssembler_construction) { | ||||
GlobalConfig config; | GlobalConfig config; | ||||
const CChainParams &chainparams = Params(); | const CChainParams &chainparams = Params(); | ||||
// We are working on a fake chain and need to protect ourselves. | // We are working on a fake chain and need to protect ourselves. | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
// Activate UAHF the dirty way | |||||
const int64_t uahfHeight = | |||||
config.GetChainParams().GetConsensus().uahfHeight; | |||||
auto pindex = chainActive.Tip(); | |||||
for (size_t i = 0; pindex && i < 5; i++) { | |||||
pindex->nHeight = uahfHeight + 5 - i; | |||||
pindex = pindex->pprev; | |||||
} | |||||
// Test around historical 1MB (plus one byte because that's mandatory) | // Test around historical 1MB (plus one byte because that's mandatory) | ||||
config.SetMaxBlockSize(ONE_MEGABYTE + 1); | config.SetMaxBlockSize(ONE_MEGABYTE + 1); | ||||
CheckBlockMaxSize(chainparams, 0, 1000); | CheckBlockMaxSize(chainparams, 0, 1000); | ||||
CheckBlockMaxSize(chainparams, 1000, 1000); | CheckBlockMaxSize(chainparams, 1000, 1000); | ||||
CheckBlockMaxSize(chainparams, 1001, 1001); | CheckBlockMaxSize(chainparams, 1001, 1001); | ||||
CheckBlockMaxSize(chainparams, 12345, 12345); | CheckBlockMaxSize(chainparams, 12345, 12345); | ||||
CheckBlockMaxSize(chainparams, ONE_MEGABYTE - 1001, ONE_MEGABYTE - 1001); | CheckBlockMaxSize(chainparams, ONE_MEGABYTE - 1001, ONE_MEGABYTE - 1001); | ||||
Show All 37 Lines |