forked from lthn/blockchain
coretests: adapted few more tests to new testing environment
This commit is contained in:
parent
24851d10c6
commit
00c4ac3314
4 changed files with 24 additions and 32 deletions
|
|
@ -1028,7 +1028,7 @@ int main(int argc, char* argv[])
|
|||
GENERATE_AND_PLAY(gen_checkpoints_pos_validation_on_altchain);
|
||||
GENERATE_AND_PLAY(gen_checkpoints_and_invalid_tx_to_pool);
|
||||
GENERATE_AND_PLAY(gen_checkpoints_set_after_switching_to_altchain);
|
||||
GENERATE_AND_PLAY_HF(gen_no_attchments_in_coinbase, "0");
|
||||
GENERATE_AND_PLAY_HF(gen_no_attchments_in_coinbase, "3");
|
||||
GENERATE_AND_PLAY(gen_no_attchments_in_coinbase_gentime);
|
||||
|
||||
GENERATE_AND_PLAY(gen_alias_tests);
|
||||
|
|
@ -1053,7 +1053,7 @@ int main(int argc, char* argv[])
|
|||
GENERATE_AND_PLAY(gen_wallet_refreshing_on_chain_switch_2);
|
||||
GENERATE_AND_PLAY(gen_wallet_unconfirmed_tx_from_tx_pool);
|
||||
GENERATE_AND_PLAY_HF(gen_wallet_save_load_and_balance, "*");
|
||||
GENERATE_AND_PLAY(gen_wallet_mine_pos_block);
|
||||
GENERATE_AND_PLAY_HF(gen_wallet_mine_pos_block, "3");
|
||||
GENERATE_AND_PLAY(gen_wallet_unconfirmed_outdated_tx);
|
||||
GENERATE_AND_PLAY(gen_wallet_unlock_by_block_and_by_time);
|
||||
GENERATE_AND_PLAY(gen_wallet_payment_id);
|
||||
|
|
@ -1076,7 +1076,7 @@ int main(int argc, char* argv[])
|
|||
GENERATE_AND_PLAY(wallet_outputs_with_same_key_image);
|
||||
GENERATE_AND_PLAY(wallet_unconfirmed_tx_expiration);
|
||||
GENERATE_AND_PLAY(wallet_unconfimed_tx_balance);
|
||||
GENERATE_AND_PLAY(packing_outputs_on_pos_minting_wallet);
|
||||
GENERATE_AND_PLAY_HF(packing_outputs_on_pos_minting_wallet, "3");
|
||||
GENERATE_AND_PLAY(wallet_watch_only_and_chain_switch);
|
||||
|
||||
GENERATE_AND_PLAY(wallet_rpc_integrated_address);
|
||||
|
|
|
|||
|
|
@ -704,7 +704,7 @@ bool gen_no_attchments_in_coinbase::init_config_set_cp(currency::core& c, size_t
|
|||
crc.pos_minimum_heigh = 1;
|
||||
c.get_blockchain_storage().set_core_runtime_config(crc);
|
||||
|
||||
m_checkpoints.add_checkpoint(12, "2a6e13df811eccce121c0de4dbdcc640de1d37c8459c2c8ea02af39717779836");
|
||||
m_checkpoints.add_checkpoint(12, "475331fb4a325e722ddbc2d087d32687a58392e5a9314001120de0f2ce7737f2");
|
||||
c.set_checkpoints(currency::checkpoints(m_checkpoints));
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -587,7 +587,6 @@ bool gen_wallet_save_load_and_balance::c3_load_refresh_check_balance(currency::c
|
|||
gen_wallet_mine_pos_block::gen_wallet_mine_pos_block()
|
||||
{
|
||||
REGISTER_CALLBACK_METHOD(gen_wallet_mine_pos_block, c1);
|
||||
REGISTER_CALLBACK_METHOD(gen_wallet_mine_pos_block, set_core_config);
|
||||
}
|
||||
|
||||
bool gen_wallet_mine_pos_block::generate(std::vector<test_event_entry>& events) const
|
||||
|
|
@ -607,7 +606,7 @@ bool gen_wallet_mine_pos_block::generate(std::vector<test_event_entry>& events)
|
|||
generator.construct_genesis_block(blk_0, miner_acc, test_core_time::get_time());
|
||||
events.push_back(blk_0);
|
||||
|
||||
DO_CALLBACK(events, "set_core_config");
|
||||
DO_CALLBACK(events, "configure_core");
|
||||
|
||||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
|
|
@ -620,15 +619,6 @@ bool gen_wallet_mine_pos_block::generate(std::vector<test_event_entry>& events)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool gen_wallet_mine_pos_block::set_core_config(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
|
||||
{
|
||||
core_runtime_config crc = c.get_blockchain_storage().get_core_runtime_config();
|
||||
crc.pos_minimum_heigh = TESTS_POS_CONFIG_POS_MINIMUM_HEIGH;
|
||||
crc.min_coinstake_age = TESTS_POS_CONFIG_MIN_COINSTAKE_AGE;
|
||||
c.get_blockchain_storage().set_core_runtime_config(crc);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool gen_wallet_mine_pos_block::c1(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
|
||||
{
|
||||
std::shared_ptr<tools::wallet2> alice_wlt = init_playtime_test_wallet(events, c, ALICE_ACC_IDX);
|
||||
|
|
@ -650,7 +640,7 @@ bool gen_wallet_mine_pos_block::c1(currency::core& c, size_t ev_index, const std
|
|||
bool r = c.get_blockchain_storage().get_top_block(top_block);
|
||||
CHECK_AND_ASSERT_MES(r && is_pos_block(top_block), false, "get_top_block failed or smth goes wrong");
|
||||
uint64_t top_block_reward = get_outs_money_amount(top_block.miner_tx);
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", uint64_max, MK_TEST_COINS(2000) + top_block_reward, 0, 0, 0), false, "");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", top_block_reward, top_block_reward - MK_TEST_COINS(2000), 0, 0, 0), false, "");
|
||||
|
||||
alice_wlt->reset_password(g_wallet_password);
|
||||
alice_wlt->store(g_wallet_filename);
|
||||
|
|
@ -3361,8 +3351,8 @@ bool wallet_unconfimed_tx_balance::c1(currency::core& c, size_t ev_index, const
|
|||
packing_outputs_on_pos_minting_wallet::packing_outputs_on_pos_minting_wallet()
|
||||
{
|
||||
REGISTER_CALLBACK_METHOD(packing_outputs_on_pos_minting_wallet, c1);
|
||||
REGISTER_CALLBACK_METHOD(packing_outputs_on_pos_minting_wallet, set_core_config);
|
||||
}
|
||||
|
||||
bool packing_outputs_on_pos_minting_wallet::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
|
||||
|
|
@ -3380,9 +3370,19 @@ bool packing_outputs_on_pos_minting_wallet::generate(std::vector<test_event_entr
|
|||
generator.construct_genesis_block(blk_0, miner_acc, test_core_time::get_time());
|
||||
events.push_back(blk_0);
|
||||
|
||||
DO_CALLBACK(events, "set_core_config");
|
||||
DO_CALLBACK(events, "configure_core");
|
||||
|
||||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW+5);
|
||||
CREATE_TEST_WALLET(miner_wlt, miner_acc, blk_0);
|
||||
REFRESH_TEST_WALLET_AT_GEN_TIME(events, miner_wlt, blk_0, 0);
|
||||
uint64_t unlocked, awaiting_in, awaiting_out, mined;
|
||||
m_premine_amount = miner_wlt->balance(unlocked, awaiting_in, awaiting_out, mined);
|
||||
|
||||
size_t n_blocks = CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 5;
|
||||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, n_blocks);
|
||||
m_mined_amount = n_blocks * COIN;
|
||||
|
||||
REFRESH_TEST_WALLET_AT_GEN_TIME(events, miner_wlt, blk_0r, n_blocks);
|
||||
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME(miner_wlt, m_premine_amount + m_mined_amount);
|
||||
|
||||
//MAKE_TX_FEE(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(2000), TESTS_DEFAULT_FEE, blk_0r);
|
||||
//MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_0);
|
||||
|
|
@ -3393,15 +3393,6 @@ bool packing_outputs_on_pos_minting_wallet::generate(std::vector<test_event_entr
|
|||
return true;
|
||||
}
|
||||
|
||||
bool packing_outputs_on_pos_minting_wallet::set_core_config(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
|
||||
{
|
||||
core_runtime_config crc = c.get_blockchain_storage().get_core_runtime_config();
|
||||
crc.pos_minimum_heigh = TESTS_POS_CONFIG_POS_MINIMUM_HEIGH;
|
||||
crc.min_coinstake_age = TESTS_POS_CONFIG_MIN_COINSTAKE_AGE;
|
||||
c.get_blockchain_storage().set_core_runtime_config(crc);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool packing_outputs_on_pos_minting_wallet::c1(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
|
||||
{
|
||||
std::shared_ptr<tools::wallet2> miner_wlt = init_playtime_test_wallet(events, c, MINER_ACC_IDX);
|
||||
|
|
@ -3412,7 +3403,7 @@ bool packing_outputs_on_pos_minting_wallet::c1(currency::core& c, size_t ev_inde
|
|||
CHECK_AND_ASSERT_MES(blocks_fetched == CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 5, false, "Incorrect numbers of blocks fetched");
|
||||
|
||||
miner_wlt->set_pos_mint_packing_size(4);
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*miner_wlt.get(), "miner_wlt", MK_TEST_COINS(2000), 0, MK_TEST_COINS(2000), 0, 0), false, "");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*miner_wlt.get(), "miner_wlt", m_premine_amount + m_mined_amount, uint64_max, uint64_max, 0, 0), false, "");
|
||||
|
||||
miner_wlt->try_mint_pos();
|
||||
|
||||
|
|
@ -3424,7 +3415,7 @@ bool packing_outputs_on_pos_minting_wallet::c1(currency::core& c, size_t ev_inde
|
|||
bool r = c.get_blockchain_storage().get_top_block(top_block);
|
||||
CHECK_AND_ASSERT_MES(r && is_pos_block(top_block), false, "get_top_block failed or smth goes wrong");
|
||||
uint64_t top_block_reward = get_outs_money_amount(top_block.miner_tx);
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*miner_wlt.get(), "miner_wlt", uint64_max, MK_TEST_COINS(2000) + top_block_reward, 0, 0, 0), false, "");
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*miner_wlt.get(), "miner_wlt", m_premine_amount + m_mined_amount + COIN), false, "");
|
||||
|
||||
miner_wlt->reset_password(g_wallet_password);
|
||||
miner_wlt->store(g_wallet_filename);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ struct gen_wallet_mine_pos_block : public wallet_test
|
|||
gen_wallet_mine_pos_block();
|
||||
|
||||
bool generate(std::vector<test_event_entry>& events) const;
|
||||
bool set_core_config(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
|
||||
|
||||
bool c1(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
|
||||
bool c2(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
|
||||
|
|
@ -256,8 +255,10 @@ struct packing_outputs_on_pos_minting_wallet : public wallet_test
|
|||
{
|
||||
packing_outputs_on_pos_minting_wallet();
|
||||
bool generate(std::vector<test_event_entry>& events) const;
|
||||
bool set_core_config(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
|
||||
bool c1(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
|
||||
|
||||
mutable uint64_t m_premine_amount = 0;
|
||||
mutable uint64_t m_mined_amount = 0;
|
||||
};
|
||||
|
||||
struct wallet_sending_to_integrated_address : public wallet_test
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue