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