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