mirror of
https://github.com/monero-project/monero.git
synced 2024-12-15 04:46:31 +02:00
tests: fix various tests by using parameters better suited to monero
Either smaller coin values (as monero has smaller block rewards), or pre-hard fork values (full reward zone), or post-Bytecoin values (emission speed).
This commit is contained in:
parent
d0a8362b6b
commit
79beed221d
@ -80,7 +80,7 @@ namespace
|
|||||||
generator.get_last_n_block_sizes(block_sizes, get_block_hash(blk_prev), median_block_count);
|
generator.get_last_n_block_sizes(block_sizes, get_block_hash(blk_prev), median_block_count);
|
||||||
|
|
||||||
size_t median = misc_utils::median(block_sizes);
|
size_t median = misc_utils::median(block_sizes);
|
||||||
median = std::max(median, static_cast<size_t>(CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE));
|
median = std::max(median, static_cast<size_t>(CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1));
|
||||||
|
|
||||||
transaction miner_tx;
|
transaction miner_tx;
|
||||||
bool r = construct_miner_tx_by_size(miner_tx, get_block_height(blk_prev) + 1, generator.get_already_generated_coins(blk_prev),
|
bool r = construct_miner_tx_by_size(miner_tx, get_block_height(blk_prev) + 1, generator.get_already_generated_coins(blk_prev),
|
||||||
@ -249,11 +249,11 @@ bool gen_block_reward::check_block_rewards(cryptonote::core& /*c*/, size_t /*ev_
|
|||||||
DEFINE_TESTS_ERROR_CONTEXT("gen_block_reward_without_txs::check_block_rewards");
|
DEFINE_TESTS_ERROR_CONTEXT("gen_block_reward_without_txs::check_block_rewards");
|
||||||
|
|
||||||
std::array<uint64_t, 7> blk_rewards;
|
std::array<uint64_t, 7> blk_rewards;
|
||||||
blk_rewards[0] = MONEY_SUPPLY >> 18;
|
blk_rewards[0] = MONEY_SUPPLY >> EMISSION_SPEED_FACTOR_PER_MINUTE;
|
||||||
uint64_t cumulative_reward = blk_rewards[0];
|
uint64_t cumulative_reward = blk_rewards[0];
|
||||||
for (size_t i = 1; i < blk_rewards.size(); ++i)
|
for (size_t i = 1; i < blk_rewards.size(); ++i)
|
||||||
{
|
{
|
||||||
blk_rewards[i] = (MONEY_SUPPLY - cumulative_reward) >> 18;
|
blk_rewards[i] = (MONEY_SUPPLY - cumulative_reward) >> EMISSION_SPEED_FACTOR_PER_MINUTE;
|
||||||
cumulative_reward += blk_rewards[i];
|
cumulative_reward += blk_rewards[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -578,7 +578,7 @@ bool gen_block_invalid_binary_format::generate(std::vector<test_event_entry>& ev
|
|||||||
while (diffic < 1500);
|
while (diffic < 1500);
|
||||||
|
|
||||||
blk_last = boost::get<block>(events.back());
|
blk_last = boost::get<block>(events.back());
|
||||||
MAKE_TX(events, tx_0, miner_account, miner_account, MK_COINS(120), boost::get<block>(events[1]));
|
MAKE_TX(events, tx_0, miner_account, miner_account, MK_COINS(30), boost::get<block>(events[1]));
|
||||||
DO_CALLBACK(events, "corrupt_blocks_boundary");
|
DO_CALLBACK(events, "corrupt_blocks_boundary");
|
||||||
|
|
||||||
block blk_test;
|
block blk_test;
|
||||||
|
@ -397,17 +397,17 @@ bool gen_tx_key_offest_points_to_foreign_key::generate(std::vector<test_event_en
|
|||||||
REWIND_BLOCKS(events, blk_1r, blk_1, miner_account);
|
REWIND_BLOCKS(events, blk_1r, blk_1, miner_account);
|
||||||
MAKE_ACCOUNT(events, alice_account);
|
MAKE_ACCOUNT(events, alice_account);
|
||||||
MAKE_ACCOUNT(events, bob_account);
|
MAKE_ACCOUNT(events, bob_account);
|
||||||
MAKE_TX_LIST_START(events, txs_0, miner_account, bob_account, MK_COINS(60) + 1, blk_1);
|
MAKE_TX_LIST_START(events, txs_0, miner_account, bob_account, MK_COINS(15) + 1, blk_1);
|
||||||
MAKE_TX_LIST(events, txs_0, miner_account, alice_account, MK_COINS(60) + 1, blk_1);
|
MAKE_TX_LIST(events, txs_0, miner_account, alice_account, MK_COINS(15) + 1, blk_1);
|
||||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_2, blk_1r, miner_account, txs_0);
|
MAKE_NEXT_BLOCK_TX_LIST(events, blk_2, blk_1r, miner_account, txs_0);
|
||||||
|
|
||||||
std::vector<tx_source_entry> sources_bob;
|
std::vector<tx_source_entry> sources_bob;
|
||||||
std::vector<tx_destination_entry> destinations_bob;
|
std::vector<tx_destination_entry> destinations_bob;
|
||||||
fill_tx_sources_and_destinations(events, blk_2, bob_account, miner_account, MK_COINS(60) + 1 - TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, 0, sources_bob, destinations_bob);
|
fill_tx_sources_and_destinations(events, blk_2, bob_account, miner_account, MK_COINS(15) + 1 - TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, 0, sources_bob, destinations_bob);
|
||||||
|
|
||||||
std::vector<tx_source_entry> sources_alice;
|
std::vector<tx_source_entry> sources_alice;
|
||||||
std::vector<tx_destination_entry> destinations_alice;
|
std::vector<tx_destination_entry> destinations_alice;
|
||||||
fill_tx_sources_and_destinations(events, blk_2, alice_account, miner_account, MK_COINS(60) + 1 - TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, 0, sources_alice, destinations_alice);
|
fill_tx_sources_and_destinations(events, blk_2, alice_account, miner_account, MK_COINS(15) + 1 - TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, 0, sources_alice, destinations_alice);
|
||||||
|
|
||||||
tx_builder builder;
|
tx_builder builder;
|
||||||
builder.step1_init();
|
builder.step1_init();
|
||||||
|
Loading…
Reference in New Issue
Block a user