MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / TestBlockSubsidyHalvings

Function TestBlockSubsidyHalvings

src/test/main_tests.cpp:16–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14BOOST_FIXTURE_TEST_SUITE(main_tests, TestingSetup)
15
16static void TestBlockSubsidyHalvings(const Consensus::Params& consensusParams)
17{
18 int maxHalvings = 64;
19 CAmount nInitialSubsidy = 50 * COIN;
20
21 CAmount nPreviousSubsidy = nInitialSubsidy * 2; // for height == 0
22 BOOST_CHECK_EQUAL(nPreviousSubsidy, nInitialSubsidy * 2);
23 for (int nHalvings = 0; nHalvings < maxHalvings; nHalvings++) {
24 int nHeight = nHalvings * consensusParams.nSubsidyHalvingInterval;
25 CAmount nSubsidy = GetBlockSubsidy(nHeight, consensusParams);
26 BOOST_CHECK(nSubsidy <= nInitialSubsidy);
27 BOOST_CHECK_EQUAL(nSubsidy, nPreviousSubsidy / 2);
28 nPreviousSubsidy = nSubsidy;
29 }
30 BOOST_CHECK_EQUAL(GetBlockSubsidy(maxHalvings * consensusParams.nSubsidyHalvingInterval, consensusParams), 0);
31}
32
33static void TestBlockSubsidyHalvings(int nSubsidyHalvingInterval)
34{

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 1

GetBlockSubsidyFunction · 0.85

Tested by

no test coverage detected