Skip to content

Commit

Permalink
Update the test "block_reward_in_alt_chain_basic" comments
Browse files Browse the repository at this point in the history
  • Loading branch information
stepan-dolgorukov committed Jan 20, 2025
1 parent 20550f5 commit 2862701
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions tests/core_tests/block_validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,9 @@ bool block_reward_in_alt_chain_basic::generate(std::vector<test_event_entry>& ev
(blk_0) */

m_accounts.push_back(miner);
// Make sure a reward for the blk_0 equals to PREMINE_AMOUNT.
assert_reward(argument);
// Make sure the balance equals to the PREMINE_AMOUNT.
assert_balance(argument);
DO_CALLBACK(events, "configure_core");

Expand All @@ -1022,8 +1024,10 @@ bool block_reward_in_alt_chain_basic::generate(std::vector<test_event_entry>& ev
/* 0 10
(blk_0) - ... - (blk_0r) */

argument_alt = argument = {this, blk_0r, std::list<uint64_t>(CURRENCY_MINED_MONEY_UNLOCK_WINDOW), argument};
argument_alt = argument = argument_assert{this, blk_0r, std::list<uint64_t>(CURRENCY_MINED_MONEY_UNLOCK_WINDOW), argument};
// Miner inserted 10 empty blocks. A sum of the rewards for them equals to 10 coins.
assert_reward(argument);
// Make sure the balance equals to PREMINE_AMOUNT + 10 * COIN.
assert_balance(argument);

MAKE_TX_FEE(events, tx_0, miner, miner, MK_TEST_COINS(1), TESTS_DEFAULT_FEE, blk_0r);
Expand All @@ -1045,22 +1049,26 @@ bool block_reward_in_alt_chain_basic::generate(std::vector<test_event_entry>& ev
{tx_0}
height(blk_1a) = height(blk_1)
fee(tx_1) > fee(tx_0) */
fee(tx_1) > fee(tx_0). */

CHECK_AND_ASSERT_EQ(get_block_height(blk_1), get_block_height(blk_1a));

argument_alt = {this, blk_1a, {33 * TESTS_DEFAULT_FEE}, argument_alt};
argument = {this, blk_1, {TESTS_DEFAULT_FEE}, argument};
argument_alt = argument_assert{this, blk_1a, {33 * TESTS_DEFAULT_FEE}, argument_alt};
argument = argument_assert{this, blk_1, {TESTS_DEFAULT_FEE}, argument};

if (m_hardforks.is_hardfork_active_for_height(ZANO_HARDFORK_04_ZARCANUM, get_block_height(blk_1)))
{
// Make sure that a reward for blk_1 equals to COIN.
assert_reward(argument_alt);
// Make sure that the balance equals to PREMINE_AMOUNT + 11 * COIN - 33 * TESTS_DEFAULT_FEE.
assert_balance(argument_alt);
}

else
{
// Make sure that a reward for blk_1a equals to COIN.
assert_reward(argument);
// Make sure that the balance equals to PREMINE_AMOUNT + 11 * COIN.
assert_balance(argument);
}

Expand All @@ -1080,7 +1088,7 @@ bool block_reward_in_alt_chain_basic::generate(std::vector<test_event_entry>& ev
height(blk_2) > height(blk_1a). */

argument = {this, blk_2, {(8 + 57) * TESTS_DEFAULT_FEE}, argument};
argument = argument_assert{this, blk_2, {(8 + 57) * TESTS_DEFAULT_FEE}, argument};
assert_reward(argument);
assert_balance(argument);

Expand All @@ -1104,18 +1112,22 @@ bool block_reward_in_alt_chain_basic::generate(std::vector<test_event_entry>& ev
height(blk_2a) = height(blk_2) = 12
fee(tx_2) + fee(tx_3) = (8 + 57) * TESTS_DEFAULT_FEE = 65 * TESTS_DEFAULT_FEE
fee(tx_4) + fee(tx_5) + fee(tx_6) = (15 + 29 + 22) * TESTS_DEFAULT_FEE = 66 * TESTS_DEFAULT_FEE
66 > 65 */
66 > 65. */

if (m_hardforks.is_hardfork_active_for_height(ZANO_HARDFORK_04_ZARCANUM, get_block_height(blk_2)))
{
argument_alt = {this, blk_2a, {(15 + 29 + 22) * TESTS_DEFAULT_FEE}, argument_alt};
argument_alt = argument_assert{this, blk_2a, {(15 + 29 + 22) * TESTS_DEFAULT_FEE}, argument_alt};
// Make sure a reward for blk_2a is equals to COIN.
assert_reward(argument_alt);
// Make sure the balance equals to PREMINE_AMOUNT + 12 * COIN - 99 * TESTS_DEFAULT_FEE.
assert_balance(argument_alt);
}

else
{
// Make sure a reward for blk_2 is equals to COIN.
assert_reward(argument);
// Make sure the balance equals to PREMINE_AMOUNT + 12 * COIN.
assert_balance(argument);
}

Expand Down

0 comments on commit 2862701

Please sign in to comment.