diff --git a/tests/core_tests/alias_tests.cpp b/tests/core_tests/alias_tests.cpp index 290d5875..b8a1e4fd 100644 --- a/tests/core_tests/alias_tests.cpp +++ b/tests/core_tests/alias_tests.cpp @@ -1068,7 +1068,7 @@ bool gen_alias_too_small_reward::generate(std::vector& events) set_hard_fork_heights_to_generator(generator); DO_CALLBACK(events, "configure_core"); DO_CALLBACK(events, "init_runtime_config"); - REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW); + REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW+20); transaction tx_1 = AUTO_VAL_INIT(tx_1); r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), miner_acc.get_public_address(), 3 * aliases_count * TESTS_DEFAULT_FEE * 100, 3 * aliases_count, TESTS_DEFAULT_FEE, tx_1); @@ -1271,7 +1271,8 @@ bool gen_alias_switch_and_check_block_template::generate(std::vector - 10 + if (m_blockchain.size() < CURRENCY_HF4_MANDATORY_MIN_COINAGE) + return false; + if (height_upper_limit_local > m_blockchain.size() - CURRENCY_HF4_MANDATORY_MIN_COINAGE) + height_upper_limit_local = m_blockchain.size() - CURRENCY_HF4_MANDATORY_MIN_COINAGE; + } rsp.outs.resize(rsp.outs.size() + 1); auto& rsp_entry = rsp.outs.back(); rsp_entry.amount = amount; @@ -463,7 +473,7 @@ bool test_generator::build_wallets(const blockchain_vector& blockchain, for (size_t gindex : random_mapping) { const out_index_info& oii = it->second[gindex]; - if (rqt.height_upper_limit != 0 && oii.block_height > rqt.height_upper_limit) + if (height_upper_limit_local != 0 && oii.block_height > height_upper_limit_local) continue; const transaction& tx = oii.in_block_tx_index == 0 ? m_blockchain[oii.block_height]->b.miner_tx : m_blockchain[oii.block_height]->m_transactions[oii.in_block_tx_index - 1]; auto& out_v = tx.vout[oii.in_tx_out_index]; @@ -1485,6 +1495,11 @@ bool fill_tx_sources(std::vector& sources, const std: if (unlock_time > head_block_ts + DIFFICULTY_TOTAL_TARGET) continue; } + } + if (blk_head.miner_tx.version < TRANSACTION_VERSION_POST_HF4 && next_block_height - get_block_height(*oi.p_blk) < CURRENCY_HF4_MANDATORY_MIN_COINAGE) + { + //ignore outs that doesn't fit the HF4 rule + continue; } diff --git a/tests/core_tests/zarcanum_test.cpp b/tests/core_tests/zarcanum_test.cpp index 40b431c9..6f2ec21d 100644 --- a/tests/core_tests/zarcanum_test.cpp +++ b/tests/core_tests/zarcanum_test.cpp @@ -794,7 +794,7 @@ bool zarcanum_block_with_txs::generate(std::vector& events) co MAKE_NEXT_BLOCK_TX1(events, blk_4, blk_3, miner_acc, tx_2); m_alice_balance += MK_TEST_COINS(200); - REWIND_BLOCKS_N_WITH_TIME(events, blk_4r, blk_4, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW); + REWIND_BLOCKS_N_WITH_TIME(events, blk_4r, blk_4, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW+5); DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, m_alice_balance, m_alice_balance, mined_amount, 0, 0)); // then miner sends few coins to Bob via a tx with a big fee amount