1
0
Fork 0
forked from lthn/blockchain

fixed hard_fork_1_pos_and_locked_coins test

This commit is contained in:
cryptozoidberg 2023-05-03 22:16:40 +02:00
parent 32fca807c3
commit fd50b3ad8d
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
5 changed files with 15 additions and 4 deletions

View file

@ -52,6 +52,10 @@ struct gen_block_accepted_base : public test_chain_unit_base
{
gen_block_accepted_base()
{
m_hardforks.m_height_the_hardfork_n_active_after[1] = 1440;
m_hardforks.m_height_the_hardfork_n_active_after[2] = 1800;
m_hardforks.m_height_the_hardfork_n_active_after[3] = 1801;
m_hardforks.m_height_the_hardfork_n_active_after[4] = 50000000000;
REGISTER_CALLBACK("check_block_accepted", gen_block_accepted_base::check_block_accepted);
}

View file

@ -1069,8 +1069,6 @@ int main(int argc, char* argv[])
GENERATE_AND_PLAY(hard_fork_1_checkpoint_basic_test);
GENERATE_AND_PLAY(hard_fork_1_pos_locked_height_vs_time);
GENERATE_AND_PLAY(hard_fork_1_pos_and_locked_coins);
// Hardfork 2 tests
GENERATE_AND_PLAY(hard_fork_2_tx_payer_in_wallet);

View file

@ -27,6 +27,10 @@ void remove_unlock_v2_entries_from_extra(extra_t& extra)
hard_fork_1_base_test::hard_fork_1_base_test(size_t hardfork_height)
: m_hardfork_height(hardfork_height)
{
m_hardforks.m_height_the_hardfork_n_active_after[1] = 1440;
m_hardforks.m_height_the_hardfork_n_active_after[2] = 1800;
m_hardforks.m_height_the_hardfork_n_active_after[3] = 1801;
m_hardforks.m_height_the_hardfork_n_active_after[4] = 50000000000;
REGISTER_CALLBACK_METHOD(hard_fork_1_base_test, configure_core);
}
@ -475,11 +479,12 @@ hard_fork_1_pos_and_locked_coins::hard_fork_1_pos_and_locked_coins()
bool hard_fork_1_pos_and_locked_coins::generate(std::vector<test_event_entry>& events) const
{
random_state_test_restorer::reset_random();
bool r = false;
GENERATE_ACCOUNT(miner_acc);
GENERATE_ACCOUNT(alice_acc);
GENERATE_ACCOUNT(bob_acc);
MAKE_GENESIS_BLOCK(events, blk_0, miner_acc, test_core_time::get_time());
MAKE_GENESIS_BLOCK(events, blk_0, miner_acc, starter_timestamp);
generator.set_hardfork_height(1, m_hardfork_height);
DO_CALLBACK(events, "configure_core");
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 3);

View file

@ -45,6 +45,7 @@ struct hard_fork_1_pos_and_locked_coins : public hard_fork_1_base_test
bool generate(std::vector<test_event_entry>& events) const;
bool check_outputs_with_unique_amount(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
uint64_t starter_timestamp = 1564434640;
};
struct hard_fork_1_pos_locked_height_vs_time : public hard_fork_1_base_test

View file

@ -1632,7 +1632,10 @@ multisig_and_checkpoints::multisig_and_checkpoints()
{
// NOTE: This test is made deterministic to be able to correctly set up checkpoint.
random_state_test_restorer::reset_random(); // random generator's state was previously stored, will be restore on dtor (see also m_random_state_test_restorer)
m_hardforks.m_height_the_hardfork_n_active_after[1] = 1440;
m_hardforks.m_height_the_hardfork_n_active_after[2] = 1800;
m_hardforks.m_height_the_hardfork_n_active_after[3] = 1801;
m_hardforks.m_height_the_hardfork_n_active_after[4] = 50000000000;
REGISTER_CALLBACK_METHOD(multisig_and_checkpoints, set_cp);
}