1
0
Fork 0
forked from lthn/blockchain

Multiple fixes over core tests related to zarcanum/multiassets

This commit is contained in:
cryptozoidberg 2023-05-02 16:16:58 +02:00
parent 62d173424a
commit 17134351bb
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
6 changed files with 19 additions and 7 deletions

View file

@ -6397,7 +6397,7 @@ bool blockchain_storage::prevalidate_block(const block& bl)
//before hard_fork1
if (bl.major_version == BLOCK_MAJOR_VERSION_INITIAL && m_core_runtime_config.is_hardfork_active_for_height(1, block_height))
if (bl.major_version == BLOCK_MAJOR_VERSION_INITIAL && get_block_height(bl) <= m_core_runtime_config.hard_forks.m_height_the_hardfork_n_active_after[1])
return true;
// HF0

View file

@ -472,9 +472,9 @@ namespace currency
tx_generation_context tx_gen_context{};
tx_gen_context.resize(zc_ins_count, destinations.size()); // auxiliary data for each output
uint64_t output_index = 0;
std::set<uint16_t> deriv_cache;
for (auto& d : destinations)
{
std::set<uint16_t> deriv_cache;
finalized_tx result = AUTO_VAL_INIT(result);
uint8_t tx_outs_attr = 0;
r = construct_tx_out(d, txkey.sec, output_index, tx, deriv_cache, account_keys(),

View file

@ -13,8 +13,8 @@ class gen_block_verification_base : public test_chain_unit_base
public:
gen_block_verification_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[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;

View file

@ -15,6 +15,11 @@ gen_chain_switch_pow_pos::gen_chain_switch_pow_pos()
: m_enormous_fee(0)
, m_invalid_block_index(std::numeric_limits<decltype(m_invalid_block_index)>::max())
{
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(gen_chain_switch_pow_pos, configure_core);
REGISTER_CALLBACK_METHOD(gen_chain_switch_pow_pos, check_height1);
REGISTER_CALLBACK_METHOD(gen_chain_switch_pow_pos, check_chains_1);

View file

@ -906,7 +906,7 @@ bool test_generator::construct_block(int64_t manual_timestamp_adjustment,
size_t txs_sizes/* = 0*/)
{
size_t height = get_block_height(prev_block) + 1;
blk.major_version = actual_params & bf_major_ver ? major_ver : BLOCK_MAJOR_VERSION_INITIAL;
blk.major_version = actual_params & bf_major_ver ? major_ver : m_hardforks.get_block_major_version_by_height(height);
blk.minor_version = actual_params & bf_minor_ver ? minor_ver : m_hardforks.get_block_minor_version_by_height(height);
blk.timestamp = actual_params & bf_timestamp ? timestamp : (height > 10 ? prev_block.timestamp + DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN: prev_block.timestamp + DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN-POW_DIFF_UP_TIMESTAMP_DELTA); // Keep difficulty unchanged
blk.prev_id = actual_params & bf_prev_id ? prev_id : get_block_hash(prev_block);

View file

@ -47,7 +47,9 @@ bool mine_next_pos_block_in_playtime_sign_cb(currency::core& c, const currency::
pb.step1_init_header(bcs.get_core_runtime_config().hard_forks, height, prev_id);
pb.step2_set_txs(std::vector<transaction>());
pb.step3_build_stake_kernel(stake_output_amount, stake_output_gidx, stake_output_key_image, difficulty, prev_id, null_hash, prev_block.timestamp);
pb.step4_generate_coinbase_tx(block_size_median, bei.already_generated_coins, acc.get_public_address());
keypair tx_onetime_kp;
tx_onetime_kp = keypair::generate();
pb.step4_generate_coinbase_tx(block_size_median, bei.already_generated_coins, acc.get_public_address(), currency::blobdata(), CURRENCY_MINER_TX_MAX_OUTS, &tx_onetime_kp);
if (!before_sign_cb(pb.m_block))
return false;
@ -667,6 +669,11 @@ bool gen_checkpoints_pos_validation_on_altchain::init_runtime_config(currency::c
gen_no_attchments_in_coinbase::gen_no_attchments_in_coinbase()
{
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;
generator.set_hardforks(m_hardforks);
// 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)
@ -701,7 +708,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, "ac57db2582acdd076f92aa8dfcb88d216f60e35b805c16b6256ca26e023bfc3c");
m_checkpoints.add_checkpoint(12, "2a6e13df811eccce121c0de4dbdcc640de1d37c8459c2c8ea02af39717779836");
c.set_checkpoints(currency::checkpoints(m_checkpoints));
return true;