1
0
Fork 0
forked from lthn/blockchain

whitespace fix

This commit is contained in:
sowle 2020-04-27 18:29:55 +03:00
parent 158aea723c
commit e30214d722
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC

View file

@ -1,72 +1,73 @@
// Copyright (c) 2020 Zano Project
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "chaingen.h"
#include "hard_fork_2.h"
//#include "pos_block_builder.h"
//#include "tx_builder.h"
//#include "random_helper.h"
using namespace currency;
//------------------------------------------------------------------------------
hard_fork_2_base_test::hard_fork_2_base_test(size_t hardfork_height)
: m_hardfork_height(hardfork_height)
{
REGISTER_CALLBACK_METHOD(hard_fork_2_base_test, configure_core);
}
bool hard_fork_2_base_test::configure_core(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
{
currency::core_runtime_config pc = c.get_blockchain_storage().get_core_runtime_config();
pc.min_coinstake_age = TESTS_POS_CONFIG_MIN_COINSTAKE_AGE;
pc.pos_minimum_heigh = TESTS_POS_CONFIG_POS_MINIMUM_HEIGH;
pc.hard_fork_01_starts_after_height = m_hardfork_height;
pc.hard_fork_02_starts_after_height = m_hardfork_height;
c.get_blockchain_storage().set_core_runtime_config(pc);
return true;
}
//------------------------------------------------------------------------------
hard_fork_2_tx_payer_in_wallet::hard_fork_2_tx_payer_in_wallet()
: hard_fork_2_base_test(16)
{
REGISTER_CALLBACK_METHOD(hard_fork_2_tx_payer_in_wallet, c1); }
bool hard_fork_2_tx_payer_in_wallet::generate(std::vector<test_event_entry>& events) const
{
// Test idea: make sure that wallet uses tx_payer_old only before HF2 and tx_payer after
m_accounts.resize(TOTAL_ACCS_COUNT);
account_base& miner_acc = m_accounts[MINER_ACC_IDX]; miner_acc.generate();
account_base& alice_acc = m_accounts[ALICE_ACC_IDX]; alice_acc.generate();
MAKE_GENESIS_BLOCK(events, blk_0, miner_acc, test_core_time::get_time());
REWIND_BLOCKS_N(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 3);
DO_CALLBACK(events, "c1");
// REWIND_BLOCKS_N(events, blk_1r, blk_1, miner_acc, WALLET_DEFAULT_TX_SPENDABLE_AGE);
return true;
}
bool hard_fork_2_tx_payer_in_wallet::c1(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
{
bool r = false, stub_bool = false;
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool: " << c.get_pool_transactions_count());
std::shared_ptr<tools::wallet2> miner_wlt = init_playtime_test_wallet(events, c, m_accounts[MINER_ACC_IDX]);
CHECK_AND_ASSERT_MES(refresh_wallet_and_check_balance("", "Miner", miner_wlt, COIN * (CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 3), true), false, "");
/*r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
CHECK_AND_ASSERT_MES(r, false, "mine_next_pow_block_in_playtime failed");
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool: " << c.get_pool_transactions_count());
*/
return true;
}
// Copyright (c) 2020 Zano Project
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "chaingen.h"
#include "hard_fork_2.h"
//#include "pos_block_builder.h"
//#include "tx_builder.h"
//#include "random_helper.h"
using namespace currency;
//------------------------------------------------------------------------------
hard_fork_2_base_test::hard_fork_2_base_test(size_t hardfork_height)
: m_hardfork_height(hardfork_height)
{
REGISTER_CALLBACK_METHOD(hard_fork_2_base_test, configure_core);
}
bool hard_fork_2_base_test::configure_core(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
{
currency::core_runtime_config pc = c.get_blockchain_storage().get_core_runtime_config();
pc.min_coinstake_age = TESTS_POS_CONFIG_MIN_COINSTAKE_AGE;
pc.pos_minimum_heigh = TESTS_POS_CONFIG_POS_MINIMUM_HEIGH;
pc.hard_fork_01_starts_after_height = m_hardfork_height;
pc.hard_fork_02_starts_after_height = m_hardfork_height;
c.get_blockchain_storage().set_core_runtime_config(pc);
return true;
}
//------------------------------------------------------------------------------
hard_fork_2_tx_payer_in_wallet::hard_fork_2_tx_payer_in_wallet()
: hard_fork_2_base_test(16)
{
REGISTER_CALLBACK_METHOD(hard_fork_2_tx_payer_in_wallet, c1);
}
bool hard_fork_2_tx_payer_in_wallet::generate(std::vector<test_event_entry>& events) const
{
// Test idea: make sure that wallet uses tx_payer_old only before HF2 and tx_payer after
m_accounts.resize(TOTAL_ACCS_COUNT);
account_base& miner_acc = m_accounts[MINER_ACC_IDX]; miner_acc.generate();
account_base& alice_acc = m_accounts[ALICE_ACC_IDX]; alice_acc.generate();
MAKE_GENESIS_BLOCK(events, blk_0, miner_acc, test_core_time::get_time());
REWIND_BLOCKS_N(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 3);
DO_CALLBACK(events, "c1");
// REWIND_BLOCKS_N(events, blk_1r, blk_1, miner_acc, WALLET_DEFAULT_TX_SPENDABLE_AGE);
return true;
}
bool hard_fork_2_tx_payer_in_wallet::c1(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
{
bool r = false, stub_bool = false;
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool: " << c.get_pool_transactions_count());
std::shared_ptr<tools::wallet2> miner_wlt = init_playtime_test_wallet(events, c, m_accounts[MINER_ACC_IDX]);
CHECK_AND_ASSERT_MES(refresh_wallet_and_check_balance("", "Miner", miner_wlt, COIN * (CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 3), true), false, "");
/*r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
CHECK_AND_ASSERT_MES(r, false, "mine_next_pow_block_in_playtime failed");
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool: " << c.get_pool_transactions_count());
*/
return true;
}