forked from lthn/blockchain
Merge branch 'zarcanum_tx' into zarcanum
This commit is contained in:
commit
d7863b9a91
48 changed files with 475 additions and 345 deletions
|
|
@ -408,7 +408,7 @@ bool generate_genesis(const std::string& path_config, uint64_t premine_split_amo
|
|||
ss.str("");
|
||||
ss.clear();
|
||||
std::cout << ENDL << "PROOF PHRASE: " << gcp.proof_string << ENDL;
|
||||
construct_miner_tx(0, 0, 0, 0, 0, destinations, bl.miner_tx, gcp.proof_string, CURRENCY_MINER_TX_MAX_OUTS);
|
||||
construct_miner_tx(0, 0, 0, 0, 0, destinations, bl.miner_tx, TRANSACTION_VERSION_PRE_HF4, gcp.proof_string, CURRENCY_MINER_TX_MAX_OUTS);
|
||||
currency::blobdata txb = tx_to_blob(bl.miner_tx);
|
||||
|
||||
//self validate block
|
||||
|
|
|
|||
|
|
@ -1147,7 +1147,7 @@ wide_difficulty_type blockchain_storage::get_next_diff_conditional(bool pos) con
|
|||
wide_difficulty_type& dif = pos ? m_cached_next_pos_difficulty : m_cached_next_pow_difficulty;
|
||||
TIME_MEASURE_FINISH_PD(target_calculating_enum_blocks);
|
||||
TIME_MEASURE_START_PD(target_calculating_calc);
|
||||
if (m_db_blocks.size() > m_core_runtime_config.hard_fork_01_starts_after_height)
|
||||
if (m_db_blocks.size() > m_core_runtime_config.hard_forks.hard_fork_01_starts_after_height)
|
||||
{
|
||||
dif = next_difficulty_2(timestamps, commulative_difficulties, pos ? DIFFICULTY_POS_TARGET : DIFFICULTY_POW_TARGET);
|
||||
}
|
||||
|
|
@ -1186,7 +1186,7 @@ wide_difficulty_type blockchain_storage::get_next_diff_conditional2(bool pos, co
|
|||
enum_blockchain(cb, alt_chain, split_height);
|
||||
|
||||
wide_difficulty_type diff = 0;
|
||||
if(abei.height > m_core_runtime_config.hard_fork_01_starts_after_height)
|
||||
if(abei.height > m_core_runtime_config.hard_forks.hard_fork_01_starts_after_height)
|
||||
diff = next_difficulty_2(timestamps, commulative_difficulties, pos ? DIFFICULTY_POS_TARGET : DIFFICULTY_POW_TARGET);
|
||||
else
|
||||
diff = next_difficulty_1(timestamps, commulative_difficulties, pos ? DIFFICULTY_POS_TARGET : DIFFICULTY_POW_TARGET);
|
||||
|
|
@ -1266,7 +1266,7 @@ bool blockchain_storage::prevalidate_miner_transaction(const block& b, uint64_t
|
|||
CHECK_AND_ASSERT_MES(b.miner_tx.vin[1].type() == typeid(txin_to_key), false, "coinstake transaction in the block has the wrong type");
|
||||
}
|
||||
|
||||
if (height > m_core_runtime_config.hard_fork_01_starts_after_height)
|
||||
if (height > m_core_runtime_config.hard_forks.hard_fork_01_starts_after_height)
|
||||
{
|
||||
// new rules that allow different unlock time in coinbase outputs
|
||||
uint64_t max_unlock_time = 0;
|
||||
|
|
@ -1437,9 +1437,9 @@ bool blockchain_storage::create_block_template(const create_block_template_param
|
|||
boost::multiprecision::uint128_t already_generated_coins;
|
||||
CRITICAL_REGION_BEGIN(m_read_lock);
|
||||
height = m_db_blocks.size();
|
||||
if(height <= m_core_runtime_config.hard_fork_01_starts_after_height)
|
||||
if(height <= m_core_runtime_config.hard_forks.hard_fork_01_starts_after_height)
|
||||
b.major_version = BLOCK_MAJOR_VERSION_INITIAL;
|
||||
else if(height <= m_core_runtime_config.hard_fork_03_starts_after_height)
|
||||
else if(height <= m_core_runtime_config.hard_forks.hard_fork_03_starts_after_height)
|
||||
b.major_version = HF1_BLOCK_MAJOR_VERSION;
|
||||
else
|
||||
b.major_version = CURRENT_BLOCK_MAJOR_VERSION;
|
||||
|
|
@ -1487,7 +1487,9 @@ bool blockchain_storage::create_block_template(const create_block_template_param
|
|||
fee,
|
||||
miner_address,
|
||||
stakeholder_address,
|
||||
b.miner_tx, ex_nonce,
|
||||
b.miner_tx,
|
||||
get_tx_version(height, m_core_runtime_config.hard_forks),
|
||||
ex_nonce,
|
||||
CURRENCY_MINER_TX_MAX_OUTS,
|
||||
pos,
|
||||
pe);
|
||||
|
|
@ -1834,7 +1836,7 @@ bool blockchain_storage::handle_alternative_block(const block& b, const crypto::
|
|||
if (abei.height >= m_core_runtime_config.pos_minimum_heigh)
|
||||
cumulative_diff_delta = correct_difficulty_with_sequence_factor(sequence_factor, cumulative_diff_delta);
|
||||
|
||||
if (abei.height > BLOCKCHAIN_HEIGHT_FOR_POS_STRICT_SEQUENCE_LIMITATION && abei.height <= m_core_runtime_config.hard_fork_01_starts_after_height && pos_block && sequence_factor > BLOCK_POS_STRICT_SEQUENCE_LIMIT)
|
||||
if (abei.height > BLOCKCHAIN_HEIGHT_FOR_POS_STRICT_SEQUENCE_LIMITATION && abei.height <= m_core_runtime_config.hard_forks.hard_fork_01_starts_after_height && pos_block && sequence_factor > BLOCK_POS_STRICT_SEQUENCE_LIMIT)
|
||||
{
|
||||
LOG_PRINT_RED_L0("Alternative block " << id << " @ " << abei.height << " has too big sequence factor: " << sequence_factor << ", rejected");
|
||||
bvc.m_verification_failed = true;
|
||||
|
|
@ -1959,7 +1961,7 @@ bool blockchain_storage::is_reorganize_required(const block_extended_info& main_
|
|||
const block_extended_info& alt_chain_bei = alt_chain.back()->second;
|
||||
const block_extended_info& connection_point = alt_chain.front()->second;
|
||||
|
||||
if (connection_point.height <= m_core_runtime_config.hard_fork_01_starts_after_height)
|
||||
if (connection_point.height <= m_core_runtime_config.hard_forks.hard_fork_01_starts_after_height)
|
||||
{
|
||||
//use pre-hard fork, old-style comparing
|
||||
if (main_chain_bei.cumulative_diff_adjusted < alt_chain_bei.cumulative_diff_adjusted)
|
||||
|
|
@ -1980,7 +1982,7 @@ bool blockchain_storage::is_reorganize_required(const block_extended_info& main_
|
|||
return true;
|
||||
}
|
||||
}
|
||||
else if (alt_chain_bei.height > m_core_runtime_config.hard_fork_01_starts_after_height)
|
||||
else if (alt_chain_bei.height > m_core_runtime_config.hard_forks.hard_fork_01_starts_after_height)
|
||||
{
|
||||
//new rules, applied after HARD_FORK_1
|
||||
//to learn this algo please read https://github.com/hyle-team/docs/blob/master/zano/PoS_Analysis_and_improvements_proposal.pdf
|
||||
|
|
@ -3335,7 +3337,7 @@ bool blockchain_storage::push_transaction_to_global_outs_index(const transaction
|
|||
global_indexes.push_back(m_db_outputs.get_item_size(ot.amount) - 1);
|
||||
if (ot.target.type() == typeid(txout_htlc) && !is_after_hardfork_3_zone())
|
||||
{
|
||||
LOG_ERROR("Error: Transaction with txout_htlc before is_after_hardfork_3_zone(before height " << m_core_runtime_config.hard_fork_03_starts_after_height <<")");
|
||||
LOG_ERROR("Error: Transaction with txout_htlc before is_after_hardfork_3_zone(before height " << m_core_runtime_config.hard_forks.hard_fork_03_starts_after_height <<")");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -3856,7 +3858,7 @@ namespace currency
|
|||
{
|
||||
if (!m_bcs.is_after_hardfork_3_zone())
|
||||
{
|
||||
LOG_ERROR("Error: Transaction with txin_htlc before is_after_hardfork_3_zone(before height " << m_bcs.get_core_runtime_config().hard_fork_03_starts_after_height << ")");
|
||||
LOG_ERROR("Error: Transaction with txin_htlc before is_after_hardfork_3_zone(before height " << m_bcs.get_core_runtime_config().hard_forks.hard_fork_03_starts_after_height << ")");
|
||||
return false;
|
||||
}
|
||||
return this->operator()(static_cast<const txin_to_key&>(in));
|
||||
|
|
@ -4286,7 +4288,7 @@ bool blockchain_storage::check_tx_inputs(const transaction& tx, const crypto::ha
|
|||
{
|
||||
if (!is_after_hardfork_3_zone())
|
||||
{
|
||||
LOG_ERROR("Error: Transaction with txin_htlc before is_after_hardfork_3_zone(before height " << m_core_runtime_config.hard_fork_03_starts_after_height << ")");
|
||||
LOG_ERROR("Error: Transaction with txin_htlc before is_after_hardfork_3_zone(before height " << m_core_runtime_config.hard_forks.hard_fork_03_starts_after_height << ")");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -5008,7 +5010,7 @@ bool blockchain_storage::validate_pos_coinbase_outs_unlock_time(const transactio
|
|||
return true;
|
||||
}
|
||||
|
||||
CHECK_AND_ASSERT_MES(get_block_height(miner_tx) > m_core_runtime_config.hard_fork_01_starts_after_height, false, "error in block [" << get_block_height(miner_tx) << "] etc_tx_details_unlock_time2 can exist only after hard fork point : " << m_core_runtime_config.hard_fork_01_starts_after_height);
|
||||
CHECK_AND_ASSERT_MES(get_block_height(miner_tx) > m_core_runtime_config.hard_forks.hard_fork_01_starts_after_height, false, "error in block [" << get_block_height(miner_tx) << "] etc_tx_details_unlock_time2 can exist only after hard fork point : " << m_core_runtime_config.hard_forks.hard_fork_01_starts_after_height);
|
||||
|
||||
//etc_tx_details_unlock_time2 can be kept only after hard_fork_1 point
|
||||
etc_tx_details_unlock_time2 ut2 = AUTO_VAL_INIT(ut2);
|
||||
|
|
@ -5114,7 +5116,7 @@ bool blockchain_storage::validate_pos_block(const block& b,
|
|||
r = check_tx_input(b.miner_tx, 1, coinstake_in, id, b.miner_tx.signatures[0], max_related_block_height, source_max_unlock_time_for_pos_coinbase);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Failed to validate coinstake input in miner tx, block_id = " << get_block_hash(b));
|
||||
|
||||
if (get_block_height(b) > m_core_runtime_config.hard_fork_01_starts_after_height)
|
||||
if (get_block_height(b) > m_core_runtime_config.hard_forks.hard_fork_01_starts_after_height)
|
||||
{
|
||||
uint64_t last_pow_h = get_last_x_block_height(false);
|
||||
CHECK_AND_ASSERT_MES(max_related_block_height <= last_pow_h, false, "Failed to validate coinbase in PoS block, condition failed: max_related_block_height(" << max_related_block_height << ") <= last_pow_h(" << last_pow_h << ")");
|
||||
|
|
@ -5749,7 +5751,7 @@ bool blockchain_storage::is_after_hardfork_1_zone()const
|
|||
//------------------------------------------------------------------
|
||||
bool blockchain_storage::is_after_hardfork_1_zone(uint64_t height)const
|
||||
{
|
||||
if (height > m_core_runtime_config.hard_fork_01_starts_after_height)
|
||||
if (height > m_core_runtime_config.hard_forks.hard_fork_01_starts_after_height)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
|
@ -5766,14 +5768,14 @@ bool blockchain_storage::is_after_hardfork_3_zone()const
|
|||
//------------------------------------------------------------------
|
||||
bool blockchain_storage::is_after_hardfork_2_zone(uint64_t height)const
|
||||
{
|
||||
if (height > m_core_runtime_config.hard_fork_02_starts_after_height)
|
||||
if (height > m_core_runtime_config.hard_forks.hard_fork_02_starts_after_height)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
bool blockchain_storage::is_after_hardfork_3_zone(uint64_t height)const
|
||||
{
|
||||
if (height > m_core_runtime_config.hard_fork_03_starts_after_height)
|
||||
if (height > m_core_runtime_config.hard_forks.hard_fork_03_starts_after_height)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
|
@ -5781,13 +5783,13 @@ bool blockchain_storage::is_after_hardfork_3_zone(uint64_t height)const
|
|||
bool blockchain_storage::prevalidate_block(const block& bl)
|
||||
{
|
||||
//before hard_fork1
|
||||
if (bl.major_version == BLOCK_MAJOR_VERSION_INITIAL && get_block_height(bl) <= m_core_runtime_config.hard_fork_01_starts_after_height)
|
||||
if (bl.major_version == BLOCK_MAJOR_VERSION_INITIAL && get_block_height(bl) <= m_core_runtime_config.hard_forks.hard_fork_01_starts_after_height)
|
||||
return true;
|
||||
|
||||
|
||||
//after hard_fork1 and before hard_fork3
|
||||
if ( get_block_height(bl) > m_core_runtime_config.hard_fork_01_starts_after_height &&
|
||||
get_block_height(bl) <= m_core_runtime_config.hard_fork_03_starts_after_height
|
||||
if ( get_block_height(bl) > m_core_runtime_config.hard_forks.hard_fork_01_starts_after_height &&
|
||||
get_block_height(bl) <= m_core_runtime_config.hard_forks.hard_fork_03_starts_after_height
|
||||
)
|
||||
{
|
||||
if (bl.major_version <= HF1_BLOCK_MAJOR_VERSION )
|
||||
|
|
|
|||
|
|
@ -667,6 +667,8 @@ namespace currency
|
|||
bool is_after_hardfork_2_zone(uint64_t height)const;
|
||||
bool is_after_hardfork_3_zone()const;
|
||||
bool is_after_hardfork_3_zone(uint64_t height)const;
|
||||
// bool is_after_hardfork_4_zone()const;
|
||||
// bool is_after_hardfork_4_zone(uint64_t height)const;
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,14 @@ namespace currency
|
|||
{
|
||||
typedef uint64_t (*core_time_func_t)();
|
||||
|
||||
struct hard_forks_descriptor
|
||||
{
|
||||
uint64_t hard_fork_01_starts_after_height = 0;
|
||||
uint64_t hard_fork_02_starts_after_height = 0;
|
||||
uint64_t hard_fork_03_starts_after_height = 0;
|
||||
uint64_t hard_fork_04_starts_after_height = UINT64_MAX;
|
||||
};
|
||||
|
||||
struct core_runtime_config
|
||||
{
|
||||
uint64_t min_coinstake_age;
|
||||
|
|
@ -22,18 +30,17 @@ namespace currency
|
|||
crypto::public_key alias_validation_pubkey;
|
||||
core_time_func_t get_core_time;
|
||||
|
||||
uint64_t hard_fork_01_starts_after_height;
|
||||
uint64_t hard_fork_02_starts_after_height;
|
||||
uint64_t hard_fork_03_starts_after_height;
|
||||
hard_forks_descriptor hard_forks;
|
||||
|
||||
bool is_hardfork_active_for_height(size_t hardfork_id, uint64_t height) const
|
||||
{
|
||||
switch (hardfork_id)
|
||||
{
|
||||
case 0: return true;
|
||||
case 1: return height > hard_fork_01_starts_after_height;
|
||||
case 2: return height > hard_fork_02_starts_after_height;
|
||||
case 3: return height > hard_fork_03_starts_after_height;
|
||||
case 1: return height > hard_forks.hard_fork_01_starts_after_height;
|
||||
case 2: return height > hard_forks.hard_fork_02_starts_after_height;
|
||||
case 3: return height > hard_forks.hard_fork_03_starts_after_height;
|
||||
case 4: return height > hard_forks.hard_fork_04_starts_after_height;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -53,9 +60,10 @@ namespace currency
|
|||
pc.tx_default_fee = TX_DEFAULT_FEE;
|
||||
pc.max_alt_blocks = CURRENCY_ALT_BLOCK_MAX_COUNT;
|
||||
|
||||
pc.hard_fork_01_starts_after_height = ZANO_HARDFORK_01_AFTER_HEIGHT;
|
||||
pc.hard_fork_02_starts_after_height = ZANO_HARDFORK_02_AFTER_HEIGHT;
|
||||
pc.hard_fork_03_starts_after_height = ZANO_HARDFORK_03_AFTER_HEIGHT;
|
||||
pc.hard_forks.hard_fork_01_starts_after_height = ZANO_HARDFORK_01_AFTER_HEIGHT;
|
||||
pc.hard_forks.hard_fork_02_starts_after_height = ZANO_HARDFORK_02_AFTER_HEIGHT;
|
||||
pc.hard_forks.hard_fork_03_starts_after_height = ZANO_HARDFORK_03_AFTER_HEIGHT;
|
||||
pc.hard_forks.hard_fork_04_starts_after_height = ZANO_HARDFORK_04_AFTER_HEIGHT;
|
||||
|
||||
pc.get_core_time = &core_runtime_config::_default_core_time_function;
|
||||
bool r = epee::string_tools::hex_to_pod(ALIAS_SHORT_NAMES_VALIDATION_PUB_KEY, pc.alias_validation_pubkey);
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@
|
|||
#define CURRENCY_PUBLIC_AUDITABLE_ADDRESS_BASE58_PREFIX 0x98c8 // auditable addresses start with 'aZx'
|
||||
#define CURRENCY_PUBLIC_AUDITABLE_INTEG_ADDRESS_BASE58_PREFIX 0x8a49 // auditable integrated addresses start with 'aiZX'
|
||||
#define CURRENCY_MINED_MONEY_UNLOCK_WINDOW 10
|
||||
#define CURRENT_TRANSACTION_VERSION 1
|
||||
#define CURRENT_TRANSACTION_VERSION_HF4 2
|
||||
#define CURRENT_TRANSACTION_VERSION 2
|
||||
#define TRANSACTION_VERSION_PRE_HF4 1
|
||||
#define HF1_BLOCK_MAJOR_VERSION 1
|
||||
#define CURRENT_BLOCK_MAJOR_VERSION 2
|
||||
|
||||
|
|
@ -243,10 +243,12 @@
|
|||
#define ZANO_HARDFORK_01_AFTER_HEIGHT 194624
|
||||
#define ZANO_HARDFORK_02_AFTER_HEIGHT 999999
|
||||
#define ZANO_HARDFORK_03_AFTER_HEIGHT 1082577
|
||||
#define ZANO_HARDFORK_04_AFTER_HEIGHT 999999999
|
||||
#else
|
||||
#define ZANO_HARDFORK_01_AFTER_HEIGHT 1440
|
||||
#define ZANO_HARDFORK_02_AFTER_HEIGHT 1800
|
||||
#define ZANO_HARDFORK_03_AFTER_HEIGHT 1801
|
||||
#define ZANO_HARDFORK_04_AFTER_HEIGHT 999999999
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -89,6 +89,11 @@ namespace currency
|
|||
return m_blockchain_storage.get_current_blockchain_size();
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
uint64_t core::get_current_tx_version() const
|
||||
{
|
||||
return get_tx_version(m_blockchain_storage.get_current_blockchain_size(), m_blockchain_storage.get_core_runtime_config().hard_forks);
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
uint64_t core::get_top_block_height() const
|
||||
{
|
||||
return m_blockchain_storage.get_top_block_height();
|
||||
|
|
@ -504,9 +509,9 @@ namespace currency
|
|||
{
|
||||
uint64_t h = get_block_height(b);
|
||||
auto& crc = m_blockchain_storage.get_core_runtime_config();
|
||||
if (h == crc.hard_fork_01_starts_after_height + 1)
|
||||
if (h == crc.hard_forks.hard_fork_01_starts_after_height + 1)
|
||||
{ LOG_PRINT_GREEN("Hardfork 1 activated at height " << h, LOG_LEVEL_0); }
|
||||
else if (h == crc.hard_fork_02_starts_after_height + 1)
|
||||
else if (h == crc.hard_forks.hard_fork_02_starts_after_height + 1)
|
||||
{ LOG_PRINT_GREEN("Hardfork 2 activated at height " << h, LOG_LEVEL_0); }
|
||||
|
||||
if (h == m_stop_after_height)
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ namespace currency
|
|||
bool set_genesis_block(const block& b);
|
||||
bool deinit();
|
||||
uint64_t get_current_blockchain_size() const;
|
||||
uint64_t get_current_tx_version() const;
|
||||
uint64_t get_top_block_height() const;
|
||||
std::string get_config_folder();
|
||||
bool get_blockchain_top(uint64_t& heeight, crypto::hash& top_id) const;
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ namespace currency
|
|||
const account_public_address &miner_address,
|
||||
const account_public_address &stakeholder_address,
|
||||
transaction& tx,
|
||||
uint64_t tx_version,
|
||||
const blobdata& extra_nonce,
|
||||
size_t max_outs,
|
||||
bool pos,
|
||||
|
|
@ -130,7 +131,7 @@ namespace currency
|
|||
}
|
||||
|
||||
|
||||
return construct_miner_tx(height, median_size, already_generated_coins, current_block_size, fee, destinations, tx, extra_nonce, max_outs, pos, pe);
|
||||
return construct_miner_tx(height, median_size, already_generated_coins, current_block_size, fee, destinations, tx, tx_version, extra_nonce, max_outs, pos, pe);
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
bool apply_unlock_time(const std::vector<tx_destination_entry>& destinations, transaction& tx)
|
||||
|
|
@ -159,6 +160,7 @@ namespace currency
|
|||
uint64_t fee,
|
||||
const std::vector<tx_destination_entry>& destinations,
|
||||
transaction& tx,
|
||||
uint64_t tx_version,
|
||||
const blobdata& extra_nonce,
|
||||
size_t max_outs,
|
||||
bool pos,
|
||||
|
|
@ -208,7 +210,7 @@ namespace currency
|
|||
}
|
||||
|
||||
|
||||
tx.version = CURRENT_TRANSACTION_VERSION;
|
||||
tx.version = tx_version;
|
||||
if (!have_type_in_variant_container<etc_tx_details_unlock_time2>(tx.extra))
|
||||
{
|
||||
//if stake unlock time was not set, then we can use simple "whole transaction" lock scheme
|
||||
|
|
@ -741,15 +743,18 @@ namespace currency
|
|||
eai.cnt = attachment.size();
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
bool construct_tx(const account_keys& sender_account_keys, const std::vector<tx_source_entry>& sources,
|
||||
bool construct_tx(const account_keys& sender_account_keys,
|
||||
const std::vector<tx_source_entry>& sources,
|
||||
const std::vector<tx_destination_entry>& destinations,
|
||||
const std::vector<attachment_v>& attachments,
|
||||
const std::vector<attachment_v>& attachments,
|
||||
transaction& tx,
|
||||
uint64_t tx_version,
|
||||
uint64_t unlock_time,
|
||||
uint8_t tx_outs_attr, bool shuffle)
|
||||
uint8_t tx_outs_attr,
|
||||
bool shuffle)
|
||||
{
|
||||
crypto::secret_key one_time_secret_key = AUTO_VAL_INIT(one_time_secret_key);
|
||||
return construct_tx(sender_account_keys, sources, destinations, std::vector<extra_v>(), attachments, tx, one_time_secret_key, unlock_time, tx_outs_attr, shuffle);
|
||||
return construct_tx(sender_account_keys, sources, destinations, std::vector<extra_v>(), attachments, tx, tx_version, one_time_secret_key, unlock_time, tx_outs_attr, shuffle);
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
struct encrypt_attach_visitor : public boost::static_visitor<void>
|
||||
|
|
@ -1174,6 +1179,7 @@ namespace currency
|
|||
const std::vector<extra_v>& extra,
|
||||
const std::vector<attachment_v>& attachments,
|
||||
transaction& tx,
|
||||
uint64_t tx_version,
|
||||
crypto::secret_key& one_time_secret_key,
|
||||
uint64_t unlock_time,
|
||||
uint8_t tx_outs_attr,
|
||||
|
|
@ -1186,7 +1192,7 @@ namespace currency
|
|||
//in case if there is no real targets we use sender credentials to encrypt attachments
|
||||
account_public_address crypt_destination_addr = get_crypt_address_from_destinations(sender_account_keys, destinations);
|
||||
|
||||
return construct_tx(sender_account_keys, sources, destinations, extra, attachments, tx, one_time_secret_key, unlock_time,
|
||||
return construct_tx(sender_account_keys, sources, destinations, extra, attachments, tx, tx_version, one_time_secret_key, unlock_time,
|
||||
crypt_destination_addr,
|
||||
0,
|
||||
tx_outs_attr,
|
||||
|
|
@ -1199,6 +1205,7 @@ namespace currency
|
|||
const std::vector<extra_v>& extra,
|
||||
const std::vector<attachment_v>& attachments,
|
||||
transaction& tx,
|
||||
uint64_t tx_version,
|
||||
crypto::secret_key& one_time_secret_key,
|
||||
uint64_t unlock_time,
|
||||
const account_public_address& crypt_destination_addr,
|
||||
|
|
@ -1209,7 +1216,7 @@ namespace currency
|
|||
{
|
||||
//extra copy operation, but creating transaction is not sensitive to this
|
||||
finalize_tx_param ftp = AUTO_VAL_INIT(ftp);
|
||||
ftp.tx_version = CURRENT_TRANSACTION_VERSION;
|
||||
ftp.tx_version = tx_version;
|
||||
ftp.sources = sources;
|
||||
ftp.prepared_destinations = destinations;
|
||||
ftp.extra = extra;
|
||||
|
|
@ -1220,6 +1227,7 @@ namespace currency
|
|||
ftp.tx_outs_attr = tx_outs_attr;
|
||||
ftp.shuffle = shuffle;
|
||||
ftp.flags = flags;
|
||||
ftp.tx_version;
|
||||
|
||||
finalized_tx ft = AUTO_VAL_INIT(ft);
|
||||
ft.tx = tx;
|
||||
|
|
@ -1434,7 +1442,6 @@ namespace currency
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
// "Shuffle" outs
|
||||
std::vector<tx_destination_entry> shuffled_dsts(destinations);
|
||||
if (shuffle)
|
||||
|
|
@ -1562,6 +1569,15 @@ namespace currency
|
|||
return true;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
uint64_t get_tx_version(uint64_t h, const hard_forks_descriptor& hfd)
|
||||
{
|
||||
if (h <= hfd.hard_fork_04_starts_after_height)
|
||||
{
|
||||
return TRANSACTION_VERSION_PRE_HF4;
|
||||
}
|
||||
return CURRENT_TRANSACTION_VERSION;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
uint64_t get_reward_from_miner_tx(const transaction& tx)
|
||||
{
|
||||
uint64_t income = 0;
|
||||
|
|
|
|||
|
|
@ -201,6 +201,7 @@ namespace currency
|
|||
const account_public_address &miner_address,
|
||||
const account_public_address &stakeholder_address,
|
||||
transaction& tx,
|
||||
uint64_t tx_version,
|
||||
const blobdata& extra_nonce = blobdata(),
|
||||
size_t max_outs = CURRENCY_MINER_TX_MAX_OUTS,
|
||||
bool pos = false,
|
||||
|
|
@ -211,6 +212,7 @@ namespace currency
|
|||
uint64_t fee,
|
||||
const std::vector<tx_destination_entry>& destinations,
|
||||
transaction& tx,
|
||||
uint64_t tx_version,
|
||||
const blobdata& extra_nonce = blobdata(),
|
||||
size_t max_outs = CURRENCY_MINER_TX_MAX_OUTS,
|
||||
bool pos = false,
|
||||
|
|
@ -229,6 +231,7 @@ namespace currency
|
|||
const std::vector<tx_destination_entry>& destinations,
|
||||
const std::vector<attachment_v>& attachments,
|
||||
transaction& tx,
|
||||
uint64_t tx_version,
|
||||
uint64_t unlock_time,
|
||||
uint8_t tx_outs_attr = CURRENCY_TO_KEY_OUT_RELAXED,
|
||||
bool shuffle = true);
|
||||
|
|
@ -238,6 +241,7 @@ namespace currency
|
|||
const std::vector<extra_v>& extra,
|
||||
const std::vector<attachment_v>& attachments,
|
||||
transaction& tx,
|
||||
uint64_t tx_version,
|
||||
crypto::secret_key& one_time_secret_key,
|
||||
uint64_t unlock_time,
|
||||
uint8_t tx_outs_attr = CURRENCY_TO_KEY_OUT_RELAXED,
|
||||
|
|
@ -250,6 +254,7 @@ namespace currency
|
|||
const std::vector<extra_v>& extra,
|
||||
const std::vector<attachment_v>& attachments,
|
||||
transaction& tx,
|
||||
uint64_t tx_version,
|
||||
crypto::secret_key& one_time_secret_key,
|
||||
uint64_t unlock_time,
|
||||
const account_public_address& crypt_account,
|
||||
|
|
@ -258,6 +263,7 @@ namespace currency
|
|||
bool shuffle = true,
|
||||
uint64_t flags = 0);
|
||||
|
||||
uint64_t get_tx_version(uint64_t h, const hard_forks_descriptor& hfd);
|
||||
bool construct_tx(const account_keys& sender_account_keys, const finalize_tx_param& param, finalized_tx& result);
|
||||
|
||||
|
||||
|
|
@ -701,7 +707,7 @@ namespace currency
|
|||
template <typename container_t>
|
||||
void create_and_add_tx_payer_to_container_from_address(container_t& container, const account_public_address& addr, uint64_t top_block_height, const core_runtime_config& crc)
|
||||
{
|
||||
if (top_block_height > crc.hard_fork_02_starts_after_height)
|
||||
if (top_block_height > crc.hard_forks.hard_fork_02_starts_after_height)
|
||||
{
|
||||
// after hardfork 2
|
||||
tx_payer result = AUTO_VAL_INIT(result);
|
||||
|
|
@ -723,7 +729,7 @@ namespace currency
|
|||
template <typename container_t>
|
||||
void create_and_add_tx_receiver_to_container_from_address(container_t& container, const account_public_address& addr, uint64_t top_block_height, const core_runtime_config& crc)
|
||||
{
|
||||
if (top_block_height > crc.hard_fork_02_starts_after_height)
|
||||
if (top_block_height > crc.hard_forks.hard_fork_02_starts_after_height)
|
||||
{
|
||||
// after hardfork 2
|
||||
tx_receiver result = AUTO_VAL_INIT(result);
|
||||
|
|
|
|||
|
|
@ -844,6 +844,7 @@ void wallet2::accept_proposal(const crypto::hash& contract_id, uint64_t b_accept
|
|||
|
||||
//build transaction
|
||||
currency::finalize_tx_param ftp = AUTO_VAL_INIT(ftp);
|
||||
ftp.tx_version = this->get_current_tx_version();
|
||||
prepare_transaction(construct_param, ftp, tx);
|
||||
mark_transfers_as_spent(ftp.selected_transfers, std::string("contract <") + epee::string_tools::pod_to_hex(contract_id) + "> has been accepted with tx <" + epee::string_tools::pod_to_hex(get_transaction_hash(tx)) + ">");
|
||||
|
||||
|
|
@ -862,7 +863,12 @@ void wallet2::accept_proposal(const crypto::hash& contract_id, uint64_t b_accept
|
|||
if (p_acceptance_tx != nullptr)
|
||||
*p_acceptance_tx = tx;
|
||||
}
|
||||
//---------------------------
|
||||
//---------------------------------------------------------------------------------
|
||||
uint64_t wallet2::get_current_tx_version()
|
||||
{
|
||||
return currency::get_tx_version(this->get_top_block_height(), this->m_core_runtime_config.hard_forks);
|
||||
}
|
||||
//---------------------------------------------------------------------------------
|
||||
void wallet2::finish_contract(const crypto::hash& contract_id, const std::string& release_type, currency::transaction* p_release_tx /* = nullptr */)
|
||||
{
|
||||
auto contr_it = m_contracts.find(contract_id);
|
||||
|
|
@ -974,6 +980,7 @@ void wallet2::request_cancel_contract(const crypto::hash& contract_id, uint64_t
|
|||
construct_param.split_strategy_id = detail::ssi_digit;
|
||||
|
||||
currency::finalize_tx_param ftp = AUTO_VAL_INIT(ftp);
|
||||
ftp.tx_version = this->get_current_tx_version();
|
||||
prepare_transaction(construct_param, ftp);
|
||||
currency::transaction tx = AUTO_VAL_INIT(tx);
|
||||
crypto::secret_key sk = AUTO_VAL_INIT(sk);
|
||||
|
|
@ -3696,7 +3703,7 @@ bool wallet2::is_transfer_unlocked(const transfer_details& td, bool for_pos_mini
|
|||
|
||||
|
||||
uint64_t unlock_time = get_tx_unlock_time(td.m_ptx_wallet_info->m_tx, td.m_internal_output_index);
|
||||
if (for_pos_mining && get_blockchain_current_size() > m_core_runtime_config.hard_fork_01_starts_after_height)
|
||||
if (for_pos_mining && get_blockchain_current_size() > m_core_runtime_config.hard_forks.hard_fork_01_starts_after_height)
|
||||
{
|
||||
//allowed of staking locked coins with
|
||||
stake_lock_time = unlock_time;
|
||||
|
|
@ -3782,7 +3789,7 @@ void wallet2::update_offer_by_id(const crypto::hash& tx_id, uint64_t of_ind, con
|
|||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::push_alias_info_to_extra_according_to_hf_status(const currency::extra_alias_entry& ai, std::vector<currency::extra_v>& extra)
|
||||
{
|
||||
if (get_top_block_height() > m_core_runtime_config.hard_fork_02_starts_after_height)
|
||||
if (get_top_block_height() > m_core_runtime_config.hard_forks.hard_fork_02_starts_after_height)
|
||||
{
|
||||
// after HF2
|
||||
extra.push_back(ai);
|
||||
|
|
@ -3979,6 +3986,7 @@ void wallet2::build_escrow_release_templates(crypto::hash multisig_id,
|
|||
construct_params.extra.push_back(tsa);
|
||||
{
|
||||
currency::finalize_tx_param ftp = AUTO_VAL_INIT(ftp);
|
||||
ftp.tx_version = this->get_current_tx_version();
|
||||
prepare_transaction(construct_params, ftp);
|
||||
crypto::secret_key sk = AUTO_VAL_INIT(sk);
|
||||
finalize_transaction(ftp, tx_release_template, sk, false);
|
||||
|
|
@ -3995,6 +4003,7 @@ void wallet2::build_escrow_release_templates(crypto::hash multisig_id,
|
|||
construct_params.extra.push_back(tsa);
|
||||
{
|
||||
currency::finalize_tx_param ftp = AUTO_VAL_INIT(ftp);
|
||||
ftp.tx_version = this->get_current_tx_version();
|
||||
prepare_transaction(construct_params, ftp);
|
||||
crypto::secret_key sk = AUTO_VAL_INIT(sk);
|
||||
finalize_transaction(ftp, tx_burn_template, sk, false);
|
||||
|
|
@ -4015,6 +4024,7 @@ void wallet2::build_escrow_cancel_template(crypto::hash multisig_id,
|
|||
|
||||
construct_tx_param construct_params = AUTO_VAL_INIT(construct_params);
|
||||
currency::finalize_tx_param ftp = AUTO_VAL_INIT(ftp);
|
||||
ftp.tx_version = this->get_current_tx_version();
|
||||
construct_params.fee = it->second.amount() - (ecrow_details.amount_a_pledge + ecrow_details.amount_to_pay + ecrow_details.amount_b_pledge);
|
||||
construct_params.multisig_id = multisig_id;
|
||||
construct_params.split_strategy_id = detail::ssi_digit;
|
||||
|
|
@ -4097,6 +4107,7 @@ void wallet2::build_escrow_template(const bc_services::contract_private_details&
|
|||
}
|
||||
|
||||
currency::finalize_tx_param ftp = AUTO_VAL_INIT(ftp);
|
||||
ftp.tx_version = this->get_current_tx_version();
|
||||
prepare_transaction(ctp, ftp, tx);
|
||||
|
||||
selected_transfers = ftp.selected_transfers;
|
||||
|
|
@ -4229,6 +4240,7 @@ void wallet2::send_escrow_proposal(const bc_services::contract_private_details&
|
|||
ctp.unlock_time = unlock_time;
|
||||
|
||||
currency::finalize_tx_param ftp = AUTO_VAL_INIT(ftp);
|
||||
ftp.tx_version = this->get_current_tx_version();
|
||||
try
|
||||
{
|
||||
prepare_transaction(ctp, ftp);
|
||||
|
|
@ -5465,6 +5477,7 @@ void wallet2::transfer(construct_tx_param& ctp,
|
|||
|
||||
TIME_MEASURE_START(prepare_transaction_time);
|
||||
currency::finalize_tx_param ftp = AUTO_VAL_INIT(ftp);
|
||||
ftp.tx_version = this->get_current_tx_version();
|
||||
prepare_transaction(ctp, ftp);
|
||||
TIME_MEASURE_FINISH(prepare_transaction_time);
|
||||
|
||||
|
|
@ -5571,6 +5584,7 @@ void wallet2::sweep_below(size_t fake_outs_count, const currency::account_public
|
|||
}
|
||||
|
||||
currency::finalize_tx_param ftp = AUTO_VAL_INIT(ftp);
|
||||
ftp.tx_version = this->get_current_tx_version();
|
||||
if (!payment_id.empty())
|
||||
set_payment_id_to_tx(ftp.attachments, payment_id);
|
||||
// put encrypted payer info into the extra
|
||||
|
|
|
|||
|
|
@ -956,7 +956,7 @@ private:
|
|||
bool handle_cancel_proposal(wallet_public::wallet_transfer_info& wti, const bc_services::escrow_cancel_templates_body& ectb, const std::vector<currency::payload_items_v>& decrypted_attach);
|
||||
bool handle_expiration_list(uint64_t tx_expiration_ts_median);
|
||||
void handle_contract_expirations(uint64_t tx_expiration_ts_median);
|
||||
|
||||
uint64_t get_current_tx_version();
|
||||
void change_contract_state(wallet_public::escrow_contract_details_basic& contract, uint32_t new_state, const crypto::hash& contract_id, const wallet_public::wallet_transfer_info& wti) const;
|
||||
void change_contract_state(wallet_public::escrow_contract_details_basic& contract, uint32_t new_state, const crypto::hash& contract_id, const std::string& reason = "internal intention") const;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ using namespace currency;
|
|||
#define FIFTH_NAME "fifth--01234567890"
|
||||
#define SIX_NAME "sixsix-double--01234567890"
|
||||
|
||||
bool put_alias_via_tx_to_list(std::vector<test_event_entry>& events,
|
||||
bool put_alias_via_tx_to_list(const currency::hard_forks_descriptor& hf,
|
||||
std::vector<test_event_entry>& events,
|
||||
std::list<currency::transaction>& tx_set,
|
||||
const block& head_block,
|
||||
const std::string& alias_name,
|
||||
|
|
@ -30,10 +31,11 @@ bool put_alias_via_tx_to_list(std::vector<test_event_entry>& events,
|
|||
ai2.m_alias = alias_name;
|
||||
ai2.m_address = alias_acc.get_keys().account_address;
|
||||
ai2.m_text_comment = "ssdss";
|
||||
return put_alias_via_tx_to_list(events, tx_set, head_block, miner_acc, ai2, generator);
|
||||
return put_alias_via_tx_to_list(hf, events, tx_set, head_block, miner_acc, ai2, generator);
|
||||
}
|
||||
|
||||
bool put_next_block_with_alias_in_tx(std::vector<test_event_entry>& events,
|
||||
bool put_next_block_with_alias_in_tx(const currency::hard_forks_descriptor& hf,
|
||||
std::vector<test_event_entry>& events,
|
||||
block& b,
|
||||
const block& head_block,
|
||||
const account_base& miner_acc,
|
||||
|
|
@ -41,7 +43,7 @@ bool put_next_block_with_alias_in_tx(std::vector<test_event_entry>& events,
|
|||
test_generator& generator)
|
||||
{
|
||||
std::list<currency::transaction> txs_0;
|
||||
if (!put_alias_via_tx_to_list(events, txs_0, head_block, miner_acc, ai, generator))
|
||||
if (!put_alias_via_tx_to_list(hf, events, txs_0, head_block, miner_acc, ai, generator))
|
||||
return false;
|
||||
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk, head_block, miner_acc, txs_0);
|
||||
|
|
@ -50,7 +52,7 @@ bool put_next_block_with_alias_in_tx(std::vector<test_event_entry>& events,
|
|||
}
|
||||
|
||||
|
||||
bool put_next_block_with_alias_in_tx(std::vector<test_event_entry>& events,
|
||||
bool put_next_block_with_alias_in_tx(const currency::hard_forks_descriptor& hf, std::vector<test_event_entry>& events,
|
||||
block& b,
|
||||
const block& head_block,
|
||||
const std::string& alias_name,
|
||||
|
|
@ -63,16 +65,16 @@ bool put_next_block_with_alias_in_tx(std::vector<test_event_entry>& events,
|
|||
ai2.m_address = alias_acc.get_keys().account_address;
|
||||
ai2.m_text_comment = "ssdss";
|
||||
|
||||
return put_next_block_with_alias_in_tx(events, b, head_block, miner_acc, ai2, generator);
|
||||
return put_next_block_with_alias_in_tx(hf, events, b, head_block, miner_acc, ai2, generator);
|
||||
}
|
||||
|
||||
#define MAKE_BLOCK_WITH_ALIAS_IN_TX(EVENTS, NAME, HEAD, ALIAS_NAME) \
|
||||
block NAME; \
|
||||
put_next_block_with_alias_in_tx(EVENTS, NAME, HEAD, ALIAS_NAME, miner_account, second_acc, generator)
|
||||
put_next_block_with_alias_in_tx(m_hardforks, EVENTS, NAME, HEAD, ALIAS_NAME, miner_account, second_acc, generator)
|
||||
|
||||
#define MAKE_BLOCK_WITH_ALIAS_INFO_IN_TX(EVENTS, NAME, HEAD, MINER_ACCOUNT, ALIAS_INFO) \
|
||||
block NAME; \
|
||||
put_next_block_with_alias_in_tx(EVENTS, NAME, HEAD, MINER_ACCOUNT, ALIAS_INFO, generator)
|
||||
put_next_block_with_alias_in_tx(m_hardforks, EVENTS, NAME, HEAD, MINER_ACCOUNT, ALIAS_INFO, generator)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -94,8 +96,8 @@ gen_alias_tests::gen_alias_tests()
|
|||
REGISTER_CALLBACK_METHOD(gen_alias_tests, check_height_changed);
|
||||
REGISTER_CALLBACK_METHOD(gen_alias_tests, check_too_many_aliases_registration);
|
||||
|
||||
m_hardfork_01_height = 0;
|
||||
m_hardfork_02_height = 0;
|
||||
m_hardforks.hard_fork_01_starts_after_height = 0;
|
||||
m_hardforks.hard_fork_02_starts_after_height = 0;
|
||||
}
|
||||
|
||||
bool gen_alias_tests::generate(std::vector<test_event_entry>& events) const
|
||||
|
|
@ -113,7 +115,7 @@ bool gen_alias_tests::generate(std::vector<test_event_entry>& events) const
|
|||
|
||||
size_t small_outs_to_transfer = MAX_ALIAS_PER_BLOCK + 10;
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0, preminer_account.get_keys(), miner_account.get_public_address(), small_outs_to_transfer * TESTS_DEFAULT_FEE * 11, small_outs_to_transfer, TESTS_DEFAULT_FEE, tx_1);
|
||||
bool r = construct_tx_with_many_outputs(m_hardforks, events, blk_0, preminer_account.get_keys(), miner_account.get_public_address(), small_outs_to_transfer * TESTS_DEFAULT_FEE * 11, small_outs_to_transfer, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1); // 2N+5
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_a, blk_0r, miner_account, tx_1); // 2N+6
|
||||
|
|
@ -164,7 +166,7 @@ bool gen_alias_tests::generate(std::vector<test_event_entry>& events) const
|
|||
CHECK_AND_ASSERT_MES(r, false, "failed to sign update_alias");
|
||||
ai_upd_fake.m_text_comment = "changed alias haha - fake"; // changed text, signature became wrong
|
||||
std::list<currency::transaction> tx_list;
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_6, miner_account, ai_upd_fake, generator); // 4N+24
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_6, miner_account, ai_upd_fake, generator); // 4N+24
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list");
|
||||
DO_CALLBACK(events, "mark_invalid_block"); // 4N+25
|
||||
// EXPECTED: blk_7 is rejected as containing incorrect tx (wrong alias sig)
|
||||
|
|
@ -174,7 +176,7 @@ bool gen_alias_tests::generate(std::vector<test_event_entry>& events) const
|
|||
account_base someone;
|
||||
someone.generate();
|
||||
block blk_8;
|
||||
r = put_next_block_with_alias_in_tx(events, blk_8, blk_6, THIRD_ALIAS_NAME, miner_account, someone, generator); // 4N+28,4N+29
|
||||
r = put_next_block_with_alias_in_tx(m_hardforks, events, blk_8, blk_6, THIRD_ALIAS_NAME, miner_account, someone, generator); // 4N+28,4N+29
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_next_block_with_alias_in_tx failed");
|
||||
|
||||
MAKE_NEXT_BLOCK(events, blk_9, blk_8, miner_account); // 4N+30
|
||||
|
|
@ -187,7 +189,7 @@ bool gen_alias_tests::generate(std::vector<test_event_entry>& events) const
|
|||
tx_list.clear();
|
||||
DO_CALLBACK(events, "mark_invalid_tx"); // 4N+32
|
||||
// EXPECTED: tx is rejected, because alias is already registered
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_9, miner_account, ai, generator); // 4N+33
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_9, miner_account, ai, generator); // 4N+33
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list");
|
||||
DO_CALLBACK(events, "check_alias_not_changed"); // 4N+34
|
||||
|
||||
|
|
@ -196,11 +198,11 @@ bool gen_alias_tests::generate(std::vector<test_event_entry>& events) const
|
|||
//check notmal tx in tx pool
|
||||
MAKE_TX_LIST_START(events, txs_0, miner_account, miner_account, MK_TEST_COINS(1), blk_9); // 4N+36
|
||||
|
||||
if (!put_alias_via_tx_to_list(events, txs_0, blk_9, FOURTH_NAME, miner_account, miner_account, generator)) // 4N+37
|
||||
if (!put_alias_via_tx_to_list(m_hardforks, events, txs_0, blk_9, FOURTH_NAME, miner_account, miner_account, generator)) // 4N+37
|
||||
return false;
|
||||
|
||||
someone.generate();
|
||||
if (!put_alias_via_tx_to_list(events, txs_0, blk_9, FIFTH_NAME, miner_account, someone, generator)) // 4N+38
|
||||
if (!put_alias_via_tx_to_list(m_hardforks, events, txs_0, blk_9, FIFTH_NAME, miner_account, someone, generator)) // 4N+38
|
||||
return false;
|
||||
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_13, blk_9, miner_account, txs_0); // 4N+39
|
||||
|
|
@ -210,11 +212,11 @@ bool gen_alias_tests::generate(std::vector<test_event_entry>& events) const
|
|||
MAKE_TX_LIST_START(events, txs_2, miner_account, miner_account, MK_TEST_COINS(1), blk_13); // 4N+41
|
||||
|
||||
someone.generate();
|
||||
if (!put_alias_via_tx_to_list(events, txs_2, blk_13, SIX_NAME, miner_account, someone, generator)) // 4N+42
|
||||
if (!put_alias_via_tx_to_list(m_hardforks, events, txs_2, blk_13, SIX_NAME, miner_account, someone, generator)) // 4N+42
|
||||
return false;
|
||||
DO_CALLBACK(events, "mark_invalid_tx"); // 4N+43
|
||||
// EXPECTED: the next tx is rejected, because alias is already registered
|
||||
if (!put_alias_via_tx_to_list(events, txs_2, blk_13, SIX_NAME, miner_account, miner_account, generator)) // 4N+44
|
||||
if (!put_alias_via_tx_to_list(m_hardforks, events, txs_2, blk_13, SIX_NAME, miner_account, miner_account, generator)) // 4N+44
|
||||
return false;
|
||||
|
||||
DO_CALLBACK(events, "mark_invalid_block"); // 4N+45
|
||||
|
|
@ -400,7 +402,7 @@ bool gen_alias_strange_data::generate(std::vector<test_event_entry>& events) con
|
|||
ai.m_alias = std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'a');
|
||||
ai.m_text_comment = "";
|
||||
ai.m_address = m_alice.get_public_address();
|
||||
bool r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
bool r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, tx_list);
|
||||
|
||||
|
|
@ -424,7 +426,7 @@ bool gen_alias_strange_data::generate(std::vector<test_event_entry>& events) con
|
|||
ai.m_text_comment = std::string(255, 'c');
|
||||
ai.m_address = m_alice.get_public_address();
|
||||
ai.m_view_key.push_back(m_alice.get_keys().view_secret_key);
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_3, blk_2, miner_acc, tx_list);
|
||||
|
||||
|
|
@ -432,7 +434,7 @@ bool gen_alias_strange_data::generate(std::vector<test_event_entry>& events) con
|
|||
ai.m_text_comment = std::string(255, '\0');
|
||||
r = sign_extra_alias_entry(ai, m_alice.get_public_address().spend_public_key, m_alice.get_keys().spend_secret_key);
|
||||
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_4, blk_3, miner_acc, tx_list);
|
||||
|
||||
|
|
@ -477,14 +479,14 @@ bool gen_alias_concurrency_with_switch::generate(std::vector<test_event_entry>&
|
|||
ai.m_address = miner_acc.get_public_address();
|
||||
//ai.m_address = *reinterpret_cast<currency::account_public_address*>(invalid_addr);
|
||||
ai.m_view_key.push_back(miner_acc.get_keys().view_secret_key);
|
||||
bool r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
bool r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
// 2nd
|
||||
std::list<currency::transaction> tx_list2;
|
||||
ai.m_address.spend_public_key = null_pkey, ai.m_address.view_public_key = null_pkey;
|
||||
DO_CALLBACK(events, "mark_invalid_tx"); // because tx with a duplicate alias request (?)
|
||||
r = put_alias_via_tx_to_list(events, tx_list2, blk_0r, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list2, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
// 0 .. 10 11 12 <- height
|
||||
|
|
@ -539,14 +541,14 @@ bool gen_alias_same_alias_in_tx_pool::generate(std::vector<test_event_entry>& ev
|
|||
ai.m_alias = std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'a');
|
||||
ai.m_address = miner_acc.get_public_address();
|
||||
ai.m_view_key.push_back(miner_acc.get_keys().view_secret_key);
|
||||
bool r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
bool r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
ai.m_address.spend_public_key = null_pkey, ai.m_address.view_public_key = null_pkey;
|
||||
r = sign_extra_alias_entry(ai, miner_acc.get_public_address().spend_public_key, miner_acc.get_keys().spend_secret_key);
|
||||
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
|
||||
DO_CALLBACK(events, "mark_invalid_tx"); // because tx with a duplicate alias request
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
tx_list.pop_back(); // 'cause it's invalid
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
|
|
@ -559,14 +561,14 @@ bool gen_alias_same_alias_in_tx_pool::generate(std::vector<test_event_entry>& ev
|
|||
ai.m_address.spend_public_key = miner_acc.get_public_address().spend_public_key;
|
||||
r = sign_extra_alias_entry(ai, miner_acc.get_public_address().spend_public_key, miner_acc.get_keys().spend_secret_key);
|
||||
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
ai.m_text_comment = "Oops, I forgot a comment!";
|
||||
r = sign_extra_alias_entry(ai, miner_acc.get_public_address().spend_public_key, miner_acc.get_keys().spend_secret_key);
|
||||
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
|
||||
DO_CALLBACK(events, "mark_invalid_tx"); // because tx with a duplicate alias request
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
tx_list.pop_back(); // 'cause it's invalid
|
||||
|
||||
|
|
@ -615,7 +617,7 @@ bool gen_alias_switch_and_tx_pool::generate(std::vector<test_event_entry>& event
|
|||
ai.m_alias = std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'a');
|
||||
ai.m_address = miner_acc.get_public_address();
|
||||
ai.m_view_key.push_back(miner_acc.get_keys().view_secret_key);
|
||||
bool r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
bool r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
// add a block to clear the tx pool
|
||||
|
|
@ -627,7 +629,7 @@ bool gen_alias_switch_and_tx_pool::generate(std::vector<test_event_entry>& event
|
|||
ai.m_address.spend_public_key = null_pkey, ai.m_address.view_public_key = null_pkey;
|
||||
r = sign_extra_alias_entry(ai, miner_acc.get_public_address().spend_public_key, miner_acc.get_keys().spend_secret_key);
|
||||
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
// add one more block to bring the tx to life (i.e. blockchain)
|
||||
|
|
@ -645,7 +647,7 @@ bool gen_alias_switch_and_tx_pool::generate(std::vector<test_event_entry>& event
|
|||
ai.m_address = alice.get_public_address();
|
||||
ai.m_view_key.push_back(alice.get_keys().view_secret_key);
|
||||
DO_CALLBACK(events, "mark_invalid_tx"); // tx is rejected, because tx pool already has tx with reg/upd this alias
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_4, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_4, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
|
||||
|
|
@ -692,7 +694,7 @@ bool gen_alias_update_after_addr_changed::generate(std::vector<test_event_entry>
|
|||
currency::extra_alias_entry ai = AUTO_VAL_INIT(ai);
|
||||
ai.m_alias = std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'a');
|
||||
ai.m_address = miner_acc.get_public_address();
|
||||
bool r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
bool r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, tx_list);
|
||||
|
|
@ -703,7 +705,7 @@ bool gen_alias_update_after_addr_changed::generate(std::vector<test_event_entry>
|
|||
ai.m_address = alice.get_public_address();
|
||||
r = sign_extra_alias_entry(ai, miner_acc.get_public_address().spend_public_key, miner_acc.get_keys().spend_secret_key);
|
||||
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_1, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_1, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_2, blk_1, miner_acc, tx_list);
|
||||
|
|
@ -713,7 +715,7 @@ bool gen_alias_update_after_addr_changed::generate(std::vector<test_event_entry>
|
|||
ai.m_text_comment = "upd2";
|
||||
r = sign_extra_alias_entry(ai, miner_acc.get_public_address().spend_public_key, miner_acc.get_keys().spend_secret_key);
|
||||
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_2, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_2, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
// the next block will be rejected as invalid, as cantaining tx with invalid alias sign
|
||||
DO_CALLBACK(events, "mark_invalid_block");
|
||||
|
|
@ -728,7 +730,7 @@ bool gen_alias_update_after_addr_changed::generate(std::vector<test_event_entry>
|
|||
ai.m_address = miner_acc.get_public_address();
|
||||
r = sign_extra_alias_entry(ai, alice.get_public_address().spend_public_key, alice.get_keys().spend_secret_key);
|
||||
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_2, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_2, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_3, blk_2, miner_acc, tx_list);
|
||||
|
|
@ -738,7 +740,7 @@ bool gen_alias_update_after_addr_changed::generate(std::vector<test_event_entry>
|
|||
ai.m_text_comment = "upd3";
|
||||
r = sign_extra_alias_entry(ai, alice.get_public_address().spend_public_key, alice.get_keys().spend_secret_key);
|
||||
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_3, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_3, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
// the next block will be rejected as invalid, as cantaining tx with invalid alias sign
|
||||
DO_CALLBACK(events, "mark_invalid_block");
|
||||
|
|
@ -786,7 +788,7 @@ bool gen_alias_blocking_reg_by_invalid_tx::generate(std::vector<test_event_entry
|
|||
ai = AUTO_VAL_INIT(ai);
|
||||
ai.m_alias = "sweet.name";
|
||||
ai.m_address = alice.get_public_address();
|
||||
bool r = put_alias_via_tx_to_list(events, tx_list, blk_1, alice, ai, generator);
|
||||
bool r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_1, alice, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_2, blk_1, miner_acc, tx_list);
|
||||
tx_list.clear();
|
||||
|
|
@ -824,7 +826,7 @@ bool gen_alias_blocking_update_by_invalid_tx::generate(std::vector<test_event_en
|
|||
extra_alias_entry ai = AUTO_VAL_INIT(ai);
|
||||
ai.m_alias = "sweet.name";
|
||||
ai.m_address = alice.get_public_address();
|
||||
bool r = put_alias_via_tx_to_list(events, tx_list, blk_1, alice, ai, generator);
|
||||
bool r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_1, alice, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_2, blk_1, miner_acc, tx_list);
|
||||
tx_list.clear();
|
||||
|
|
@ -834,7 +836,7 @@ bool gen_alias_blocking_update_by_invalid_tx::generate(std::vector<test_event_en
|
|||
ai.m_alias = "sweet.name";
|
||||
ai.m_address = attacker.get_public_address();
|
||||
ai.m_sign.push_back(invalid_signature);
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_2, attacker, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_2, attacker, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
// Obviously, miner can't add it to his next block, because it turns out to be invalid.
|
||||
|
|
@ -850,7 +852,7 @@ bool gen_alias_blocking_update_by_invalid_tx::generate(std::vector<test_event_en
|
|||
ai.m_text_comment = "alice@mail.com";
|
||||
r = sign_extra_alias_entry(ai, alice.get_public_address().spend_public_key, alice.get_keys().spend_secret_key);
|
||||
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_2, alice, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_2, alice, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_3, blk_2, miner_acc, tx_list);
|
||||
tx_list.clear();
|
||||
|
|
@ -1026,7 +1028,7 @@ bool gen_alias_too_small_reward::generate(std::vector<test_event_entry>& events)
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(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);
|
||||
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);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_1);
|
||||
|
|
@ -1111,8 +1113,9 @@ bool gen_alias_too_small_reward::make_tx_reg_alias(std::vector<test_event_entry>
|
|||
if (sources_amount > alias_reward + TESTS_DEFAULT_FEE)
|
||||
destinations.push_back(tx_destination_entry(sources_amount - (alias_reward + TESTS_DEFAULT_FEE), miner_acc.get_public_address())); // change
|
||||
|
||||
crypto::secret_key stub;
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx, stub, 0);
|
||||
crypto::secret_key stub = AUTO_VAL_INIT(stub);
|
||||
uint64_t tx_version = get_tx_version(get_block_height(prev_block), m_hardforks);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx, tx_version, stub, uint64_t(0));
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx);
|
||||
|
||||
|
|
@ -1221,7 +1224,7 @@ bool gen_alias_switch_and_check_block_template::generate(std::vector<test_event_
|
|||
extra_alias_entry ai = AUTO_VAL_INIT(ai);
|
||||
ai.m_alias = std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'x');
|
||||
ai.m_address = alice.get_public_address();
|
||||
bool r = put_alias_via_tx_to_list(events, tx_list, blk_1, alice, ai, generator); // 2N+5
|
||||
bool r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_1, alice, ai, generator); // 2N+5
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_2, blk_1, miner_acc, tx_list); // 2N+6
|
||||
tx_list.clear();
|
||||
|
|
@ -1322,7 +1325,8 @@ bool gen_alias_too_many_regs_in_block_template::generate(std::vector<test_event_
|
|||
destinations.push_back(tx_destination_entry(sources_amount - total_alias_cost, preminer_acc.get_public_address())); // return the change in order to keep median_fee low
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(preminer_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
|
||||
uint64_t tx_version = get_tx_version(get_block_height(blk_0r), m_hardforks);
|
||||
r = construct_tx(preminer_acc.get_keys(), sources, destinations, empty_attachment, tx_1, tx_version, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
events.push_back(tx_1);
|
||||
|
|
@ -1405,7 +1409,7 @@ bool gen_alias_update_for_free::generate(std::vector<test_event_entry>& events)
|
|||
extra_alias_entry ai = AUTO_VAL_INIT(ai);
|
||||
ai.m_alias = std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'a');
|
||||
ai.m_address = miner_acc.get_public_address();
|
||||
bool r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
bool r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, tx_list);
|
||||
tx_list.clear();
|
||||
|
|
|
|||
|
|
@ -72,9 +72,9 @@ bool atomic_base_test::configure_core(currency::core& c, size_t ev_index, const
|
|||
currency::core_runtime_config pc = c.get_blockchain_storage().get_core_runtime_config();
|
||||
pc.min_coinstake_age = TESTS_POS_CONFIG_MIN_COINSTAKE_AGE; //four blocks
|
||||
pc.pos_minimum_heigh = TESTS_POS_CONFIG_POS_MINIMUM_HEIGH; //four blocks
|
||||
pc.hard_fork_01_starts_after_height = 10;
|
||||
pc.hard_fork_02_starts_after_height = 11;
|
||||
pc.hard_fork_03_starts_after_height = 12;
|
||||
pc.hard_forks.hard_fork_01_starts_after_height = 10;
|
||||
pc.hard_forks.hard_fork_02_starts_after_height = 11;
|
||||
pc.hard_forks.hard_fork_03_starts_after_height = 12;
|
||||
c.get_blockchain_storage().set_core_runtime_config(pc);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -635,9 +635,9 @@ bool atomic_test_check_hardfork_rules::configure_core(currency::core& c, size_t
|
|||
currency::core_runtime_config pc = c.get_blockchain_storage().get_core_runtime_config();
|
||||
pc.min_coinstake_age = TESTS_POS_CONFIG_MIN_COINSTAKE_AGE; //four blocks
|
||||
pc.pos_minimum_heigh = TESTS_POS_CONFIG_POS_MINIMUM_HEIGH; //four blocks
|
||||
pc.hard_fork_01_starts_after_height = 10;
|
||||
pc.hard_fork_02_starts_after_height = 10;
|
||||
pc.hard_fork_03_starts_after_height = 10;
|
||||
pc.hard_forks.hard_fork_01_starts_after_height = 10;
|
||||
pc.hard_forks.hard_fork_02_starts_after_height = 10;
|
||||
pc.hard_forks.hard_fork_03_starts_after_height = 10;
|
||||
c.get_blockchain_storage().set_core_runtime_config(pc);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -668,9 +668,9 @@ bool atomic_test_check_hardfork_rules::c1(currency::core& c, size_t ev_index, co
|
|||
currency::core_runtime_config pc = c.get_blockchain_storage().get_core_runtime_config();
|
||||
pc.min_coinstake_age = TESTS_POS_CONFIG_MIN_COINSTAKE_AGE; //four blocks
|
||||
pc.pos_minimum_heigh = TESTS_POS_CONFIG_POS_MINIMUM_HEIGH; //four blocks
|
||||
pc.hard_fork_01_starts_after_height = 10;
|
||||
pc.hard_fork_02_starts_after_height = 10;
|
||||
pc.hard_fork_03_starts_after_height = 30;
|
||||
pc.hard_forks.hard_fork_01_starts_after_height = 10;
|
||||
pc.hard_forks.hard_fork_02_starts_after_height = 10;
|
||||
pc.hard_forks.hard_fork_03_starts_after_height = 30;
|
||||
c.get_blockchain_storage().set_core_runtime_config(pc);
|
||||
|
||||
bool r = mine_next_pow_block_in_playtime(m_mining_accunt.get_public_address(), c);
|
||||
|
|
|
|||
|
|
@ -327,7 +327,9 @@ bool gen_block_miner_tx_has_2_in::generate(std::vector<test_event_entry>& events
|
|||
|
||||
transaction tmp_tx;
|
||||
std::vector<currency::attachment_v> attachments;
|
||||
if (!construct_tx(miner_account.get_keys(), sources, destinations, attachments, tmp_tx, 0))
|
||||
|
||||
uint64_t tx_version = get_tx_version(get_block_height(blk_0r), m_hardforks);
|
||||
if (!construct_tx(miner_account.get_keys(), sources, destinations, attachments, tmp_tx, tx_version, 0))
|
||||
return false;
|
||||
|
||||
MAKE_MINER_TX_MANUALLY(miner_tx, blk_0);
|
||||
|
|
@ -370,7 +372,8 @@ bool gen_block_miner_tx_with_txin_to_key::generate(std::vector<test_event_entry>
|
|||
|
||||
transaction tmp_tx = AUTO_VAL_INIT(tmp_tx);
|
||||
std::vector<currency::attachment_v> attachments;
|
||||
if (!construct_tx(miner_account.get_keys(), sources, destinations, attachments, tmp_tx, 0))
|
||||
uint64_t tx_version = get_tx_version(get_block_height(blk_1r), m_hardforks);
|
||||
if (!construct_tx(miner_account.get_keys(), sources, destinations, attachments, tmp_tx, tx_version, 0))
|
||||
return false;
|
||||
|
||||
MAKE_MINER_TX_MANUALLY(miner_tx, blk_1);
|
||||
|
|
@ -623,9 +626,9 @@ bool gen_block_wrong_version_agains_hardfork::c1(currency::core& c, size_t ev_in
|
|||
currency::core_runtime_config pc = c.get_blockchain_storage().get_core_runtime_config();
|
||||
pc.min_coinstake_age = TESTS_POS_CONFIG_MIN_COINSTAKE_AGE; //four blocks
|
||||
pc.pos_minimum_heigh = TESTS_POS_CONFIG_POS_MINIMUM_HEIGH; //four blocks
|
||||
pc.hard_fork_01_starts_after_height = 10;
|
||||
pc.hard_fork_02_starts_after_height = 10;
|
||||
pc.hard_fork_03_starts_after_height = 10;
|
||||
pc.hard_forks.hard_fork_01_starts_after_height = 10;
|
||||
pc.hard_forks.hard_fork_02_starts_after_height = 10;
|
||||
pc.hard_forks.hard_fork_03_starts_after_height = 10;
|
||||
c.get_blockchain_storage().set_core_runtime_config(pc);
|
||||
|
||||
currency::account_base mining_accunt;
|
||||
|
|
@ -642,9 +645,9 @@ bool gen_block_wrong_version_agains_hardfork::c1(currency::core& c, size_t ev_in
|
|||
};
|
||||
|
||||
//between 1 and 2 hardforks
|
||||
pc.hard_fork_01_starts_after_height = 1;
|
||||
pc.hard_fork_02_starts_after_height = 10;
|
||||
pc.hard_fork_03_starts_after_height = 20;
|
||||
pc.hard_forks.hard_fork_01_starts_after_height = 1;
|
||||
pc.hard_forks.hard_fork_02_starts_after_height = 10;
|
||||
pc.hard_forks.hard_fork_03_starts_after_height = 20;
|
||||
c.get_blockchain_storage().set_core_runtime_config(pc);
|
||||
|
||||
//major unknown
|
||||
|
|
@ -660,9 +663,9 @@ bool gen_block_wrong_version_agains_hardfork::c1(currency::core& c, size_t ev_in
|
|||
CHECK_TEST_CONDITION(r);
|
||||
|
||||
//between 1 and 2 hardforks
|
||||
pc.hard_fork_01_starts_after_height = 1;
|
||||
pc.hard_fork_02_starts_after_height = 1;
|
||||
pc.hard_fork_03_starts_after_height = 1;
|
||||
pc.hard_forks.hard_fork_01_starts_after_height = 1;
|
||||
pc.hard_forks.hard_fork_02_starts_after_height = 1;
|
||||
pc.hard_forks.hard_fork_03_starts_after_height = 1;
|
||||
c.get_blockchain_storage().set_core_runtime_config(pc);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ class gen_block_verification_base : public test_chain_unit_base
|
|||
public:
|
||||
gen_block_verification_base()
|
||||
{
|
||||
m_hardforks.hard_fork_01_starts_after_height = 0;
|
||||
m_hardforks.hard_fork_02_starts_after_height = 0;
|
||||
m_hardforks.hard_fork_03_starts_after_height = 0;
|
||||
m_hardforks.hard_fork_04_starts_after_height = 0;
|
||||
|
||||
REGISTER_CALLBACK("check_block_purged", gen_block_verification_base<invalid_block_idx>::check_block_purged);
|
||||
}
|
||||
|
||||
|
|
@ -33,6 +38,7 @@ public:
|
|||
|
||||
return true;
|
||||
}
|
||||
currency::hard_forks_descriptor m_hardforks;
|
||||
};
|
||||
|
||||
template<size_t expected_blockchain_height>
|
||||
|
|
|
|||
|
|
@ -521,7 +521,8 @@ bool alt_blocks_validation_and_same_new_amount_in_two_txs::generate(std::vector<
|
|||
std::vector<tx_destination_entry> destinations;
|
||||
destinations.push_back(tx_destination_entry(new_amount, miner_acc.get_public_address())); // no cashback, just payment
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
|
||||
uint64_t tx_version = get_tx_version(get_block_height(blk_3), m_hardforks);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, tx_version, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -531,7 +532,8 @@ bool alt_blocks_validation_and_same_new_amount_in_two_txs::generate(std::vector<
|
|||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
// use the same destinations
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_2, 0);
|
||||
tx_version = get_tx_version(get_block_height(blk_3), m_hardforks);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_2, tx_version, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_2);
|
||||
|
||||
|
|
@ -644,7 +646,7 @@ bool chain_switching_when_out_spent_in_alt_chain_mixin::generate(std::vector<tes
|
|||
|
||||
// send batch of 10 x 5 test coins to Alice for easier tx_1 construction (and to generate free decoys)
|
||||
transaction tx_0;
|
||||
r = construct_tx_with_many_outputs(events, blk_1r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(50), 10,
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_1r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(50), 10,
|
||||
TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
|
@ -711,7 +713,7 @@ bool chain_switching_when_out_spent_in_alt_chain_ref_id::generate(std::vector<te
|
|||
|
||||
// send batch of 10 x 5 test coins to Alice for easier tx_0 construction
|
||||
transaction tx_0;
|
||||
r = construct_tx_with_many_outputs(events, blk_1r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(50), 10,
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_1r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(50), 10,
|
||||
TESTS_DEFAULT_FEE, tx_0, true);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
|
||||
|
|
@ -737,7 +739,7 @@ bool chain_switching_when_out_spent_in_alt_chain_ref_id::generate(std::vector<te
|
|||
std::vector<tx_destination_entry> destinations;
|
||||
destinations.push_back(tx_destination_entry(MK_TEST_COINS(4), bob_acc.get_public_address()));
|
||||
size_t nmix = 3;
|
||||
r = construct_tx_to_key(events, tx_1, blk_2a, alice_acc, destinations, TESTS_DEFAULT_FEE, nmix, 0, empty_extra, empty_attachment, true, true, true);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_1, blk_2a, alice_acc, destinations, TESTS_DEFAULT_FEE, nmix, 0, empty_extra, empty_attachment, true, true, true);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_to_key failed");
|
||||
|
||||
// make sure tx_1 really use ref_by_id
|
||||
|
|
|
|||
|
|
@ -52,19 +52,27 @@ test_generator::test_generator()
|
|||
, m_do_pos_to_low_timestamp(false)
|
||||
, m_ignore_last_pow_in_wallets(false)
|
||||
, m_last_found_timestamp(0)
|
||||
, m_hardfork_01_after_heigh(CURRENCY_MAX_BLOCK_NUMBER)
|
||||
, m_hardfork_02_after_heigh(CURRENCY_MAX_BLOCK_NUMBER)
|
||||
, m_hardfork_03_after_heigh(CURRENCY_MAX_BLOCK_NUMBER)
|
||||
{
|
||||
m_hardforks.hard_fork_01_starts_after_height = CURRENCY_MAX_BLOCK_NUMBER;
|
||||
m_hardforks.hard_fork_02_starts_after_height = CURRENCY_MAX_BLOCK_NUMBER;
|
||||
m_hardforks.hard_fork_03_starts_after_height = CURRENCY_MAX_BLOCK_NUMBER;
|
||||
m_hardforks.hard_fork_04_starts_after_height = CURRENCY_MAX_BLOCK_NUMBER;
|
||||
}
|
||||
|
||||
|
||||
void test_generator::set_hardforks(const currency::hard_forks_descriptor& hardforks)
|
||||
{
|
||||
m_hardforks = hardforks;
|
||||
}
|
||||
|
||||
void test_generator::set_hardfork_height(size_t hardfork_id, uint64_t h)
|
||||
{
|
||||
switch (hardfork_id)
|
||||
{
|
||||
case 1: m_hardfork_01_after_heigh = h; break;
|
||||
case 2: m_hardfork_02_after_heigh = h; break;
|
||||
case 3: m_hardfork_03_after_heigh = h; break;
|
||||
case 1: m_hardforks.hard_fork_01_starts_after_height = h; break;
|
||||
case 2: m_hardforks.hard_fork_02_starts_after_height = h; break;
|
||||
case 3: m_hardforks.hard_fork_03_starts_after_height = h; break;
|
||||
case 4: m_hardforks.hard_fork_04_starts_after_height = h; break;
|
||||
default: CHECK_AND_ASSERT_THROW_MES(false, "invalid hardfork id: " << hardfork_id)
|
||||
}
|
||||
}
|
||||
|
|
@ -224,9 +232,9 @@ bool test_generator::construct_block(currency::block& blk,
|
|||
// else
|
||||
// blk.major_version = BLOCK_MAJOR_VERSION_INITIAL;
|
||||
|
||||
if (height <= m_hardfork_01_after_heigh)
|
||||
if (height <= m_hardforks.hard_fork_01_starts_after_height)
|
||||
blk.major_version = BLOCK_MAJOR_VERSION_INITIAL;
|
||||
else if (height <= m_hardfork_03_after_heigh)
|
||||
else if (height <= m_hardforks.hard_fork_03_starts_after_height)
|
||||
blk.major_version = HF1_BLOCK_MAJOR_VERSION;
|
||||
else
|
||||
blk.major_version = CURRENT_BLOCK_MAJOR_VERSION;
|
||||
|
|
@ -296,6 +304,7 @@ bool test_generator::construct_block(currency::block& blk,
|
|||
miner_acc.get_keys().account_address,
|
||||
miner_acc.get_keys().account_address,
|
||||
blk.miner_tx,
|
||||
get_tx_version(height, m_hardforks),
|
||||
blobdata(),
|
||||
test_generator::get_test_gentime_settings().miner_tx_max_outs,
|
||||
static_cast<bool>(coin_stake_sources.size()),
|
||||
|
|
@ -429,9 +438,7 @@ bool test_generator::build_wallets(const blockchain_vector& blocks,
|
|||
currency::core_runtime_config pc = cc;
|
||||
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_01_after_heigh;
|
||||
pc.hard_fork_02_starts_after_height = m_hardfork_02_after_heigh;
|
||||
pc.hard_fork_03_starts_after_height = m_hardfork_03_after_heigh;
|
||||
pc.hard_forks = m_hardforks;
|
||||
wallets.back()->set_core_runtime_config(pc);
|
||||
}
|
||||
|
||||
|
|
@ -516,7 +523,7 @@ bool test_generator::find_kernel(const std::list<currency::account_base>& accs,
|
|||
uint64_t& found_timestamp,
|
||||
crypto::hash& found_kh)
|
||||
{
|
||||
bool is_after_hardfork_01 = blck_chain.size() > m_hardfork_01_after_heigh ? true : false;
|
||||
bool is_after_hardfork_01 = blck_chain.size() > m_hardforks.hard_fork_01_starts_after_height ? true : false;
|
||||
uint64_t median_timestamp = get_timestamps_median(blck_chain);
|
||||
wide_difficulty_type basic_diff = 0;
|
||||
|
||||
|
|
@ -891,7 +898,7 @@ bool test_generator::construct_block(int64_t manual_timestamp_adjustment,
|
|||
{
|
||||
size_t current_block_size = txs_sizes + get_object_blobsize(blk.miner_tx);
|
||||
// TODO: This will work, until size of constructed block is less then CURRENCY_BLOCK_GRANTED_FULL_REWARD_ZONE
|
||||
if (!construct_miner_tx(height, misc_utils::median(block_sizes), already_generated_coins, current_block_size, 0, miner_acc.get_public_address(), miner_acc.get_public_address(), blk.miner_tx, blobdata(), 1))
|
||||
if (!construct_miner_tx(height, misc_utils::median(block_sizes), already_generated_coins, current_block_size, 0, miner_acc.get_public_address(), miner_acc.get_public_address(), blk.miner_tx, get_tx_version(height, m_hardforks), blobdata(), 1))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1456,14 +1463,15 @@ bool construct_miner_tx_manually(size_t height, uint64_t already_generated_coins
|
|||
out.target = txout_to_key(out_eph_public_key);
|
||||
tx.vout.push_back(out);
|
||||
|
||||
tx.version = CURRENT_TRANSACTION_VERSION;
|
||||
tx.version = TRANSACTION_VERSION_PRE_HF4;
|
||||
currency::set_tx_unlock_time(tx, height + CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
||||
bool construct_tx_to_key(const currency::hard_forks_descriptor& hf,
|
||||
const std::vector<test_event_entry>& events,
|
||||
currency::transaction& tx,
|
||||
const block& blk_head,
|
||||
const currency::account_base& from,
|
||||
|
|
@ -1478,8 +1486,9 @@ bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
|||
bool check_for_unlocktime)
|
||||
{
|
||||
crypto::secret_key sk = AUTO_VAL_INIT(sk);
|
||||
return construct_tx_to_key(events,
|
||||
tx,
|
||||
return construct_tx_to_key(hf,
|
||||
events,
|
||||
tx,
|
||||
blk_head,
|
||||
from,
|
||||
to,
|
||||
|
|
@ -1494,7 +1503,8 @@ bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
|||
check_for_unlocktime);
|
||||
}
|
||||
|
||||
bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
||||
bool construct_tx_to_key(const currency::hard_forks_descriptor& hf,
|
||||
const std::vector<test_event_entry>& events,
|
||||
currency::transaction& tx,
|
||||
const block& blk_head,
|
||||
const currency::account_base& from,
|
||||
|
|
@ -1513,10 +1523,12 @@ bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
|||
std::vector<tx_destination_entry> destinations;
|
||||
if (!fill_tx_sources_and_destinations(events, blk_head, from.get_keys(), to.get_public_address(), amount, fee, nmix, sources, destinations, check_for_spends, check_for_unlocktime))
|
||||
return false;
|
||||
return construct_tx(from.get_keys(), sources, destinations, extr, att, tx, sk, 0, mix_attr);
|
||||
uint64_t tx_version = currency::get_tx_version(get_block_height(blk_head), hf);
|
||||
return construct_tx(from.get_keys(), sources, destinations, extr, att, tx, tx_version, sk, 0, mix_attr);
|
||||
}
|
||||
|
||||
bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
||||
bool construct_tx_to_key(const currency::hard_forks_descriptor& hf,
|
||||
const std::vector<test_event_entry>& events,
|
||||
currency::transaction& tx,
|
||||
const currency::block& blk_head,
|
||||
const currency::account_base& from,
|
||||
|
|
@ -1539,28 +1551,29 @@ bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
|||
if (!fill_tx_sources(sources, events, blk_head, from.get_keys(), spending_amount, nmix, check_for_spends, check_for_unlocktime, use_ref_by_id))
|
||||
return false;
|
||||
|
||||
uint64_t tx_version = currency::get_tx_version(get_block_height(blk_head), hf);
|
||||
boost::multiprecision::int128_t change = get_sources_total_amount(sources);
|
||||
change -= spending_amount;
|
||||
if (change < 0)
|
||||
return false; // should never happen if fill_tx_sources succeded
|
||||
if (change == 0)
|
||||
return construct_tx(from.get_keys(), sources, destinations, extr, att, tx, sk, 0, mix_attr);
|
||||
return construct_tx(from.get_keys(), sources, destinations, extr, att, tx, tx_version, sk, 0, mix_attr);
|
||||
std::vector<tx_destination_entry> local_dst = destinations;
|
||||
local_dst.push_back(tx_destination_entry(change.convert_to<uint64_t>(), from.get_public_address()));
|
||||
return construct_tx(from.get_keys(), sources, local_dst, extr, att, tx, sk, 0, mix_attr);
|
||||
return construct_tx(from.get_keys(), sources, local_dst, extr, att, tx, tx_version, sk, 0, mix_attr);
|
||||
}
|
||||
|
||||
|
||||
transaction construct_tx_with_fee(std::vector<test_event_entry>& events, const block& blk_head,
|
||||
transaction construct_tx_with_fee(const currency::hard_forks_descriptor& hf, std::vector<test_event_entry>& events, const block& blk_head,
|
||||
const account_base& acc_from, const account_base& acc_to, uint64_t amount, uint64_t fee)
|
||||
{
|
||||
transaction tx;
|
||||
construct_tx_to_key(events, tx, blk_head, acc_from, acc_to, amount, fee, 0);
|
||||
construct_tx_to_key(hf, events, tx, blk_head, acc_from, acc_to, amount, fee, 0);
|
||||
events.push_back(tx);
|
||||
return tx;
|
||||
}
|
||||
|
||||
bool construct_tx_with_many_outputs(std::vector<test_event_entry>& events, const currency::block& blk_head,
|
||||
bool construct_tx_with_many_outputs(const currency::hard_forks_descriptor& hf, std::vector<test_event_entry>& events, const currency::block& blk_head,
|
||||
const currency::account_keys& keys_from, const currency::account_public_address& addr_to,
|
||||
uint64_t total_amount, size_t outputs_count, uint64_t fee, currency::transaction& tx, bool use_ref_by_id /* = false */)
|
||||
{
|
||||
|
|
@ -1576,8 +1589,8 @@ bool construct_tx_with_many_outputs(std::vector<test_event_entry>& events, const
|
|||
uint64_t sources_amount = get_sources_total_amount(sources);
|
||||
if (sources_amount > total_amount + fee)
|
||||
destinations.push_back(tx_destination_entry(sources_amount - (total_amount + fee), keys_from.account_address)); // change
|
||||
|
||||
return construct_tx(keys_from, sources, destinations, empty_attachment, tx, 0);
|
||||
uint64_t tx_version = currency::get_tx_version(currency::get_block_height(blk_head), hf);
|
||||
return construct_tx(keys_from, sources, destinations, empty_attachment, tx, tx_version, 0);
|
||||
}
|
||||
|
||||
uint64_t get_balance(const currency::account_keys& addr, const std::vector<currency::block>& blockchain, const map_hash2tx_t& mtx, bool dbg_log) {
|
||||
|
|
@ -2080,6 +2093,19 @@ void test_chain_unit_base::register_callback(const std::string& cb_name, verify_
|
|||
m_callbacks[cb_name] = cb;
|
||||
}
|
||||
|
||||
uint64_t test_chain_unit_base::get_tx_version_from_events(const std::vector<test_event_entry> &events)const
|
||||
{
|
||||
for (auto it = events.rbegin(); it!= events.rend(); it++)
|
||||
{
|
||||
if(it->type() == typeid(currency::block))
|
||||
{
|
||||
const currency::block& b = boost::get<currency::block>(*it);
|
||||
return currency::get_tx_version(get_block_height(b), m_hardforks);
|
||||
}
|
||||
}
|
||||
return currency::get_tx_version(0, m_hardforks);
|
||||
}
|
||||
|
||||
bool test_chain_unit_base::verify(const std::string& cb_name, currency::core& c, size_t ev_index, const std::vector<test_event_entry> &events)
|
||||
{
|
||||
auto cb_it = m_callbacks.find(cb_name);
|
||||
|
|
@ -2098,10 +2124,13 @@ test_chain_unit_enchanced::test_chain_unit_enchanced()
|
|||
, m_orphan_block_index(std::numeric_limits<size_t>::max())
|
||||
, m_invalid_tx_index(std::numeric_limits<size_t>::max())
|
||||
, m_unverifiable_tx_index(std::numeric_limits<size_t>::max())
|
||||
, m_hardfork_01_height(CURRENCY_MAX_BLOCK_NUMBER)
|
||||
, m_hardfork_02_height(CURRENCY_MAX_BLOCK_NUMBER)
|
||||
, m_hardfork_03_height(CURRENCY_MAX_BLOCK_NUMBER)
|
||||
{
|
||||
m_hardforks.hard_fork_01_starts_after_height = CURRENCY_MAX_BLOCK_NUMBER;
|
||||
m_hardforks.hard_fork_01_starts_after_height = CURRENCY_MAX_BLOCK_NUMBER;
|
||||
m_hardforks.hard_fork_01_starts_after_height = CURRENCY_MAX_BLOCK_NUMBER;
|
||||
m_hardforks.hard_fork_01_starts_after_height = CURRENCY_MAX_BLOCK_NUMBER;
|
||||
|
||||
|
||||
REGISTER_CALLBACK_METHOD(test_chain_unit_enchanced, configure_core);
|
||||
REGISTER_CALLBACK_METHOD(test_chain_unit_enchanced, mark_invalid_tx);
|
||||
REGISTER_CALLBACK_METHOD(test_chain_unit_enchanced, mark_unverifiable_tx);
|
||||
|
|
@ -2122,19 +2151,14 @@ bool test_chain_unit_enchanced::configure_core(currency::core& c, size_t ev_inde
|
|||
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_01_height;
|
||||
pc.hard_fork_02_starts_after_height = m_hardfork_02_height;
|
||||
pc.hard_fork_03_starts_after_height = m_hardfork_03_height;
|
||||
|
||||
pc.hard_forks = m_hardforks;
|
||||
c.get_blockchain_storage().set_core_runtime_config(pc);
|
||||
return true;
|
||||
}
|
||||
|
||||
void test_chain_unit_enchanced::set_hard_fork_heights_to_generator(test_generator& generator) const
|
||||
{
|
||||
generator.set_hardfork_height(1, m_hardfork_01_height);
|
||||
generator.set_hardfork_height(2, m_hardfork_02_height);
|
||||
generator.set_hardfork_height(3, m_hardfork_03_height);
|
||||
generator.set_hardforks(m_hardforks);
|
||||
}
|
||||
|
||||
bool test_chain_unit_enchanced::check_top_block(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
|
||||
|
|
|
|||
|
|
@ -234,9 +234,11 @@ public:
|
|||
|
||||
bool need_core_proxy() const { return false; } // tests can override this in order to obtain core proxy (e.g. for wallet)
|
||||
void set_core_proxy(std::shared_ptr<tools::i_core_proxy>) { /* do nothing */ }
|
||||
|
||||
uint64_t get_tx_version_from_events(const std::vector<test_event_entry> &events) const;
|
||||
private:
|
||||
callbacks_map m_callbacks;
|
||||
protected:
|
||||
currency::hard_forks_descriptor m_hardforks;
|
||||
};
|
||||
|
||||
struct offers_count_param
|
||||
|
|
@ -310,6 +312,8 @@ public:
|
|||
bool check_offers_count(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
|
||||
bool check_hardfork_active(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
struct params_top_block
|
||||
{
|
||||
|
|
@ -324,9 +328,7 @@ protected:
|
|||
size_t m_orphan_block_index;
|
||||
|
||||
// the following members is intended to be set by coretests with specific HF-related needs
|
||||
uint64_t m_hardfork_01_height;
|
||||
uint64_t m_hardfork_02_height;
|
||||
uint64_t m_hardfork_03_height;
|
||||
//currency::hard_forks_descriptor m_hardforks;
|
||||
};
|
||||
|
||||
struct wallet_test_core_proxy;
|
||||
|
|
@ -530,15 +532,14 @@ public:
|
|||
void set_pos_to_low_timestamp(bool do_pos_to_low_timestamp) { m_do_pos_to_low_timestamp = do_pos_to_low_timestamp; }
|
||||
void set_ignore_last_pow_in_wallets(bool ignore_last_pow_in_wallets) { m_ignore_last_pow_in_wallets = ignore_last_pow_in_wallets; }
|
||||
void set_hardfork_height(size_t hardfork_id, uint64_t h);
|
||||
void set_hardforks(const currency::hard_forks_descriptor& hardforks);
|
||||
|
||||
private:
|
||||
bool m_do_pos_to_low_timestamp;
|
||||
bool m_ignore_last_pow_in_wallets;
|
||||
uint64_t m_last_found_timestamp;
|
||||
|
||||
uint64_t m_hardfork_01_after_heigh;
|
||||
uint64_t m_hardfork_02_after_heigh;
|
||||
uint64_t m_hardfork_03_after_heigh;
|
||||
currency::hard_forks_descriptor m_hardforks;
|
||||
|
||||
std::unordered_map<crypto::hash, block_info> m_blocks_info;
|
||||
static test_gentime_settings m_test_gentime_settings;
|
||||
|
|
@ -556,7 +557,8 @@ bool construct_miner_tx_manually(size_t height, uint64_t already_generated_coins
|
|||
const currency::account_public_address& miner_address, currency::transaction& tx,
|
||||
uint64_t fee, currency::keypair* p_txkey = 0);
|
||||
|
||||
bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
||||
bool construct_tx_to_key(const currency::hard_forks_descriptor& hf,
|
||||
const std::vector<test_event_entry>& events,
|
||||
currency::transaction& tx,
|
||||
const currency::block& blk_head,
|
||||
const currency::account_base& from,
|
||||
|
|
@ -571,7 +573,8 @@ bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
|||
bool check_for_unlocktime = true);
|
||||
|
||||
|
||||
bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
||||
bool construct_tx_to_key(const currency::hard_forks_descriptor& hf,
|
||||
const std::vector<test_event_entry>& events,
|
||||
currency::transaction& tx,
|
||||
const currency::block& blk_head,
|
||||
const currency::account_base& from,
|
||||
|
|
@ -586,7 +589,8 @@ bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
|||
bool check_for_spends = true,
|
||||
bool check_for_unlocktime = true);
|
||||
|
||||
bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
||||
bool construct_tx_to_key(const currency::hard_forks_descriptor& hf,
|
||||
const std::vector<test_event_entry>& events,
|
||||
currency::transaction& tx,
|
||||
const currency::block& blk_head,
|
||||
const currency::account_base& from,
|
||||
|
|
@ -600,11 +604,11 @@ bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
|||
bool check_for_unlocktime = true,
|
||||
bool use_ref_by_id = false);
|
||||
|
||||
currency::transaction construct_tx_with_fee(std::vector<test_event_entry>& events, const currency::block& blk_head,
|
||||
currency::transaction construct_tx_with_fee(const currency::hard_forks_descriptor& hf, std::vector<test_event_entry>& events, const currency::block& blk_head,
|
||||
const currency::account_base& acc_from, const currency::account_base& acc_to,
|
||||
uint64_t amount, uint64_t fee);
|
||||
|
||||
bool construct_tx_with_many_outputs(std::vector<test_event_entry>& events, const currency::block& blk_head,
|
||||
bool construct_tx_with_many_outputs(const currency::hard_forks_descriptor& hf, std::vector<test_event_entry>& events, const currency::block& blk_head,
|
||||
const currency::account_keys& keys_from, const currency::account_public_address& addr_to,
|
||||
uint64_t total_amount, size_t outputs_count, uint64_t fee, currency::transaction& tx, bool use_ref_by_id = false);
|
||||
|
||||
|
|
@ -742,7 +746,7 @@ bool construct_broken_tx(const currency::account_keys& sender_account_keys, cons
|
|||
tx.signatures.clear();
|
||||
tx.extra = extra;
|
||||
|
||||
tx.version = CURRENT_TRANSACTION_VERSION;
|
||||
tx.version = TRANSACTION_VERSION_PRE_HF4;
|
||||
set_tx_unlock_time(tx, unlock_time);
|
||||
|
||||
currency::keypair txkey = currency::keypair::generate();
|
||||
|
|
@ -888,7 +892,7 @@ bool test_generator::construct_block_gentime_with_coinbase_cb(const currency::bl
|
|||
size_t height = get_block_height(prev_block) + 1;
|
||||
//size_t current_block_size = get_object_blobsize(miner_tx);
|
||||
|
||||
r = construct_miner_tx(height, epee::misc_utils::median(block_sizes), already_generated_coins, 0 /* current_block_size !HACK! */, 0, acc.get_public_address(), acc.get_public_address(), miner_tx, currency::blobdata(), 1);
|
||||
r = construct_miner_tx(height, epee::misc_utils::median(block_sizes), already_generated_coins, 0 /* current_block_size !HACK! */, 0, acc.get_public_address(), acc.get_public_address(), miner_tx, get_tx_version(height, m_hardforks), currency::blobdata(), 1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_miner_tx failed");
|
||||
|
||||
if (!cb(miner_tx))
|
||||
|
|
@ -1096,7 +1100,7 @@ void append_vector_by_another_vector(U& dst, const V& src)
|
|||
#define MAKE_TX_MIX_ATTR_EXTRA(VEC_EVENTS, TX_NAME, FROM, TO, AMOUNT, NMIX, HEAD, MIX_ATTR, EXTRA, CHECK_SPENDS) \
|
||||
currency::transaction TX_NAME; \
|
||||
{ \
|
||||
bool txr = construct_tx_to_key(VEC_EVENTS, TX_NAME, HEAD, FROM, TO, AMOUNT, TESTS_DEFAULT_FEE, NMIX, generator.last_tx_generated_secret_key, MIX_ATTR, EXTRA, std::vector<currency::attachment_v>(), CHECK_SPENDS); \
|
||||
bool txr = construct_tx_to_key(m_hardforks, VEC_EVENTS, TX_NAME, HEAD, FROM, TO, AMOUNT, TESTS_DEFAULT_FEE, NMIX, generator.last_tx_generated_secret_key, MIX_ATTR, EXTRA, std::vector<currency::attachment_v>(), CHECK_SPENDS); \
|
||||
CHECK_AND_ASSERT_THROW_MES(txr, "failed to construct transaction"); \
|
||||
} \
|
||||
VEC_EVENTS.push_back(TX_NAME); \
|
||||
|
|
@ -1105,7 +1109,7 @@ void append_vector_by_another_vector(U& dst, const V& src)
|
|||
#define MAKE_TX_FEE_MIX_ATTR_EXTRA(VEC_EVENTS, TX_NAME, FROM, TO, AMOUNT, FEE, NMIX, HEAD, MIX_ATTR, EXTRA, CHECK_SPENDS) \
|
||||
currency::transaction TX_NAME; \
|
||||
{ \
|
||||
bool txr = construct_tx_to_key(VEC_EVENTS, TX_NAME, HEAD, FROM, TO, AMOUNT, FEE, NMIX, generator.last_tx_generated_secret_key, MIX_ATTR, EXTRA, std::vector<currency::attachment_v>(), CHECK_SPENDS); \
|
||||
bool txr = construct_tx_to_key(m_hardforks, VEC_EVENTS, TX_NAME, HEAD, FROM, TO, AMOUNT, FEE, NMIX, generator.last_tx_generated_secret_key, MIX_ATTR, EXTRA, std::vector<currency::attachment_v>(), CHECK_SPENDS); \
|
||||
CHECK_AND_ASSERT_THROW_MES(txr, "failed to construct transaction"); \
|
||||
} \
|
||||
VEC_EVENTS.push_back(TX_NAME); \
|
||||
|
|
@ -1129,7 +1133,7 @@ void append_vector_by_another_vector(U& dst, const V& src)
|
|||
#define MAKE_TX_MIX_LIST_EXTRA_MIX_ATTR(VEC_EVENTS, SET_NAME, FROM, TO, AMOUNT, NMIX, HEAD, MIX_ATTR, EXTRA, ATTACH) \
|
||||
{ \
|
||||
currency::transaction t; \
|
||||
bool r = construct_tx_to_key(VEC_EVENTS, t, HEAD, FROM, TO, AMOUNT, TESTS_DEFAULT_FEE, NMIX, generator.last_tx_generated_secret_key, MIX_ATTR, EXTRA, ATTACH); \
|
||||
bool r = construct_tx_to_key(m_hardforks, VEC_EVENTS, t, HEAD, FROM, TO, AMOUNT, TESTS_DEFAULT_FEE, NMIX, generator.last_tx_generated_secret_key, MIX_ATTR, EXTRA, ATTACH); \
|
||||
if (!r) { LOG_PRINT_YELLOW("ERROR in tx @ EVENT #" << VEC_EVENTS.size(), LOG_LEVEL_0); } \
|
||||
CHECK_AND_ASSERT_THROW_MES(r, "failed to construct transaction"); \
|
||||
SET_NAME.push_back(t); \
|
||||
|
|
@ -1160,7 +1164,7 @@ void append_vector_by_another_vector(U& dst, const V& src)
|
|||
|
||||
#define MAKE_TX_ATTACH_FEE(EVENTS, TX_VAR, FROM, TO, AMOUNT, FEE, HEAD, ATTACH) \
|
||||
currency::transaction TX_VAR = AUTO_VAL_INIT(TX_VAR); \
|
||||
CHECK_AND_ASSERT_MES(construct_tx_to_key(EVENTS, TX_VAR, HEAD, FROM, TO, AMOUNT, FEE, 0, generator.last_tx_generated_secret_key, CURRENCY_TO_KEY_OUT_RELAXED, empty_extra, ATTACH), false, "construct_tx_to_key failed"); \
|
||||
CHECK_AND_ASSERT_MES(construct_tx_to_key(m_hardforks, EVENTS, TX_VAR, HEAD, FROM, TO, AMOUNT, FEE, 0, generator.last_tx_generated_secret_key, CURRENCY_TO_KEY_OUT_RELAXED, empty_extra, ATTACH), false, "construct_tx_to_key failed"); \
|
||||
EVENTS.push_back(TX_VAR)
|
||||
|
||||
#define MAKE_TX_ATTACH(EVENTS, TX_VAR, FROM, TO, AMOUNT, HEAD, ATTACH) MAKE_TX_ATTACH_FEE(EVENTS, TX_VAR, FROM, TO, AMOUNT, TESTS_DEFAULT_FEE, HEAD, ATTACH)
|
||||
|
|
|
|||
|
|
@ -281,13 +281,15 @@ inline std::string gen_random_alias(size_t len)
|
|||
}
|
||||
|
||||
template<typename alias_entry_t>
|
||||
inline bool put_alias_via_tx_to_list(std::vector<test_event_entry>& events,
|
||||
inline bool put_alias_via_tx_to_list(const currency::hard_forks_descriptor& hf,
|
||||
std::vector<test_event_entry>& events,
|
||||
std::list<currency::transaction>& tx_set,
|
||||
const currency::block& head_block,
|
||||
const currency::account_base& miner_acc,
|
||||
const alias_entry_t& ae,
|
||||
test_generator& generator)
|
||||
{
|
||||
const currency::hard_forks_descriptor& m_hardforks = hf; //a name to feed macro MAKE_TX_MIX_LIST_EXTRA_MIX_ATTR
|
||||
std::vector<currency::extra_v> ex;
|
||||
ex.push_back(ae);
|
||||
currency::account_base reward_acc;
|
||||
|
|
|
|||
|
|
@ -628,6 +628,8 @@ gen_no_attchments_in_coinbase::gen_no_attchments_in_coinbase()
|
|||
|
||||
REGISTER_CALLBACK_METHOD(gen_no_attchments_in_coinbase, c1);
|
||||
REGISTER_CALLBACK_METHOD(gen_no_attchments_in_coinbase, init_config_set_cp);
|
||||
|
||||
m_hardforks.hard_fork_04_starts_after_height = UINT64_MAX;
|
||||
}
|
||||
|
||||
bool gen_no_attchments_in_coinbase::generate(std::vector<test_event_entry>& events) const
|
||||
|
|
@ -871,7 +873,7 @@ bool gen_checkpoints_and_invalid_tx_to_pool::generate(std::vector<test_event_ent
|
|||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
// invalidate tx_0 signature
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ bool gen_double_spend_in_tx<txs_kept_by_block>::generate(std::vector<test_event_
|
|||
|
||||
currency::transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
std::vector<currency::attachment_v> attachments;
|
||||
if (!construct_tx(bob_account.get_keys(), sources, destinations, attachments, tx_1, 0))
|
||||
if (!construct_tx(bob_account.get_keys(), sources, destinations, attachments, tx_1, get_tx_version_from_events(events), uint64_t(0)))
|
||||
return false;
|
||||
|
||||
SET_EVENT_VISITOR_SETT(events, event_visitor_settings::set_txs_kept_by_block, txs_kept_by_block);
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ bool pos_emission_test::generate(std::vector<test_event_entry> &events)
|
|||
destinations.push_back(tx_destination_entry(pos_entry_amount, alice_acc.get_public_address()));
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(preminer_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
|
||||
r = construct_tx(preminer_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_1);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_1);
|
||||
|
|
|
|||
|
|
@ -64,13 +64,13 @@ bool escrow_altchain_meta_impl::generate(std::vector<test_event_entry>& events)
|
|||
|
||||
// give Alice and Bob 'm_etd.alice_bob_start_amoun' coins for pocket money
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), m_etd.alice_bob_start_amount, m_etd.start_amount_outs_count, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), m_etd.alice_bob_start_amount, m_etd.start_amount_outs_count, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_1);
|
||||
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
r = construct_tx_with_many_outputs(events, blk_1, miner_acc.get_keys(), bob_acc.get_public_address(), m_etd.alice_bob_start_amount, m_etd.start_amount_outs_count, TESTS_DEFAULT_FEE, tx_2);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_1, miner_acc.get_keys(), bob_acc.get_public_address(), m_etd.alice_bob_start_amount, m_etd.start_amount_outs_count, TESTS_DEFAULT_FEE, tx_2);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_2);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1, miner_acc, tx_2);
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@ enum escrow_custom_config_field
|
|||
inline bool build_custom_escrow_template(const std::vector<test_event_entry>& events, const block& head, const account_keys& a_keys,
|
||||
bc_services::contract_private_details& cpd, uint64_t unlock_time, uint64_t expiration_time, size_t nmix, uint64_t b_fee_release,
|
||||
uint64_t custom_config_mask,
|
||||
uint64_t tx_version,
|
||||
transaction& escrow_template_tx, /* OUT */
|
||||
crypto::secret_key& tx_key_sec, /* OUT */
|
||||
std::vector<tx_source_entry>& used_sources /* IN/OUT */)
|
||||
|
|
@ -230,7 +231,7 @@ inline bool build_custom_escrow_template(const std::vector<test_event_entry>& ev
|
|||
if (custom_config_mask & eccf_template_additional_attach)
|
||||
attachments.push_back(tx_comment({ get_random_text(1024) }));
|
||||
|
||||
r = construct_tx(a_keys, sources, destinations, extra, attachments, escrow_template_tx, tx_key_sec, unlock_time, crypt_addr, expiration_time, CURRENCY_TO_KEY_OUT_RELAXED, true, flags);
|
||||
r = construct_tx(a_keys, sources, destinations, extra, attachments, escrow_template_tx, tx_version, tx_key_sec, unlock_time, crypt_addr, expiration_time, CURRENCY_TO_KEY_OUT_RELAXED, true, flags);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
if (custom_config_mask & eccf_template_no_tx_flags)
|
||||
|
|
@ -264,6 +265,7 @@ inline bool build_custom_escrow_proposal(const std::vector<test_event_entry>& ev
|
|||
bc_services::contract_private_details& cpd, uint64_t unlock_time, uint64_t expiration_time, uint64_t template_unlock_time, uint64_t template_expiration_time, size_t nmix,
|
||||
uint64_t a_fee_proposal, uint64_t b_fee_release,
|
||||
uint64_t custom_config_mask,
|
||||
uint64_t tx_version,
|
||||
transaction& escrow_proposal_tx, /* OUT */
|
||||
std::vector<tx_source_entry>& used_sources,/* IN/OUT */
|
||||
bc_services::proposal_body* p_pb = nullptr /* OUT */ )
|
||||
|
|
@ -281,7 +283,7 @@ inline bool build_custom_escrow_proposal(const std::vector<test_event_entry>& ev
|
|||
p_pb = &local_pb;
|
||||
if (~custom_config_mask & eccf_proposal_sa_empty_body)
|
||||
{
|
||||
r = build_custom_escrow_template(events, head, a_keys, cpd, template_unlock_time, template_expiration_time, nmix, b_fee_release, custom_config_mask, p_pb->tx_template, p_pb->tx_onetime_secret_key, used_sources);
|
||||
r = build_custom_escrow_template(events, head, a_keys, cpd, template_unlock_time, template_expiration_time, nmix, b_fee_release, custom_config_mask, tx_version, p_pb->tx_template, p_pb->tx_onetime_secret_key, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_template failed");
|
||||
}
|
||||
|
||||
|
|
@ -307,7 +309,7 @@ inline bool build_custom_escrow_proposal(const std::vector<test_event_entry>& ev
|
|||
account_public_address crypt_addr = cpd.b_addr;
|
||||
|
||||
crypto::secret_key tx_key_sec; // stub, not used
|
||||
r = construct_tx(a_keys, sources, destinations, empty_extra, attachments, escrow_proposal_tx, tx_key_sec, unlock_time, crypt_addr, expiration_time, 0, true, (~custom_config_mask & eccf_proposal_inv_flags) ? 0 : TX_FLAG_SIGNATURE_MODE_SEPARATE);
|
||||
r = construct_tx(a_keys, sources, destinations, empty_extra, attachments, escrow_proposal_tx, tx_version, tx_key_sec, unlock_time, crypt_addr, expiration_time, 0, true, (~custom_config_mask & eccf_proposal_inv_flags) ? 0 : TX_FLAG_SIGNATURE_MODE_SEPARATE);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
append_vector_by_another_vector(used_sources, sources);
|
||||
|
|
@ -319,6 +321,7 @@ inline bool build_custom_escrow_release_template(
|
|||
const account_keys& b_keys,
|
||||
const bc_services::contract_private_details& cpd,
|
||||
uint64_t unlock_time, uint64_t expiration_time,
|
||||
uint64_t tx_version,
|
||||
const transaction& escrow_template_tx, /* IN (needed for ms output, tx pub key) */
|
||||
uint64_t custom_config_mask, /* IN */
|
||||
transaction& tx /* OUT */
|
||||
|
|
@ -417,7 +420,7 @@ inline bool build_custom_escrow_release_template(
|
|||
|
||||
crypto::secret_key one_time_secret_key = AUTO_VAL_INIT(one_time_secret_key);
|
||||
account_public_address crypt_address = AUTO_VAL_INIT(crypt_address);
|
||||
bool r = construct_tx(b_keys, sources, destinations, extra, attachments, tx, one_time_secret_key, unlock_time, crypt_address, expiration_time, 0, true, tx_flags);
|
||||
bool r = construct_tx(b_keys, sources, destinations, extra, attachments, tx, tx_version, one_time_secret_key, unlock_time, crypt_address, expiration_time, 0, true, tx_flags);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
bool tx_fully_signed = false;
|
||||
r = sign_multisig_input_in_tx(tx, 0, b_keys, escrow_template_tx, &tx_fully_signed);
|
||||
|
|
@ -466,6 +469,7 @@ inline bool build_custom_escrow_accept_proposal(
|
|||
uint64_t b_fee_accept, uint64_t b_fee_release,
|
||||
uint64_t custom_config_mask, /* IN */
|
||||
crypto::secret_key one_time_secret_key, /* IN */
|
||||
uint64_t tx_version, /* IN */
|
||||
transaction& tx, /* IN (escrow template), OUT */
|
||||
std::vector<tx_source_entry>& used_sources /* IN/OUT */
|
||||
)
|
||||
|
|
@ -492,9 +496,9 @@ inline bool build_custom_escrow_accept_proposal(
|
|||
|
||||
// generate release templates
|
||||
bc_services::escrow_relese_templates_body rtb = AUTO_VAL_INIT(rtb);
|
||||
r = build_custom_escrow_release_template(BC_ESCROW_SERVICE_INSTRUCTION_RELEASE_NORMAL, b_keys, cpd, release_unlock_time, release_expiration_time, tx, custom_config_mask, rtb.tx_normal_template);
|
||||
r = build_custom_escrow_release_template(BC_ESCROW_SERVICE_INSTRUCTION_RELEASE_NORMAL, b_keys, cpd, release_unlock_time, release_expiration_time, tx_version, tx, custom_config_mask, rtb.tx_normal_template);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_release_template(normal) failed");
|
||||
r = build_custom_escrow_release_template(BC_ESCROW_SERVICE_INSTRUCTION_RELEASE_BURN, b_keys, cpd, release_unlock_time, release_expiration_time, tx, custom_config_mask, rtb.tx_burn_template);
|
||||
r = build_custom_escrow_release_template(BC_ESCROW_SERVICE_INSTRUCTION_RELEASE_BURN, b_keys, cpd, release_unlock_time, release_expiration_time, tx_version, tx, custom_config_mask, rtb.tx_burn_template);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_release_template(burn) failed");
|
||||
|
||||
// put release templates into the extra
|
||||
|
|
@ -525,7 +529,7 @@ inline bool build_custom_escrow_accept_proposal(
|
|||
sources.back().separately_signed_tx_complete = true;
|
||||
|
||||
account_public_address crypt_address = AUTO_VAL_INIT(crypt_address);
|
||||
r = construct_tx(b_keys, sources, destinations, extra, attachments, tx, one_time_secret_key, 0, crypt_address, 0, 0, true, tx_flags); // see comment above regarding unlock_time and expiration_time
|
||||
r = construct_tx(b_keys, sources, destinations, extra, attachments, tx, tx_version, one_time_secret_key, 0, crypt_address, 0, 0, true, tx_flags); // see comment above regarding unlock_time and expiration_time
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
return true;
|
||||
|
|
@ -540,6 +544,7 @@ inline bool build_custom_escrow_cancel_proposal(
|
|||
uint64_t a_fee_cancellation_request,
|
||||
uint64_t custom_config_mask, /* IN */
|
||||
const transaction& escrow_template_tx, /* IN */
|
||||
uint64_t tx_version, /* IN */
|
||||
transaction& tx, /* OUT */
|
||||
std::vector<tx_source_entry>& used_sources /* IN/OUT */
|
||||
)
|
||||
|
|
@ -563,7 +568,7 @@ inline bool build_custom_escrow_cancel_proposal(
|
|||
|
||||
// generate cancel release template
|
||||
bc_services::escrow_cancel_templates_body ctb = AUTO_VAL_INIT(ctb);
|
||||
r = build_custom_escrow_release_template(BC_ESCROW_SERVICE_INSTRUCTION_RELEASE_CANCEL, a_keys, cpd, release_unlock_time, release_expiration_time, escrow_template_tx, custom_config_mask, ctb.tx_cancel_template);
|
||||
r = build_custom_escrow_release_template(BC_ESCROW_SERVICE_INSTRUCTION_RELEASE_CANCEL, a_keys, cpd, release_unlock_time, release_expiration_time, tx_version, escrow_template_tx, custom_config_mask, ctb.tx_cancel_template);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_release_template(cancel) failed");
|
||||
|
||||
// put release templates into the extra
|
||||
|
|
@ -588,7 +593,7 @@ inline bool build_custom_escrow_cancel_proposal(
|
|||
if (~custom_config_mask & eccf_cancellation_inv_crypt_address)
|
||||
crypt_address = cpd.b_addr;
|
||||
crypto::secret_key one_time_secret_key = AUTO_VAL_INIT(one_time_secret_key);
|
||||
r = construct_tx(a_keys, sources, destinations, extra, attachments, tx, one_time_secret_key, unlock_time, crypt_address, expiration_time, 0, true, tx_flags);
|
||||
r = construct_tx(a_keys, sources, destinations, extra, attachments, tx, tx_version, one_time_secret_key, unlock_time, crypt_address, expiration_time, 0, true, tx_flags);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -503,10 +503,10 @@ bool escrow_incorrect_proposal::generate(std::vector<test_event_entry>& events)
|
|||
|
||||
// 1. create normal proposal and make sure it goes correctly through out the whole mechanism (test self-check)
|
||||
// if it fails, it means build_custom_escrow_proposal() produced incorrect proposal
|
||||
|
||||
uint64_t tx_version = get_tx_version(get_block_height(blk_1r), m_hardforks);
|
||||
uint64_t normal_escrow_mask = eccf_proposal_additional_attach | eccf_template_additional_extra | eccf_template_additional_attach;
|
||||
transaction normal_escrow_proposal_tx = AUTO_VAL_INIT(normal_escrow_proposal_tx);
|
||||
r = build_custom_escrow_proposal(events, blk_1r, miner_acc.get_keys(), cpd, 0, 0, 0, blk_1r.timestamp + 3600, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, normal_escrow_mask, normal_escrow_proposal_tx, used_sources);
|
||||
r = build_custom_escrow_proposal(events, blk_1r, miner_acc.get_keys(), cpd, 0, 0, 0, blk_1r.timestamp + 3600, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, normal_escrow_mask, tx_version, normal_escrow_proposal_tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_proposal failed");
|
||||
|
||||
events.push_back(normal_escrow_proposal_tx);
|
||||
|
|
@ -550,8 +550,9 @@ bool escrow_incorrect_proposal::generate(std::vector<test_event_entry>& events)
|
|||
uint64_t config_mask = custom_config_masks[i].mask;
|
||||
cpd.comment = "#" + std::to_string(i) + " " + custom_config_masks[i].name;
|
||||
|
||||
tx_version = get_tx_version(get_block_height(top_block), m_hardforks);
|
||||
transaction escrow_proposal_tx = AUTO_VAL_INIT(escrow_proposal_tx);
|
||||
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, 0, 0, 0, top_block.timestamp + 3600, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, config_mask, escrow_proposal_tx, used_sources);
|
||||
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, 0, 0, 0, top_block.timestamp + 3600, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, config_mask, tx_version, escrow_proposal_tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_proposal failed");
|
||||
|
||||
LOG_PRINT_YELLOW("proposal tx: " << get_transaction_hash(escrow_proposal_tx) << " is built for mask: " << cpd.comment, LOG_LEVEL_0);
|
||||
|
|
@ -579,8 +580,9 @@ bool escrow_incorrect_proposal::generate(std::vector<test_event_entry>& events)
|
|||
{
|
||||
cpd.comment = "incorrect unlock time (past)";
|
||||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
tx_version = get_tx_version(get_block_height(top_block), m_hardforks);
|
||||
// set unlock time to the past (suppose it's incorrect for escrow proposals)
|
||||
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, top_block.timestamp, 0, top_block.timestamp, 0, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, eccf_normal, tx, used_sources);
|
||||
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, top_block.timestamp, 0, top_block.timestamp, 0, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, eccf_normal, tx_version, tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_proposal failed");
|
||||
LOG_PRINT_YELLOW("proposal tx: " << get_transaction_hash(tx) << " is built for " << cpd.comment, LOG_LEVEL_0);
|
||||
events.push_back(tx);
|
||||
|
|
@ -591,9 +593,10 @@ bool escrow_incorrect_proposal::generate(std::vector<test_event_entry>& events)
|
|||
{
|
||||
cpd.comment = "incorrect unlock time (future)";
|
||||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
tx_version = get_tx_version(get_block_height(top_block), m_hardforks);
|
||||
// set unlock time to the future (suppose it's incorrect for escrow proposals)
|
||||
uint64_t unlock_time = top_block.timestamp + 365 * 24 * 60 * 60;
|
||||
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, unlock_time, 0, unlock_time, 0, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, eccf_normal, tx, used_sources);
|
||||
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, unlock_time, 0, unlock_time, 0, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, eccf_normal, tx_version, tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_proposal failed");
|
||||
LOG_PRINT_YELLOW("proposal tx: " << get_transaction_hash(tx) << " is built for " << cpd.comment, LOG_LEVEL_0);
|
||||
events.push_back(tx);
|
||||
|
|
@ -604,7 +607,8 @@ bool escrow_incorrect_proposal::generate(std::vector<test_event_entry>& events)
|
|||
{
|
||||
cpd.comment = "template zero expiration time";
|
||||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, 0, 0, 0, 0, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, eccf_normal, tx, used_sources);
|
||||
tx_version = get_tx_version(get_block_height(top_block), m_hardforks);
|
||||
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, 0, 0, 0, 0, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, eccf_normal, tx_version, tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_proposal failed");
|
||||
LOG_PRINT_YELLOW("proposal tx: " << get_transaction_hash(tx) << " is built for " << cpd.comment, LOG_LEVEL_0);
|
||||
events.push_back(tx);
|
||||
|
|
@ -615,9 +619,10 @@ bool escrow_incorrect_proposal::generate(std::vector<test_event_entry>& events)
|
|||
{
|
||||
cpd.comment = "proposal non-zero expiration time";
|
||||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
tx_version = get_tx_version(get_block_height(top_block), m_hardforks);
|
||||
uint64_t proposal_expiration_time = top_block.timestamp + 12 * 60 * 60;
|
||||
uint64_t template_expiration_time = top_block.timestamp + 12 * 60 * 60;
|
||||
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, 0, proposal_expiration_time, 0, template_expiration_time, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, eccf_normal, tx, used_sources);
|
||||
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, 0, proposal_expiration_time, 0, template_expiration_time, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, eccf_normal, tx_version, tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_proposal failed");
|
||||
LOG_PRINT_YELLOW("proposal tx: " << get_transaction_hash(tx) << " is built for " << cpd.comment, LOG_LEVEL_0);
|
||||
events.push_back(tx);
|
||||
|
|
@ -728,7 +733,7 @@ bool escrow_proposal_expiration::generate(std::vector<test_event_entry>& events)
|
|||
destinations.push_back(tx_destination_entry(amount, bob_acc.get_public_address()));
|
||||
destinations.push_back(tx_destination_entry(amount, bob_acc.get_public_address()));
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_to_key(events, tx_1, blk_0r, miner_acc, destinations);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_1, blk_0r, miner_acc, destinations);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_to_key failed");
|
||||
events.push_back(tx_1);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_1);
|
||||
|
|
@ -946,11 +951,11 @@ bool escrow_proposal_and_accept_expiration::generate(std::vector<test_event_entr
|
|||
|
||||
// send few coins to Alice and Bob
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), TESTS_DEFAULT_FEE * 50, 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), TESTS_DEFAULT_FEE * 50, 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), TESTS_DEFAULT_FEE * 50, 10, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), TESTS_DEFAULT_FEE * 50, 10, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, std::list<transaction>({ tx_0, tx_1 }));
|
||||
|
|
@ -1121,7 +1126,7 @@ bool escrow_incorrect_proposal_acceptance::generate(std::vector<test_event_entry
|
|||
destinations.push_back(tx_destination_entry(big_chunk_amount, bob_acc.get_public_address()));
|
||||
destinations.push_back(tx_destination_entry(big_chunk_amount, bob_acc.get_public_address()));
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_to_key(events, tx_1, blk_0r, miner_acc, destinations);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_1, blk_0r, miner_acc, destinations);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_to_key failed");
|
||||
events.push_back(tx_1);
|
||||
m_alice_bob_start_amount = big_chunk_amount * 2;
|
||||
|
|
@ -1144,15 +1149,17 @@ bool escrow_incorrect_proposal_acceptance::generate(std::vector<test_event_entry
|
|||
// create escrow proposal
|
||||
bc_services::proposal_body prop = AUTO_VAL_INIT(prop);
|
||||
transaction escrow_proposal_tx = AUTO_VAL_INIT(escrow_proposal_tx);
|
||||
r = build_custom_escrow_proposal(events, blk_1r, alice_acc.get_keys(), m_cpd, 0, 0, 0, blk_1r.timestamp + 36000, 0, TESTS_DEFAULT_FEE, m_bob_fee_release, eccf_normal, escrow_proposal_tx, used_sources, &prop);
|
||||
uint64_t tx_version = get_tx_version(get_block_height(blk_1r), m_hardforks);
|
||||
r = build_custom_escrow_proposal(events, blk_1r, alice_acc.get_keys(), m_cpd, 0, 0, 0, blk_1r.timestamp + 36000, 0, TESTS_DEFAULT_FEE, m_bob_fee_release, eccf_normal, tx_version, escrow_proposal_tx, used_sources, &prop);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_proposal failed");
|
||||
events.push_back(escrow_proposal_tx);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1r, miner_acc, escrow_proposal_tx);
|
||||
|
||||
// create normal acceptance
|
||||
tx_version = get_tx_version(get_block_height(blk_2), m_hardforks);
|
||||
transaction escrow_normal_acceptance_tx = prop.tx_template;
|
||||
uint64_t normal_acceptance_mask = eccf_acceptance_no_tsa_compression;
|
||||
r = build_custom_escrow_accept_proposal(events, blk_2, 0, bob_acc.get_keys(), m_cpd, 0, 0, 0, 0, TESTS_DEFAULT_FEE, m_bob_fee_release, normal_acceptance_mask, prop.tx_onetime_secret_key, escrow_normal_acceptance_tx, used_sources);
|
||||
r = build_custom_escrow_accept_proposal(events, blk_2, 0, bob_acc.get_keys(), m_cpd, 0, 0, 0, 0, TESTS_DEFAULT_FEE, m_bob_fee_release, normal_acceptance_mask, prop.tx_onetime_secret_key, tx_version, escrow_normal_acceptance_tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_accept_proposal failed");
|
||||
|
||||
events.push_back(escrow_normal_acceptance_tx);
|
||||
|
|
@ -1200,7 +1207,7 @@ bool escrow_incorrect_proposal_acceptance::generate(std::vector<test_event_entry
|
|||
for(size_t i = 0; i < 15; ++i)
|
||||
destinations.push_back(tx_destination_entry(m_cpd.amount_b_pledge + m_bob_fee_release + bob_fee_acceptance, bob_acc.get_public_address()));
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
r = construct_tx_to_key(events, tx_2, blk_7c, miner_acc, destinations);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_2, blk_7c, miner_acc, destinations);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_to_key failed");
|
||||
events.push_back(tx_2);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_8c, blk_7c, miner_acc, tx_2);
|
||||
|
|
@ -1251,9 +1258,10 @@ bool escrow_incorrect_proposal_acceptance::generate(std::vector<test_event_entry
|
|||
const auto &ccm_el = custom_config_masks[i];
|
||||
uint64_t mask = ccm_el.mask;
|
||||
|
||||
tx_version = get_tx_version(get_block_height(prev_block), m_hardforks);
|
||||
transaction incorrect_acceptance_tx = prop.tx_template;
|
||||
r = build_custom_escrow_accept_proposal(events, prev_block, 0, bob_acc.get_keys(), m_cpd, ccm_el.unlock_time, ccm_el.expiration_time, ccm_el.release_unlock_time, ccm_el.release_expiration_time,
|
||||
bob_fee_acceptance, m_bob_fee_release, mask, prop.tx_onetime_secret_key, incorrect_acceptance_tx, used_sources);
|
||||
bob_fee_acceptance, m_bob_fee_release, mask, prop.tx_onetime_secret_key, tx_version, incorrect_acceptance_tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_accept_proposal failed");
|
||||
|
||||
// In order to use the same escrow proposal to test different invalid acceptance we need to switch chains after each try
|
||||
|
|
@ -1487,7 +1495,7 @@ bool escrow_custom_test::generate(std::vector<test_event_entry>& events) const
|
|||
}
|
||||
// no change back to the miner - it will become a fee
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
events.push_back(tx_1);
|
||||
|
|
@ -1940,7 +1948,7 @@ bool escrow_incorrect_cancel_proposal::generate(std::vector<test_event_entry>& e
|
|||
}
|
||||
// no change back to the miner - it will become a fee
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
events.push_back(tx_1);
|
||||
|
|
@ -1960,24 +1968,27 @@ bool escrow_incorrect_cancel_proposal::generate(std::vector<test_event_entry>& e
|
|||
|
||||
// create normal escrow proposal
|
||||
bc_services::proposal_body prop = AUTO_VAL_INIT(prop);
|
||||
uint64_t tx_version = get_tx_version(get_block_height(blk_1r), m_hardforks);
|
||||
transaction escrow_proposal_tx = AUTO_VAL_INIT(escrow_proposal_tx);
|
||||
r = build_custom_escrow_proposal(events, blk_1r, alice_acc.get_keys(), m_cpd, 0, 0, 0, blk_1r.timestamp + 36000, 0, TESTS_DEFAULT_FEE, m_bob_fee_release, eccf_normal, escrow_proposal_tx, used_sources, &prop);
|
||||
r = build_custom_escrow_proposal(events, blk_1r, alice_acc.get_keys(), m_cpd, 0, 0, 0, blk_1r.timestamp + 36000, 0, TESTS_DEFAULT_FEE, m_bob_fee_release, eccf_normal, tx_version, escrow_proposal_tx, used_sources, &prop);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_proposal failed");
|
||||
events.push_back(escrow_proposal_tx);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1r, miner_acc, escrow_proposal_tx);
|
||||
|
||||
// create normal escrow proposal acceptance
|
||||
transaction escrow_normal_acceptance_tx = prop.tx_template;
|
||||
tx_version = get_tx_version(get_block_height(blk_2), m_hardforks);
|
||||
uint64_t normal_acceptance_mask = eccf_acceptance_no_tsa_compression;
|
||||
r = build_custom_escrow_accept_proposal(events, blk_2, 0, bob_acc.get_keys(), m_cpd, 0, 0, 0, 0, TESTS_DEFAULT_FEE, m_bob_fee_release, normal_acceptance_mask, prop.tx_onetime_secret_key, escrow_normal_acceptance_tx, used_sources);
|
||||
r = build_custom_escrow_accept_proposal(events, blk_2, 0, bob_acc.get_keys(), m_cpd, 0, 0, 0, 0, TESTS_DEFAULT_FEE, m_bob_fee_release, normal_acceptance_mask, prop.tx_onetime_secret_key, tx_version, escrow_normal_acceptance_tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_accept_proposal failed");
|
||||
|
||||
events.push_back(escrow_normal_acceptance_tx);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_3, blk_2, miner_acc, escrow_normal_acceptance_tx);
|
||||
|
||||
// create normal cancel proposal
|
||||
tx_version = get_tx_version(get_block_height(blk_3), m_hardforks);
|
||||
transaction escrow_normal_cancel_proposal_tx = AUTO_VAL_INIT(escrow_normal_cancel_proposal_tx);
|
||||
r = build_custom_escrow_cancel_proposal(events, blk_3, 0, alice_acc.get_keys(), m_cpd, 0, 0, 0, blk_3.timestamp + 3600, TESTS_DEFAULT_FEE, eccf_normal, prop.tx_template, escrow_normal_cancel_proposal_tx, used_sources);
|
||||
r = build_custom_escrow_cancel_proposal(events, blk_3, 0, alice_acc.get_keys(), m_cpd, 0, 0, 0, blk_3.timestamp + 3600, TESTS_DEFAULT_FEE, eccf_normal, prop.tx_template, tx_version, escrow_normal_cancel_proposal_tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_cancel_proposal failed");
|
||||
|
||||
events.push_back(escrow_normal_cancel_proposal_tx);
|
||||
|
|
@ -2045,8 +2056,9 @@ bool escrow_incorrect_cancel_proposal::generate(std::vector<test_event_entry>& e
|
|||
uint64_t mask = ccm_el.mask;
|
||||
|
||||
transaction incorrect_cancellation_proposal_tx = prop.tx_template;
|
||||
uint64_t tx_version = get_tx_version(get_block_height(blk_3), m_hardforks);
|
||||
r = build_custom_escrow_cancel_proposal(events, prev_block, 0, alice_acc.get_keys(), m_cpd, ccm_el.unlock_time, ccm_el.expiration_time, ccm_el.release_unlock_time, ccm_el.release_expiration_time,
|
||||
TESTS_DEFAULT_FEE, mask, prop.tx_template, incorrect_cancellation_proposal_tx, used_sources);
|
||||
TESTS_DEFAULT_FEE, mask, prop.tx_template, tx_version, incorrect_cancellation_proposal_tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_cancel_proposal failed");
|
||||
|
||||
// In order to use the same escrow proposal to test different invalid cancellations we need to switch chains after each try
|
||||
|
|
@ -2334,12 +2346,12 @@ bool escrow_cancellation_and_tx_order::generate(std::vector<test_event_entry>& e
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
bool r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -2534,12 +2546,12 @@ bool escrow_cancellation_proposal_expiration::generate(std::vector<test_event_en
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
bool r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -2781,12 +2793,12 @@ bool escrow_cancellation_acceptance_expiration::generate(std::vector<test_event_
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(100), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
bool r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(100), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(100), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(100), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -2948,12 +2960,12 @@ bool escrow_proposal_acceptance_in_alt_chain::generate(std::vector<test_event_en
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
bool r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -2972,8 +2984,9 @@ bool escrow_proposal_acceptance_in_alt_chain::generate(std::vector<test_event_en
|
|||
|
||||
// escrow proposal
|
||||
bc_services::proposal_body prop = AUTO_VAL_INIT(prop);
|
||||
uint64_t tx_version = get_tx_version(get_block_height(blk_1), m_hardforks);
|
||||
transaction escrow_proposal_tx = AUTO_VAL_INIT(escrow_proposal_tx);
|
||||
r = build_custom_escrow_proposal(events, blk_1, alice_acc.get_keys(), cpd, 0, 0, 0, blk_1.timestamp + 36000, 0, TESTS_DEFAULT_FEE, bob_fee_release, eccf_normal, escrow_proposal_tx, used_sources, &prop);
|
||||
r = build_custom_escrow_proposal(events, blk_1, alice_acc.get_keys(), cpd, 0, 0, 0, blk_1.timestamp + 36000, 0, TESTS_DEFAULT_FEE, bob_fee_release, eccf_normal, tx_version, escrow_proposal_tx, used_sources, &prop);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_proposal failed");
|
||||
events.push_back(escrow_proposal_tx);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1, miner_acc, escrow_proposal_tx);
|
||||
|
|
@ -2981,9 +2994,10 @@ bool escrow_proposal_acceptance_in_alt_chain::generate(std::vector<test_event_en
|
|||
MAKE_NEXT_BLOCK(events, blk_3, blk_2, miner_acc);
|
||||
|
||||
// escrow proposal acceptance
|
||||
tx_version = get_tx_version(get_block_height(blk_2), m_hardforks);
|
||||
transaction escrow_normal_acceptance_tx = prop.tx_template;
|
||||
uint64_t normal_acceptance_mask = eccf_normal; //eccf_acceptance_no_tsa_compression;
|
||||
r = build_custom_escrow_accept_proposal(events, blk_2, 0, bob_acc.get_keys(), cpd, 0, 0, 0, 0, TESTS_DEFAULT_FEE, bob_fee_release, normal_acceptance_mask, prop.tx_onetime_secret_key, escrow_normal_acceptance_tx, used_sources);
|
||||
r = build_custom_escrow_accept_proposal(events, blk_2, 0, bob_acc.get_keys(), cpd, 0, 0, 0, 0, TESTS_DEFAULT_FEE, bob_fee_release, normal_acceptance_mask, prop.tx_onetime_secret_key, tx_version, escrow_normal_acceptance_tx, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_accept_proposal failed");
|
||||
|
||||
events.push_back(escrow_normal_acceptance_tx);
|
||||
|
|
@ -3023,12 +3037,12 @@ bool escrow_zero_amounts::generate(std::vector<test_event_entry>& events) const
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
bool r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -3125,12 +3139,12 @@ bool escrow_balance::generate(std::vector<test_event_entry>& events) const
|
|||
m_alice_bob_start_chunk_amount = m_alice_bob_start_amount / 10;
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), m_alice_bob_start_amount, 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
bool r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), m_alice_bob_start_amount, 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), m_alice_bob_start_amount, 10, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), m_alice_bob_start_amount, 10, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ bool random_outs_and_burnt_coins::generate(std::vector<test_event_entry>& events
|
|||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
uint64_t burned_tx_amount_total = get_burned_amount(tx_0);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ bool hard_fork_1_base_test::configure_core(currency::core& c, size_t ev_index, c
|
|||
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_forks.hard_fork_01_starts_after_height = m_hardfork_height;
|
||||
c.get_blockchain_storage().set_core_runtime_config(pc);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -78,7 +78,7 @@ bool hard_fork_1_unlock_time_2_in_normal_tx::generate(std::vector<test_event_ent
|
|||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
crypto::secret_key tx_sec_key;
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_0, tx_sec_key, 0 /* unlock time 1 is zero and thus will not be set */);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_0, get_tx_version_from_events(events), tx_sec_key, 0 /* unlock time 1 is zero and thus will not be set */);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
// tx_0 shouldn't be accepted
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
|
|
@ -92,7 +92,7 @@ bool hard_fork_1_unlock_time_2_in_normal_tx::generate(std::vector<test_event_ent
|
|||
|
||||
// make another tx with the same inputs and extra (tx_0 was rejected so inputs can be reused)
|
||||
transaction tx_0a = AUTO_VAL_INIT(tx_0a);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_0a, tx_sec_key, 0 /* unlock time 1 is zero and thus will not be set */);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_0a, get_tx_version_from_events(events), tx_sec_key, 0 /* unlock time 1 is zero and thus will not be set */);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
// tx_0a shouldn't be accepted as well
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
|
|
@ -132,7 +132,7 @@ bool hard_fork_1_unlock_time_2_in_normal_tx::generate(std::vector<test_event_ent
|
|||
extra.push_back(ut2);
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_1, tx_sec_key, 0 /* unlock time 1 is zero and not set */);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_1, get_tx_version_from_events(events), tx_sec_key, 0 /* unlock time 1 is zero and not set */);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ bool hard_fork_1_unlock_time_2_in_normal_tx::generate(std::vector<test_event_ent
|
|||
extra.push_back(ut2);
|
||||
|
||||
transaction tx_1a = AUTO_VAL_INIT(tx_1a);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_1a, tx_sec_key, 0 /* unlock time 1 is zero and not set */);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_1a, get_tx_version_from_events(events), tx_sec_key, 0 /* unlock time 1 is zero and not set */);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_1a);
|
||||
DO_CALLBACK_PARAMS(events, "check_tx_pool_count", static_cast<size_t>(1));
|
||||
|
|
@ -339,7 +339,7 @@ bool hard_fork_1_checkpoint_basic_test::generate(std::vector<test_event_entry>&
|
|||
extra.push_back(ut2);
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
crypto::secret_key tx_sec_key;
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_0, tx_sec_key, 0 /* unlock time 1 is zero and thus will not be set */);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_0, get_tx_version_from_events(events), tx_sec_key, 0 /* unlock time 1 is zero and thus will not be set */);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
// tx_0 should be accepted
|
||||
events.push_back(event_visitor_settings(event_visitor_settings::set_txs_kept_by_block, true)); // tx_0 goes with blk_1_bad
|
||||
|
|
@ -433,7 +433,7 @@ bool hard_fork_1_checkpoint_basic_test::generate(std::vector<test_event_entry>&
|
|||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, std::vector<tx_destination_entry>{ tx_destination_entry(MK_TEST_COINS(90) - TESTS_DEFAULT_FEE, miner_acc.get_public_address()) },
|
||||
empty_attachment, tx_1, stake_lock_time /* try to use stake unlock time -- should not work as it is not a coinbase */);
|
||||
empty_attachment, tx_1, get_tx_version_from_events(events), stake_lock_time /* try to use stake unlock time -- should not work as it is not a coinbase */);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
|
|
@ -506,7 +506,7 @@ bool hard_fork_1_pos_and_locked_coins::generate(std::vector<test_event_entry>& e
|
|||
destinations.push_back(tx_destination_entry(unique_amount_alice, alice_acc.get_public_address()));
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx_to_key(events, tx_0, blk_0r, miner_acc, destinations, TESTS_DEFAULT_FEE, 0, 0, extra);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_0, blk_0r, miner_acc, destinations, TESTS_DEFAULT_FEE, 0, 0, extra);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
|
|
@ -523,7 +523,7 @@ bool hard_fork_1_pos_and_locked_coins::generate(std::vector<test_event_entry>& e
|
|||
ut2.unlock_time_array.push_back(ut2_unlock_time);
|
||||
extra.push_back(ut2);
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_to_key(events, tx_1, blk_0r, miner_acc, destinations, TESTS_DEFAULT_FEE, 0, 0, extra);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_1, blk_0r, miner_acc, destinations, TESTS_DEFAULT_FEE, 0, 0, extra);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
events.push_back(tx_1);
|
||||
|
|
@ -725,7 +725,7 @@ bool hard_fork_1_pos_locked_height_vs_time::generate(std::vector<test_event_entr
|
|||
destinations.push_back(tx_destination_entry(stake_amount, bob_acc.get_public_address()));
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx_to_key(events, tx_0, blk_0r, miner_acc, destinations, TESTS_DEFAULT_FEE, 0, 0, extra);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_0, blk_0r, miner_acc, destinations, TESTS_DEFAULT_FEE, 0, 0, extra);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
|
|
@ -877,7 +877,7 @@ bool hard_fork_1_pos_locked_height_vs_time::generate(std::vector<test_event_entr
|
|||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, std::vector<tx_destination_entry>{ tx_destination_entry(stake_amount / 2, miner_acc.get_public_address()) },
|
||||
empty_attachment, tx_1, stake_unlock_time /* try to use stake unlock time -- should not work as it is not a coinbase */);
|
||||
empty_attachment, tx_1, get_tx_version_from_events(events), stake_unlock_time /* try to use stake unlock time -- should not work as it is not a coinbase */);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ bool hard_fork_1_bad_pos_source::configure_core(currency::core& c, size_t ev_ind
|
|||
currency::core_runtime_config pc = c.get_blockchain_storage().get_core_runtime_config();
|
||||
pc.min_coinstake_age = TESTS_POS_CONFIG_MIN_COINSTAKE_AGE; //four blocks
|
||||
pc.pos_minimum_heigh = TESTS_POS_CONFIG_POS_MINIMUM_HEIGH; //four blocks
|
||||
pc.hard_fork_01_starts_after_height = get_hardfork_height();
|
||||
pc.hard_forks.hard_fork_01_starts_after_height = get_hardfork_height();
|
||||
|
||||
c.get_blockchain_storage().set_core_runtime_config(pc);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ bool hard_fork_1_cumulative_difficulty_base::configure_core(currency::core& c, s
|
|||
currency::core_runtime_config pc = c.get_blockchain_storage().get_core_runtime_config();
|
||||
pc.min_coinstake_age = TESTS_POS_CONFIG_MIN_COINSTAKE_AGE; //four blocks
|
||||
pc.pos_minimum_heigh = TESTS_POS_CONFIG_POS_MINIMUM_HEIGH; //four blocks
|
||||
pc.hard_fork_01_starts_after_height = get_hardfork_height();
|
||||
pc.hard_forks.hard_fork_01_starts_after_height = get_hardfork_height();
|
||||
|
||||
c.get_blockchain_storage().set_core_runtime_config(pc);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ bool hard_fork_1_locked_mining_test::generate(std::vector<test_event_entry>& eve
|
|||
crypto::secret_key stub;
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
uint64_t unlock_time = get_block_height(blk_0r) + 2000;
|
||||
r = construct_tx(miner_acc.get_keys(), sources_1, destinations, extra, empty_attachment, tx_1, stub, unlock_time);
|
||||
r = construct_tx(miner_acc.get_keys(), sources_1, destinations, extra, empty_attachment, tx_1, get_tx_version_from_events(events), stub, unlock_time);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_1); // push it to the pool
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ bool hard_fork_1_locked_mining_test::configure_core(currency::core& c, size_t ev
|
|||
currency::core_runtime_config pc = c.get_blockchain_storage().get_core_runtime_config();
|
||||
pc.min_coinstake_age = TESTS_POS_CONFIG_MIN_COINSTAKE_AGE; //four blocks
|
||||
pc.pos_minimum_heigh = TESTS_POS_CONFIG_POS_MINIMUM_HEIGH; //four blocks
|
||||
pc.hard_fork_01_starts_after_height = get_hardfork_height();
|
||||
pc.hard_forks.hard_fork_01_starts_after_height = get_hardfork_height();
|
||||
|
||||
c.get_blockchain_storage().set_core_runtime_config(pc);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ hard_fork_2_base_test::hard_fork_2_base_test(size_t hardfork_01_height, size_t h
|
|||
, m_hardfork_02_height(hardfork_02_height)
|
||||
, m_hardfork_03_height(CURRENCY_MAX_BLOCK_NUMBER)
|
||||
{
|
||||
|
||||
REGISTER_CALLBACK_METHOD(hard_fork_2_base_test, configure_core);
|
||||
}
|
||||
|
||||
|
|
@ -28,9 +29,9 @@ bool hard_fork_2_base_test::configure_core(currency::core& c, size_t ev_index, c
|
|||
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_01_height;
|
||||
pc.hard_fork_02_starts_after_height = m_hardfork_02_height;
|
||||
pc.hard_fork_03_starts_after_height = m_hardfork_03_height;
|
||||
pc.hard_forks.hard_fork_01_starts_after_height = m_hardfork_01_height;
|
||||
pc.hard_forks.hard_fork_02_starts_after_height = m_hardfork_02_height;
|
||||
pc.hard_forks.hard_fork_03_starts_after_height = m_hardfork_03_height;
|
||||
c.get_blockchain_storage().set_core_runtime_config(pc);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -802,7 +803,7 @@ bool hard_fork_2_no_new_structures_before_hf::generate(std::vector<test_event_en
|
|||
|
||||
std::list<transaction> tx_set;
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
r = put_alias_via_tx_to_list(events, tx_set, blk_2, miner_acc, alias_entry, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_set, blk_2, miner_acc, alias_entry, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
transaction tx_2 = tx_set.front();
|
||||
|
||||
|
|
@ -817,7 +818,7 @@ bool hard_fork_2_no_new_structures_before_hf::generate(std::vector<test_event_en
|
|||
alias_entry_old.m_alias = "alicealice";
|
||||
|
||||
tx_set.clear();
|
||||
r = put_alias_via_tx_to_list(events, tx_set, blk_2, miner_acc, alias_entry_old, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_set, blk_2, miner_acc, alias_entry_old, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
transaction tx_2_old = tx_set.front();
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_3, blk_2, miner_acc, tx_2_old);
|
||||
|
|
@ -888,7 +889,7 @@ bool hard_fork_2_awo_wallets_basic_test<before_hf_2>::generate(std::vector<test_
|
|||
REWIND_BLOCKS_N(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(110), 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(110), 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
|
|
@ -1164,7 +1165,7 @@ bool hard_fork_2_alias_update_using_old_tx<before_hf_2>::generate(std::vector<te
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(110), 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(110), 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
|
|
@ -1280,7 +1281,7 @@ bool hard_fork_2_incorrect_alias_update<before_hf_2>::generate(std::vector<test_
|
|||
REWIND_BLOCKS_N(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(110), 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(110), 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
|
|
|
|||
|
|
@ -110,8 +110,8 @@ bool gen_uint_overflow_1::generate(std::vector<test_event_entry>& events) const
|
|||
// Problem 2. total_fee overflow, block_reward overflow
|
||||
std::list<currency::transaction> txs_1;
|
||||
// Create txs with huge fee
|
||||
txs_1.push_back(construct_tx_with_fee(events, blk_3, bob_account, alice_account, MK_TEST_COINS(1), TX_MAX_TRANSFER_AMOUNT - MK_TEST_COINS(1)));
|
||||
txs_1.push_back(construct_tx_with_fee(events, blk_3, bob_account, alice_account, MK_TEST_COINS(1), TX_MAX_TRANSFER_AMOUNT - MK_TEST_COINS(1)));
|
||||
txs_1.push_back(construct_tx_with_fee(m_hardforks, events, blk_3, bob_account, alice_account, MK_TEST_COINS(1), TX_MAX_TRANSFER_AMOUNT - MK_TEST_COINS(1)));
|
||||
txs_1.push_back(construct_tx_with_fee(m_hardforks, events, blk_3, bob_account, alice_account, MK_TEST_COINS(1), TX_MAX_TRANSFER_AMOUNT - MK_TEST_COINS(1)));
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_4, blk_3r, miner_account, txs_1);
|
||||
|
||||
return true;
|
||||
|
|
@ -154,7 +154,7 @@ bool gen_uint_overflow_2::generate(std::vector<test_event_entry>& events) const
|
|||
|
||||
currency::transaction tx_1;
|
||||
std::vector<currency::attachment_v> attachments;
|
||||
if (!construct_tx(miner_account.get_keys(), sources, destinations, attachments, tx_1, 0))
|
||||
if (!construct_tx(miner_account.get_keys(), sources, destinations, attachments, tx_1, get_tx_version_from_events(events), 0))
|
||||
return false;
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -181,7 +181,7 @@ bool gen_uint_overflow_2::generate(std::vector<test_event_entry>& events) const
|
|||
|
||||
currency::transaction tx_2;
|
||||
std::vector<currency::attachment_v> attachments2;
|
||||
if (!construct_tx(bob_account.get_keys(), sources, destinations, attachments2, tx_2, 0))
|
||||
if (!construct_tx(bob_account.get_keys(), sources, destinations, attachments2, tx_2, get_tx_version_from_events(events), 0))
|
||||
return false;
|
||||
events.push_back(tx_2);
|
||||
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ bool block_template_vs_invalid_txs_from_pool::generate(std::vector<test_event_en
|
|||
r = fill_tx_sources(sources, events, blk_0r, miner_acc.get_keys(), de.amount + TESTS_DEFAULT_FEE, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
|
||||
transaction tx_1m = AUTO_VAL_INIT(tx_1m);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, std::vector<tx_destination_entry>({ de }), empty_attachment, tx_1m, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, std::vector<tx_destination_entry>({ de }), empty_attachment, tx_1m, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_1m);
|
||||
|
||||
|
|
@ -271,7 +271,7 @@ bool block_template_vs_invalid_txs_from_pool::generate(std::vector<test_event_en
|
|||
se.ms_sigs_count = 1;
|
||||
transaction tx_2m = AUTO_VAL_INIT(tx_2m);
|
||||
r = construct_tx(bob_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, miner_acc.get_public_address()) }),
|
||||
empty_attachment, tx_2m, 0);
|
||||
empty_attachment, tx_2m, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
bool input_fully_signed = false;
|
||||
r = sign_multisig_input_in_tx(tx_2m, 0, bob_acc.get_keys(), tx_1m, &input_fully_signed);
|
||||
|
|
@ -280,7 +280,7 @@ bool block_template_vs_invalid_txs_from_pool::generate(std::vector<test_event_en
|
|||
|
||||
transaction tx_2ma = AUTO_VAL_INIT(tx_2ma);
|
||||
r = construct_tx(bob_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, miner_acc.get_public_address()) }),
|
||||
empty_attachment, tx_2ma, 0);
|
||||
empty_attachment, tx_2ma, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
input_fully_signed = false;
|
||||
r = sign_multisig_input_in_tx(tx_2ma, 0, bob_acc.get_keys(), tx_1m, &input_fully_signed);
|
||||
|
|
@ -437,7 +437,7 @@ bool test_blockchain_vs_spent_multisig_outs::generate(std::vector<test_event_ent
|
|||
sources, destinations, true, true, 1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
|
|
@ -458,7 +458,7 @@ bool test_blockchain_vs_spent_multisig_outs::generate(std::vector<test_event_ent
|
|||
destinations.clear();
|
||||
destinations.push_back(tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, miner_acc.get_public_address()));
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
bool is_fully_signed = false;
|
||||
r = sign_multisig_input_in_tx(tx_1, 0, miner_acc.get_keys(), tx_0, &is_fully_signed);
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ void transfer_multisig(tools::wallet2& w,
|
|||
tools::detail::split_strategy_id_t split_strategy_id,
|
||||
const tools::tx_dust_policy& dust_policy,
|
||||
currency::transaction &tx,
|
||||
uint64_t tx_version,
|
||||
uint8_t tx_outs_attr = CURRENCY_TO_KEY_OUT_RELAXED,
|
||||
uint64_t flags = 0,
|
||||
bool shuffle = true,
|
||||
|
|
@ -62,6 +63,9 @@ void transfer_multisig(tools::wallet2& w,
|
|||
ctp.split_strategy_id = split_strategy_id;
|
||||
ctp.tx_outs_attr = tx_outs_attr;
|
||||
ctp.unlock_time = unlock_time;
|
||||
|
||||
|
||||
ftp.tx_version = tx_version;
|
||||
|
||||
w.prepare_transaction(ctp, ftp, tx);
|
||||
crypto::secret_key sk = AUTO_VAL_INIT(sk);
|
||||
|
|
@ -185,6 +189,7 @@ bool multisig_wallet_test::c1(currency::core& c, size_t ev_index, const std::vec
|
|||
wallet_b->get_multisig_transfers(ms_b);
|
||||
CHECK_AND_ASSERT_MES(ms_a.size() == 1 && ms_b.size() == 1, false, "Multisig failed: ms_a.size() == 1 && ms_b.size() == 1");
|
||||
|
||||
uint64_t tx_version = currency::get_tx_version(c.get_current_blockchain_size(), c.get_blockchain_storage().get_core_runtime_config().hard_forks) ;
|
||||
std::vector<tx_destination_entry> dst2(1);
|
||||
dst2.back().addr.resize(1);
|
||||
dst2.back().addr.back() = m_accunt_c.get_public_address();
|
||||
|
|
@ -203,7 +208,8 @@ bool multisig_wallet_test::c1(currency::core& c, size_t ev_index, const std::vec
|
|||
attachments,
|
||||
tools::detail::ssi_digit,
|
||||
tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD),
|
||||
result_tx);
|
||||
result_tx,
|
||||
tx_version);
|
||||
|
||||
r = mine_next_pow_blocks_in_playtime(m_mining_accunt.get_public_address(), c, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
CHECK_AND_ASSERT_MES(r, false, "mine_next_pow_blocks_in_playtime failed");
|
||||
|
|
@ -311,7 +317,7 @@ bool multisig_wallet_test_many_dst::c1(currency::core& c, size_t ev_index, const
|
|||
tx_destination_entry de2(amount - TESTS_DEFAULT_FEE, m_accounts[ALICE_ACC_IDX].get_public_address());
|
||||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
TMP_LOG_SILENT;
|
||||
transfer_multisig(*w.get(), owner_keys, get_multisig_out_id(result_tx, multisig_index), std::vector<tx_destination_entry>({ de2 }), 0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
|
||||
transfer_multisig(*w.get(), owner_keys, get_multisig_out_id(result_tx, multisig_index), std::vector<tx_destination_entry>({ de2 }), 0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, c.get_current_tx_version());
|
||||
TMP_LOG_RESTORE;
|
||||
|
||||
r = mine_next_pow_blocks_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
|
@ -481,7 +487,7 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
|
|||
|
||||
currency::transaction tx = AUTO_VAL_INIT(tx);
|
||||
transfer_multisig(*alice_wlt.get(), std::list<account_keys>({ m_accounts[BOB_ACC_IDX].get_keys() }), ms1_hash, std::vector<tx_destination_entry>({ tx_destination_entry(amount1, receiver_acc.get_public_address()) }),
|
||||
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
|
||||
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, c.get_current_tx_version());
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
|
||||
|
||||
r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
|
||||
|
|
@ -515,7 +521,7 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
|
|||
|
||||
tx = AUTO_VAL_INIT(tx);
|
||||
transfer_multisig(*carol_wlt.get(), std::list<account_keys>({ m_accounts[DAN_ACC_IDX].get_keys() }), ms2_hash, std::vector<tx_destination_entry>({ tx_destination_entry(amount2, receiver_acc.get_public_address()) }),
|
||||
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
|
||||
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, c.get_current_tx_version());
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
|
||||
|
||||
|
|
@ -543,7 +549,7 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
|
|||
|
||||
// Re-try spending Carol-Dan multisig out on behalf of Dan. It should be OK now
|
||||
transfer_multisig(*dan_wlt.get(), std::list<account_keys>({ m_accounts[CAROL_ACC_IDX].get_keys() }), ms2_hash, std::vector<tx_destination_entry>({ tx_destination_entry(amount2, receiver_acc.get_public_address()) }),
|
||||
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
|
||||
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, c.get_current_tx_version());
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
|
||||
r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
|
||||
|
|
@ -561,7 +567,7 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
|
|||
|
||||
tx = AUTO_VAL_INIT(tx);
|
||||
transfer_multisig(*alice_wlt.get(), std::list<account_keys>({ m_accounts[DAN_ACC_IDX].get_keys() }), ms3_hash, std::vector<tx_destination_entry>({ tx_destination_entry(amount3, receiver_acc.get_public_address()) }),
|
||||
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
|
||||
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, c.get_current_tx_version());
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
|
||||
|
||||
|
|
@ -701,7 +707,7 @@ bool multisig_wallet_same_dst_addr::c1(currency::core& c, size_t ev_index, const
|
|||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
transfer_multisig(*alice_wlt.get(), std::list<account_keys>({ m_accounts[ALICE_ACC_IDX].get_keys() }), ms_hash,
|
||||
std::vector<tx_destination_entry>({ tx_destination_entry(amount, m_accounts[BOB_ACC_IDX].get_public_address()) }),
|
||||
0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment, tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
|
||||
0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment, tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, c.get_current_tx_version());
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect number of tx in the pool");
|
||||
r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
|
||||
|
|
@ -795,7 +801,7 @@ bool multisig_wallet_ms_to_ms::c1(currency::core& c, size_t ev_index, const std:
|
|||
transaction ms_tx2 = AUTO_VAL_INIT(ms_tx2);
|
||||
transfer_multisig(*alice_wlt.get(), std::list<account_keys>({ m_accounts[BOB_ACC_IDX].get_keys() }), ms_hash,
|
||||
std::vector<tx_destination_entry>({ de }),
|
||||
0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment, tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), ms_tx2);
|
||||
0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment, tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), ms_tx2, c.get_current_tx_version());
|
||||
|
||||
// check the pool and mine a block
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect number of tx in the pool");
|
||||
|
|
@ -812,7 +818,7 @@ bool multisig_wallet_ms_to_ms::c1(currency::core& c, size_t ev_index, const std:
|
|||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
transfer_multisig(*miner_wlt.get(), std::list<account_keys>({ m_accounts[BOB_ACC_IDX].get_keys() }), ms_hash2,
|
||||
std::vector<tx_destination_entry>({ tx_destination_entry(amount - TESTS_DEFAULT_FEE, m_accounts[BOB_ACC_IDX].get_public_address()) }),
|
||||
0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment, tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
|
||||
0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment, tools::detail::ssi_digit, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, c.get_current_tx_version());
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect number of tx in the pool");
|
||||
r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
|
||||
|
|
@ -870,7 +876,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 4);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r == false, false, "construct_tx was expected to fail, but successed");
|
||||
|
||||
|
||||
|
|
@ -883,7 +889,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -907,7 +913,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
|
||||
// Transaction should be successfully created, but rejected by the core
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ de }), empty_attachment, tx_2, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ de }), empty_attachment, tx_2, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
bool tx_fully_signed = false;
|
||||
r = sign_multisig_input_in_tx(tx_2, 0, bob_acc.get_keys(), tx_1, &tx_fully_signed);
|
||||
|
|
@ -937,7 +943,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
se.ms_sigs_count = 2;
|
||||
|
||||
transaction tx_3 = AUTO_VAL_INIT(tx_3);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address()) }), empty_attachment, tx_3, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address()) }), empty_attachment, tx_3, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
r = sign_multisig_input_in_tx(tx_3, 0, bob_acc.get_keys(), tx_1, &tx_fully_signed);
|
||||
CHECK_AND_ASSERT_MES(r && !tx_fully_signed, false, "sign_multisig_input_in_tx failed, tx_fully_signed : " << tx_fully_signed);
|
||||
|
|
@ -956,7 +962,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
|
||||
transaction tx_4 = AUTO_VAL_INIT(tx_4);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_4, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_4, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_4);
|
||||
|
||||
|
|
@ -974,7 +980,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
se.ms_sigs_count = 3;
|
||||
|
||||
transaction tx_5 = AUTO_VAL_INIT(tx_5);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_5, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_5, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
// use sign_multisig_input_in_tx_custom to create tx with more signatures (3) than minimum_sigs (1)
|
||||
|
|
@ -999,7 +1005,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
|
||||
transaction tx_6 = AUTO_VAL_INIT(tx_6);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_6, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_6, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_6);
|
||||
|
||||
|
|
@ -1018,7 +1024,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
se.ms_sigs_count = 4;
|
||||
|
||||
transaction tx_7 = AUTO_VAL_INIT(tx_7);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_7, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_7, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
// use sign_multisig_input_in_tx_custom to create tx with more signatures (4) than minimum_sigs (1)
|
||||
|
|
@ -1041,7 +1047,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
|
||||
transaction tx_8 = AUTO_VAL_INIT(tx_8);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_8, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_8, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_8);
|
||||
|
||||
|
|
@ -1061,7 +1067,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
se.ms_sigs_count = redundant_keys_count;
|
||||
|
||||
transaction tx_9 = AUTO_VAL_INIT(tx_9);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_9, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_9, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
tx_9.signatures[0].resize(redundant_keys_count, invalid_signature);
|
||||
|
|
@ -1192,7 +1198,7 @@ bool multisig_and_unlock_time::generate(std::vector<test_event_entry>& events) c
|
|||
uint64_t unlock_time_2 = blk_0r.timestamp + DIFFICULTY_TOTAL_TARGET * 6 + CURRENCY_LOCKED_TX_ALLOWED_DELTA_SECONDS;
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, unlock_time, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_from_events(events), unlock_time, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
CHECK_AND_ASSERT_MES(get_tx_max_unlock_time(tx_1) == unlock_time, false, "Unlock time was not correctly set");
|
||||
events.push_back(tx_1);
|
||||
|
|
@ -1222,7 +1228,7 @@ bool multisig_and_unlock_time::generate(std::vector<test_event_entry>& events) c
|
|||
// tx_2 should be created ok, but rejected by the core, as one of input refers to a locked tx
|
||||
// Note: tx_2 has unlock_time_2 specified
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_2, unlock_time_2, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_2, get_tx_version_from_events(events), unlock_time_2, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
bool tx_fully_signed = false;
|
||||
|
|
@ -1264,7 +1270,7 @@ bool multisig_and_unlock_time::generate(std::vector<test_event_entry>& events) c
|
|||
crypto::secret_key stub_key = AUTO_VAL_INIT(stub_key);
|
||||
etc_tx_details_expiration_time extra_expiration_time = AUTO_VAL_INIT(extra_expiration_time);
|
||||
extra_expiration_time.v = expiration_time;
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, std::vector<extra_v>({ extra_expiration_time }), empty_attachment, tx_4, stub_key, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, std::vector<extra_v>({ extra_expiration_time }), empty_attachment, tx_4, get_tx_version_from_events(events), stub_key, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
CHECK_AND_ASSERT_MES(get_tx_expiration_time(tx_4) == expiration_time, false, "Expiration time was not correctly set");
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
|
|
@ -1272,7 +1278,7 @@ bool multisig_and_unlock_time::generate(std::vector<test_event_entry>& events) c
|
|||
|
||||
// add similar tx (same sources and destinations) with no expiration_time - should be accepted by the core
|
||||
transaction tx_5 = AUTO_VAL_INIT(tx_5);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_extra, empty_attachment, tx_5, stub_key, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_extra, empty_attachment, tx_5, get_tx_version_from_events(events), stub_key, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_5);
|
||||
|
||||
|
|
@ -1299,7 +1305,7 @@ bool multisig_and_unlock_time::generate(std::vector<test_event_entry>& events) c
|
|||
extra_expiration_time = AUTO_VAL_INIT(extra_expiration_time);
|
||||
extra_expiration_time.v = expiration_time;
|
||||
transaction tx_6 = AUTO_VAL_INIT(tx_6);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, std::vector<extra_v>({ extra_expiration_time }), empty_attachment, tx_6, stub_key, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, std::vector<extra_v>({ extra_expiration_time }), empty_attachment, tx_6, get_tx_version_from_events(events), stub_key, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
CHECK_AND_ASSERT_MES(get_tx_expiration_time(tx_6) == expiration_time, false, "Expiration time was not correctly set");
|
||||
r = sign_multisig_input_in_tx(tx_6, tx_5_ms_out_idx, miner_acc.get_keys(), tx_5, &tx_fully_signed);
|
||||
|
|
@ -1412,7 +1418,7 @@ bool multisig_and_coinbase::generate(std::vector<test_event_entry>& events) cons
|
|||
destinations.assign({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address()) });
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
bool fully_signed_tx = false;
|
||||
r = sign_multisig_input_in_tx(tx_1, 0, alice_acc.get_keys(), blk_1.miner_tx, &fully_signed_tx);
|
||||
|
|
@ -1442,7 +1448,7 @@ bool multisig_and_coinbase::generate(std::vector<test_event_entry>& events) cons
|
|||
r = fill_tx_sources_and_destinations(events, prev_block, miner_acc.get_keys(), ms_addr_list, blk_2_reward, TESTS_DEFAULT_FEE, 0, sources, destinations, false, false, 1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction miner_tx = AUTO_VAL_INIT(miner_tx);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, miner_tx, height + CURRENCY_MINED_MONEY_UNLOCK_WINDOW, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, miner_tx, get_tx_version_from_events(events), height + CURRENCY_MINED_MONEY_UNLOCK_WINDOW, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
// replace vin with coinbase input
|
||||
|
|
@ -1476,7 +1482,7 @@ bool multisig_and_coinbase::generate(std::vector<test_event_entry>& events) cons
|
|||
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
r = construct_tx(alice_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }),
|
||||
empty_attachment, tx_2, 0);
|
||||
empty_attachment, tx_2, get_tx_version_from_events(events), 0);
|
||||
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
r = sign_multisig_input_in_tx(tx_2, 0, alice_acc.get_keys(), blk_3.miner_tx, &fully_signed_tx);
|
||||
|
|
@ -1622,7 +1628,7 @@ multisig_and_checkpoints::multisig_and_checkpoints()
|
|||
bool multisig_and_checkpoints::set_cp(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
|
||||
{
|
||||
currency::checkpoints checkpoints;
|
||||
checkpoints.add_checkpoint(15, "6f9194c144afd73077478e7f04e947c50160b5673558e6f696a4f662a3ca261e");
|
||||
checkpoints.add_checkpoint(15, "e2a1b0d51c4de81a79caafb28ba3c2f2ef3f53f7a728932b4d7e2a81a3fc2cc0");
|
||||
c.set_checkpoints(std::move(checkpoints));
|
||||
|
||||
return true;
|
||||
|
|
@ -2242,7 +2248,7 @@ bool multisig_n_participants_seq_signing::generate(std::vector<test_event_entry>
|
|||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, ms_amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, m_minimum_signs_to_spend);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_from_events(events), 0);
|
||||
events.push_back(tx_1);
|
||||
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_1);
|
||||
|
|
@ -2272,7 +2278,7 @@ bool multisig_n_participants_seq_signing::generate(std::vector<test_event_entry>
|
|||
|
||||
// construct a transaction (no participants keys are provided, thus no signs for ms input are created)
|
||||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx, 0);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
// sign the transaction by (m_minimum_signs_to_spend) participants in random order
|
||||
|
|
@ -2549,7 +2555,7 @@ bool multisig_unconfirmed_transfer_and_multiple_scan_pool_calls::c1(currency::co
|
|||
attachments,
|
||||
tools::detail::ssi_digit,
|
||||
tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD),
|
||||
tx);
|
||||
tx, c.get_current_tx_version());
|
||||
|
||||
LOG_PRINT_YELLOW("%%%%% tx " << get_transaction_hash(tx) << " is spending multisig output " << multisig_id, LOG_LEVEL_0);
|
||||
|
||||
|
|
|
|||
|
|
@ -633,7 +633,7 @@ bool offer_removing_and_selected_output::generate(std::vector<test_event_entry>&
|
|||
std::vector<tx_source_entry> sources;
|
||||
r = fill_tx_sources(sources, events, blk_0r, miner_acc.get_keys(), destinations_amount + TESTS_DEFAULT_FEE, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_0);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_0);
|
||||
|
|
@ -751,7 +751,7 @@ bool offers_and_stuck_txs::generate(std::vector<test_event_entry>& events) const
|
|||
bc_services::put_offer_into_attachment(co, attachments);
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
uint64_t fee = 7 * TESTS_DEFAULT_FEE;
|
||||
r = construct_tx_to_key(events, tx_2, blk_1, miner_acc, miner_acc, TESTS_DEFAULT_FEE, fee, 0, 0, empty_extra, attachments);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_2, blk_1, miner_acc, miner_acc, TESTS_DEFAULT_FEE, fee, 0, 0, empty_extra, attachments);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_to_key failed");
|
||||
events.push_back(tx_2);
|
||||
|
||||
|
|
@ -776,7 +776,7 @@ bool offers_and_stuck_txs::generate(std::vector<test_event_entry>& events) const
|
|||
bc_services::put_offer_into_attachment(uo, attachments);
|
||||
transaction tx_3 = AUTO_VAL_INIT(tx_3);
|
||||
fee = 90 * TESTS_DEFAULT_FEE;
|
||||
r = construct_tx_to_key(events, tx_3, blk_2, miner_acc, miner_acc, TESTS_DEFAULT_FEE, fee, 0, 0, empty_extra, attachments);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_3, blk_2, miner_acc, miner_acc, TESTS_DEFAULT_FEE, fee, 0, 0, empty_extra, attachments);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_to_key failed");
|
||||
events.push_back(tx_3);
|
||||
|
||||
|
|
@ -821,11 +821,11 @@ bool offers_updating_hack::generate(std::vector<test_event_entry>& events) const
|
|||
REWIND_BLOCKS_N(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 2);
|
||||
|
||||
transaction tx_a = AUTO_VAL_INIT(tx_a);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), TESTS_DEFAULT_FEE * 1000, 10, TESTS_DEFAULT_FEE, tx_a);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), TESTS_DEFAULT_FEE * 1000, 10, TESTS_DEFAULT_FEE, tx_a);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_a);
|
||||
transaction tx_b = AUTO_VAL_INIT(tx_b);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), TESTS_DEFAULT_FEE * 1000, 10, TESTS_DEFAULT_FEE, tx_b);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), TESTS_DEFAULT_FEE * 1000, 10, TESTS_DEFAULT_FEE, tx_b);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_b);
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, std::list<transaction>({ tx_a, tx_b }));
|
||||
|
|
@ -854,7 +854,7 @@ bool offers_updating_hack::generate(std::vector<test_event_entry>& events) const
|
|||
bc_services::put_offer_into_attachment(uo, attachments);
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
uint64_t fee = 90 * TESTS_DEFAULT_FEE;
|
||||
r = construct_tx_to_key(events, tx_2, blk_2, alice_acc, alice_acc, TESTS_DEFAULT_FEE, fee, 0, 0, empty_extra, attachments);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_2, blk_2, alice_acc, alice_acc, TESTS_DEFAULT_FEE, fee, 0, 0, empty_extra, attachments);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_to_key failed");
|
||||
events.push_back(tx_2);
|
||||
CHECK_AND_ASSERT_MES(get_tx_fee(tx_2) == fee, false, "Incorrect fee: " << print_money_brief(get_tx_fee(tx_2)) << ", expected: " << print_money_brief(fee));
|
||||
|
|
@ -1058,7 +1058,7 @@ bool offers_multiple_update::generate(std::vector<test_event_entry>& events) con
|
|||
bc_services::put_offer_into_attachment(uo, attachments);
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
uint64_t fee = 14 * TESTS_DEFAULT_FEE;
|
||||
r = construct_tx_to_key(events, tx_2, blk_2, miner_acc, miner_acc, TESTS_DEFAULT_FEE, fee, 0, 0, empty_extra, attachments);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_2, blk_2, miner_acc, miner_acc, TESTS_DEFAULT_FEE, fee, 0, 0, empty_extra, attachments);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_to_key failed");
|
||||
events.push_back(tx_2);
|
||||
|
||||
|
|
@ -1070,7 +1070,7 @@ bool offers_multiple_update::generate(std::vector<test_event_entry>& events) con
|
|||
bc_services::put_offer_into_attachment(uo, attachments);
|
||||
transaction tx_3 = AUTO_VAL_INIT(tx_3);
|
||||
fee = 19 * TESTS_DEFAULT_FEE;
|
||||
r = construct_tx_to_key(events, tx_3, blk_2, miner_acc, miner_acc, TESTS_DEFAULT_FEE, fee, 0, 0, empty_extra, attachments);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_3, blk_2, miner_acc, miner_acc, TESTS_DEFAULT_FEE, fee, 0, 0, empty_extra, attachments);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_to_key failed");
|
||||
events.push_back(tx_3);
|
||||
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ bool construct_homemade_pos_miner_tx(size_t height, size_t median_size, const bo
|
|||
boost::value_initialized<transaction> new_tx;
|
||||
tx = new_tx;
|
||||
|
||||
tx.version = CURRENT_TRANSACTION_VERSION;
|
||||
tx.version = TRANSACTION_VERSION_PRE_HF4;
|
||||
set_tx_unlock_time(tx, height + CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
// calculate block reward
|
||||
|
|
|
|||
|
|
@ -771,14 +771,14 @@ bool pos_wallet_big_block_test::generate(std::vector<test_event_entry>& events)
|
|||
|
||||
crypto::secret_key stub;
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources_1, destinations, extra, empty_attachment, tx_1, stub, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources_1, destinations, extra, empty_attachment, tx_1, get_tx_version_from_events(events), stub, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
size_t tx_size = get_object_blobsize(tx_1);
|
||||
CHECK_AND_ASSERT_MES(tx_size > padding_size, false, "Tx size is: " << tx_size << ", expected to be bigger than: " << padding_size);
|
||||
events.push_back(tx_1); // push it to the pool
|
||||
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
r = construct_tx(miner_acc.get_keys(), sources_2, destinations, extra, empty_attachment, tx_2, stub, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources_2, destinations, extra, empty_attachment, tx_2, get_tx_version_from_events(events), stub, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
tx_size = get_object_blobsize(tx_2);
|
||||
CHECK_AND_ASSERT_MES(tx_size > padding_size, false, "Tx size is: " << tx_size << ", expected to be bigger than: " << padding_size);
|
||||
|
|
@ -1044,7 +1044,7 @@ bool pos_minting_tx_packing::pos_minting_tx_packing::generate(std::vector<test_e
|
|||
// 10 outputs each of (CURRENCY_BLOCK_REWARD * m_pos_mint_packing_size) coins
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), m_alice_start_amount, 10, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), m_alice_start_amount, 10, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
|
||||
events.push_back(tx_1);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ struct ev_visitor : public boost::static_visitor<bool>
|
|||
};
|
||||
|
||||
|
||||
bool generate_blockchain_with_pruned_rs(std::vector<test_event_entry>& events)
|
||||
bool prun_ring_signatures::generate_blockchain_with_pruned_rs(std::vector<test_event_entry>& events)const
|
||||
{
|
||||
uint64_t ts_start = 1338224400;
|
||||
GENERATE_ACCOUNT(miner_account);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public:
|
|||
|
||||
bool set_check_points(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
|
||||
bool check_blockchain(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
|
||||
|
||||
bool generate_blockchain_with_pruned_rs(std::vector<test_event_entry>& events) const;
|
||||
private:
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ using namespace currency;
|
|||
|
||||
bool test_transaction_generation_and_ring_signature()
|
||||
{
|
||||
currency::hard_forks_descriptor hf = AUTO_VAL_INIT(hf);
|
||||
|
||||
account_base miner_acc1;
|
||||
miner_acc1.generate();
|
||||
|
|
@ -39,17 +40,17 @@ bool test_transaction_generation_and_ring_signature()
|
|||
account_base rv_acc2;
|
||||
rv_acc2.generate();
|
||||
transaction tx_mine_1;
|
||||
construct_miner_tx(0, 0, 0, 10, 0, miner_acc1.get_keys().account_address, miner_acc1.get_keys().account_address, tx_mine_1);
|
||||
construct_miner_tx(0, 0, 0, 10, 0, miner_acc1.get_keys().account_address, miner_acc1.get_keys().account_address, tx_mine_1, TRANSACTION_VERSION_PRE_HF4);
|
||||
transaction tx_mine_2;
|
||||
construct_miner_tx(0, 0, 0, 0, 0, miner_acc2.get_keys().account_address, miner_acc2.get_keys().account_address, tx_mine_2);
|
||||
construct_miner_tx(0, 0, 0, 0, 0, miner_acc2.get_keys().account_address, miner_acc2.get_keys().account_address, tx_mine_2, TRANSACTION_VERSION_PRE_HF4);
|
||||
transaction tx_mine_3;
|
||||
construct_miner_tx(0, 0, 0, 0, 0, miner_acc3.get_keys().account_address, miner_acc3.get_keys().account_address, tx_mine_3);
|
||||
construct_miner_tx(0, 0, 0, 0, 0, miner_acc3.get_keys().account_address, miner_acc3.get_keys().account_address, tx_mine_3, TRANSACTION_VERSION_PRE_HF4);
|
||||
transaction tx_mine_4;
|
||||
construct_miner_tx(0, 0, 0, 0, 0, miner_acc4.get_keys().account_address, miner_acc4.get_keys().account_address, tx_mine_4);
|
||||
construct_miner_tx(0, 0, 0, 0, 0, miner_acc4.get_keys().account_address, miner_acc4.get_keys().account_address, tx_mine_4, TRANSACTION_VERSION_PRE_HF4);
|
||||
transaction tx_mine_5;
|
||||
construct_miner_tx(0, 0, 0, 0, 0, miner_acc5.get_keys().account_address, miner_acc5.get_keys().account_address, tx_mine_5);
|
||||
construct_miner_tx(0, 0, 0, 0, 0, miner_acc5.get_keys().account_address, miner_acc5.get_keys().account_address, tx_mine_5, TRANSACTION_VERSION_PRE_HF4);
|
||||
transaction tx_mine_6;
|
||||
construct_miner_tx(0, 0, 0, 0, 0, miner_acc6.get_keys().account_address, miner_acc6.get_keys().account_address, tx_mine_6);
|
||||
construct_miner_tx(0, 0, 0, 0, 0, miner_acc6.get_keys().account_address, miner_acc6.get_keys().account_address, tx_mine_6, TRANSACTION_VERSION_PRE_HF4);
|
||||
|
||||
//fill inputs entry
|
||||
typedef tx_source_entry::output_entry tx_output_entry;
|
||||
|
|
@ -98,7 +99,7 @@ bool test_transaction_generation_and_ring_signature()
|
|||
|
||||
transaction tx_rc1;
|
||||
std::vector<currency::attachment_v> attachments;
|
||||
bool r = construct_tx(miner_acc2.get_keys(), sources, destinations, attachments, tx_rc1, 0);
|
||||
bool r = construct_tx(miner_acc2.get_keys(), sources, destinations, attachments, tx_rc1, get_tx_version(0, hf), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "failed to construct transaction");
|
||||
|
||||
crypto::hash pref_hash = get_transaction_prefix_hash(tx_rc1);
|
||||
|
|
@ -134,7 +135,7 @@ bool test_block_creation()
|
|||
bool r = get_account_address_from_str(adr, "ZxDLGBGXbjo5w51tJkvxEPHFRr7Xft4hf33N8EkJPndoGCqocQF1mzpZqYwXByx5gMbfQuPAAB9vj79EFR6Jwkgu1o3aMQPwJ");
|
||||
CHECK_AND_ASSERT_MES(r, false, "failed to import");
|
||||
block b;
|
||||
r = construct_miner_tx(90, epee::misc_utils::median(szs), 3553616528562147, 33094, 10000000, adr, adr, b.miner_tx);
|
||||
r = construct_miner_tx(90, epee::misc_utils::median(szs), 3553616528562147, 33094, 10000000, adr, adr, b.miner_tx, TRANSACTION_VERSION_PRE_HF4);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
struct tx_builder
|
||||
{
|
||||
void step1_init(size_t version = CURRENT_TRANSACTION_VERSION, uint64_t unlock_time = 0)
|
||||
void step1_init(size_t version = TRANSACTION_VERSION_PRE_HF4, uint64_t unlock_time = 0)
|
||||
{
|
||||
m_tx = AUTO_VAL_INIT(m_tx);
|
||||
m_in_contexts.clear();
|
||||
|
|
@ -126,7 +126,7 @@ struct tx_builder
|
|||
fill_tx_sources_and_destinations(events, blk_head, from, to, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, check_for_unlock_time);
|
||||
|
||||
tx_builder builder;
|
||||
builder.step1_init(CURRENT_TRANSACTION_VERSION, unlock_time);
|
||||
builder.step1_init(TRANSACTION_VERSION_PRE_HF4, unlock_time);
|
||||
builder.step2_fill_inputs(from.get_keys(), sources);
|
||||
builder.step3_fill_outputs(destinations);
|
||||
builder.step4_calc_hash();
|
||||
|
|
|
|||
|
|
@ -775,8 +775,8 @@ gen_crypted_attachments::gen_crypted_attachments()
|
|||
REGISTER_CALLBACK("check_offers_count_befor_cancel", gen_crypted_attachments::check_offers_count_befor_cancel);
|
||||
REGISTER_CALLBACK("check_offers_count_after_cancel", gen_crypted_attachments::check_offers_count_after_cancel);
|
||||
|
||||
m_hardfork_01_height = 0;
|
||||
m_hardfork_02_height = 0; // tx_payer is allowed only after HF2
|
||||
m_hardforks.hard_fork_01_starts_after_height = 0;
|
||||
m_hardforks.hard_fork_02_starts_after_height = 0; // tx_payer is allowed only after HF2
|
||||
}
|
||||
|
||||
bool gen_crypted_attachments::generate(std::vector<test_event_entry>& events) const
|
||||
|
|
@ -818,7 +818,7 @@ bool gen_crypted_attachments::generate(std::vector<test_event_entry>& events) co
|
|||
fill_test_offer_(od);
|
||||
bc_services::put_offer_into_attachment(od, attachments2);
|
||||
bc_services::put_offer_into_attachment(od, attachments2);
|
||||
construct_tx_to_key(events, tx, blk_6, miner_account, miner_account, MK_TEST_COINS(1), TESTS_DEFAULT_FEE, 0, CURRENCY_TO_KEY_OUT_RELAXED, std::vector<currency::extra_v>(), attachments2);
|
||||
construct_tx_to_key(m_hardforks, events, tx, blk_6, miner_account, miner_account, MK_TEST_COINS(1), TESTS_DEFAULT_FEE, 0, CURRENCY_TO_KEY_OUT_RELAXED, std::vector<currency::extra_v>(), attachments2);
|
||||
txs_list2.push_back(tx);
|
||||
events.push_back(tx);
|
||||
|
||||
|
|
@ -868,7 +868,7 @@ bool gen_crypted_attachments::generate(std::vector<test_event_entry>& events) co
|
|||
// currency::get_tx_pub_key_from_extra(tx),
|
||||
// off_key_pair.sec, co.sig);
|
||||
bc_services::put_offer_into_attachment(co, attachments3);
|
||||
construct_tx_to_key(events, tx, blk_7, miner_account, miner_account, MK_TEST_COINS(1), TESTS_DEFAULT_FEE, 0, CURRENCY_TO_KEY_OUT_RELAXED, std::vector<currency::extra_v>(), attachments3);
|
||||
construct_tx_to_key(m_hardforks, events, tx, blk_7, miner_account, miner_account, MK_TEST_COINS(1), TESTS_DEFAULT_FEE, 0, CURRENCY_TO_KEY_OUT_RELAXED, std::vector<currency::extra_v>(), attachments3);
|
||||
txs_list3.push_back(tx);
|
||||
events.push_back(tx);
|
||||
|
||||
|
|
@ -989,8 +989,8 @@ bool gen_tx_extra_double_entry::configure_core(currency::core& c, size_t ev_inde
|
|||
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 = 0;
|
||||
pc.hard_fork_02_starts_after_height = 0;
|
||||
pc.hard_forks.hard_fork_01_starts_after_height = 0;
|
||||
pc.hard_forks.hard_fork_02_starts_after_height = 0;
|
||||
c.get_blockchain_storage().set_core_runtime_config(pc);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1193,7 +1193,7 @@ bool tx_expiration_time::generate(std::vector<test_event_entry>& events) const
|
|||
// transfer to Alice some coins in chunks
|
||||
uint64_t alice_amount = MK_TEST_COINS(10);
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), alice_amount, 10, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), alice_amount, 10, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_1);
|
||||
|
|
@ -1221,7 +1221,7 @@ bool tx_expiration_time::generate(std::vector<test_event_entry>& events) const
|
|||
r = fill_tx_sources_and_destinations(events, blk_2, alice_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(1), TESTS_DEFAULT_FEE, 0, sources, destinations);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_2, 0);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_2, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
set_tx_expiration_time(tx_2, ts_median + TX_EXPIRATION_MEDIAN_SHIFT + 1); // one second greather than minimum allowed
|
||||
r = resign_tx(alice_acc.get_keys(), sources, tx_2);
|
||||
|
|
@ -1239,7 +1239,7 @@ bool tx_expiration_time::generate(std::vector<test_event_entry>& events) const
|
|||
r = fill_tx_sources_and_destinations(events, blk_3, alice_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(1), TESTS_DEFAULT_FEE, 0, sources, destinations);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx_3 = AUTO_VAL_INIT(tx_3);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_3, 0);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_3, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
set_tx_expiration_time(tx_3, ts_median + TX_EXPIRATION_MEDIAN_SHIFT + 0); // exact expiration time, should not pass (see core condition above)
|
||||
r = resign_tx(alice_acc.get_keys(), sources, tx_3);
|
||||
|
|
@ -1304,7 +1304,7 @@ bool tx_expiration_time_and_block_template::generate(std::vector<test_event_entr
|
|||
bool r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), miner_acc.get_public_address(), MK_TEST_COINS(1), TESTS_DEFAULT_FEE, 0, sources, destinations);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
uint64_t tx_1_expiration_time = ts_median + TX_EXPIRATION_MEDIAN_SHIFT + 1; // one second greather than minimum allowed
|
||||
set_tx_expiration_time(tx_1, tx_1_expiration_time);
|
||||
|
|
@ -1376,7 +1376,7 @@ bool tx_expiration_time_and_chain_switching::generate(std::vector<test_event_ent
|
|||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), miner_acc.get_public_address(), MK_TEST_COINS(1), TESTS_DEFAULT_FEE, 0, sources, destinations);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
uint64_t tx_0_expiration_time = ts_median + TX_EXPIRATION_MEDIAN_SHIFT + 0; // one second less than minimum allowed (see condition above)
|
||||
set_tx_expiration_time(tx_0, tx_0_expiration_time);
|
||||
|
|
@ -1497,7 +1497,7 @@ bool tx_key_image_pool_conflict::generate(std::vector<test_event_entry>& events)
|
|||
r = fill_tx_sources_and_destinations(events, blk_0r, m_miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(1), TESTS_DEFAULT_FEE, 0, sources, destinations);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx(m_miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, 0);
|
||||
r = construct_tx(m_miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
LOG_PRINT_YELLOW("tx_0 = " << get_transaction_hash(tx_0), LOG_LEVEL_0);
|
||||
// do not push tx_0 into events yet
|
||||
|
|
|
|||
|
|
@ -216,9 +216,9 @@ bool wallet_rpc_transfer::generate(std::vector<test_event_entry>& events) const
|
|||
bool wallet_rpc_transfer::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.hard_fork_01_starts_after_height = 1;
|
||||
pc.hard_fork_02_starts_after_height = 1;
|
||||
pc.hard_fork_03_starts_after_height = 1;
|
||||
pc.hard_forks.hard_fork_01_starts_after_height = 1;
|
||||
pc.hard_forks.hard_fork_02_starts_after_height = 1;
|
||||
pc.hard_forks.hard_fork_03_starts_after_height = 1;
|
||||
c.get_blockchain_storage().set_core_runtime_config(pc);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1319,7 +1319,7 @@ bool gen_wallet_transfers_and_chain_switch::generate(std::vector<test_event_entr
|
|||
REWIND_BLOCKS_N(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(30) * 2, 2, TESTS_DEFAULT_FEE, tx_0);
|
||||
bool r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(30) * 2, 2, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_0);
|
||||
|
|
@ -1381,8 +1381,8 @@ bool gen_wallet_transfers_and_chain_switch::generate(std::vector<test_event_entr
|
|||
gen_wallet_decrypted_attachments::gen_wallet_decrypted_attachments()
|
||||
: m_on_transfer2_called(false)
|
||||
{
|
||||
m_hardfork_01_height = 0;
|
||||
m_hardfork_02_height = 0; // tx_payer requires HF2
|
||||
m_hardforks.hard_fork_01_starts_after_height = 0;
|
||||
m_hardforks.hard_fork_02_starts_after_height = 0; // tx_payer requires HF2
|
||||
}
|
||||
|
||||
bool gen_wallet_decrypted_attachments::generate(std::vector<test_event_entry>& events) const
|
||||
|
|
@ -1562,8 +1562,8 @@ void gen_wallet_decrypted_attachments::on_transfer2(const tools::wallet_public::
|
|||
|
||||
gen_wallet_alias_and_unconfirmed_txs::gen_wallet_alias_and_unconfirmed_txs()
|
||||
{
|
||||
m_hardfork_01_height = 0;
|
||||
m_hardfork_02_height = 0;
|
||||
m_hardforks.hard_fork_01_starts_after_height = 0;
|
||||
m_hardforks.hard_fork_02_starts_after_height = 0;
|
||||
|
||||
REGISTER_CALLBACK_METHOD(gen_wallet_alias_and_unconfirmed_txs, c1);
|
||||
REGISTER_CALLBACK_METHOD(gen_wallet_alias_and_unconfirmed_txs, c2);
|
||||
|
|
@ -1711,8 +1711,8 @@ bool gen_wallet_alias_and_unconfirmed_txs::c3(currency::core& c, size_t ev_index
|
|||
gen_wallet_alias_via_special_wallet_funcs::gen_wallet_alias_via_special_wallet_funcs()
|
||||
{
|
||||
// start hardfork from block 0 in order to use extra_alias_entry (allowed only since HF2)
|
||||
m_hardfork_01_height = 0;
|
||||
m_hardfork_02_height = 0;
|
||||
m_hardforks.hard_fork_01_starts_after_height = 0;
|
||||
m_hardforks.hard_fork_02_starts_after_height = 0;
|
||||
REGISTER_CALLBACK_METHOD(gen_wallet_alias_via_special_wallet_funcs, c1);
|
||||
}
|
||||
|
||||
|
|
@ -2208,7 +2208,7 @@ bool gen_wallet_offers_size_limit::generate(std::vector<test_event_entry>& event
|
|||
}
|
||||
|
||||
// generates such an offer so that result tx will most like have its size within the giving limits
|
||||
bool generate_oversized_offer(size_t min_size, size_t max_size, bc_services::offer_details_ex& result)
|
||||
bool generate_oversized_offer(size_t min_size, size_t max_size, bc_services::offer_details_ex& result, uint64_t tx_version)
|
||||
{
|
||||
bc_services::offer_details_ex r = AUTO_VAL_INIT(r);
|
||||
result = r;
|
||||
|
|
@ -2226,7 +2226,7 @@ bool generate_oversized_offer(size_t min_size, size_t max_size, bc_services::off
|
|||
// construct fake tx to estimate it's size
|
||||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
crypto::secret_key one_time_secret_key;
|
||||
if (!construct_tx(account_keys(), std::vector<tx_source_entry>(), std::vector<tx_destination_entry>(), empty_extra, att_container, tx, one_time_secret_key, 0, 0, true, 0))
|
||||
if (!construct_tx(account_keys(), std::vector<tx_source_entry>(), std::vector<tx_destination_entry>(), empty_extra, att_container, tx, tx_version, one_time_secret_key, 0, 0, true, 0))
|
||||
return false;
|
||||
|
||||
size_t sz = get_object_blobsize(tx);
|
||||
|
|
@ -2257,12 +2257,12 @@ bool gen_wallet_offers_size_limit::c1(currency::core& c, size_t ev_index, const
|
|||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
|
||||
|
||||
bc_services::offer_details_ex od_normal = AUTO_VAL_INIT(od_normal);
|
||||
bool r = generate_oversized_offer(CURRENCY_MAX_TRANSACTION_BLOB_SIZE - 2048, CURRENCY_MAX_TRANSACTION_BLOB_SIZE - 1024, od_normal); // generate biggest offer but within tx size limits
|
||||
bool r = generate_oversized_offer(CURRENCY_MAX_TRANSACTION_BLOB_SIZE - 2048, CURRENCY_MAX_TRANSACTION_BLOB_SIZE - 1024, od_normal, c.get_current_tx_version()); // generate biggest offer but within tx size limits
|
||||
CHECK_AND_ASSERT_MES(r, false, "generate_oversized_offer failed");
|
||||
od_normal.fee = TESTS_DEFAULT_FEE;
|
||||
|
||||
bc_services::offer_details_ex od_oversized = AUTO_VAL_INIT(od_oversized);
|
||||
r = generate_oversized_offer(CURRENCY_MAX_TRANSACTION_BLOB_SIZE, CURRENCY_MAX_TRANSACTION_BLOB_SIZE + 1024, od_oversized);
|
||||
r = generate_oversized_offer(CURRENCY_MAX_TRANSACTION_BLOB_SIZE, CURRENCY_MAX_TRANSACTION_BLOB_SIZE + 1024, od_oversized, c.get_current_tx_version());
|
||||
CHECK_AND_ASSERT_MES(r, false, "generate_oversized_offer failed");
|
||||
od_oversized.fee = TESTS_DEFAULT_FEE;
|
||||
|
||||
|
|
@ -3051,11 +3051,11 @@ bool wallet_unconfirmed_tx_expiration::generate(std::vector<test_event_entry>& e
|
|||
|
||||
bool r = false;
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), TESTS_DEFAULT_FEE * 20, 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), TESTS_DEFAULT_FEE * 20, 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs");
|
||||
events.push_back(tx_0);
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), TESTS_DEFAULT_FEE * 20, 10, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), TESTS_DEFAULT_FEE * 20, 10, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs");
|
||||
events.push_back(tx_1);
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, std::list<transaction>({ tx_0, tx_1 }));
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ bool create_block_template_manually(const currency::block& prev_block, boost::mu
|
|||
// make things really simple by assuming block size is less than CURRENCY_BLOCK_GRANTED_FULL_REWARD_ZONE
|
||||
size_t median_size = 0;
|
||||
|
||||
bool r = construct_miner_tx(get_block_height(prev_block) + 1, median_size, already_generated_coins, txs_size, fee, miner_addr, miner_addr, result.miner_tx);
|
||||
bool r = construct_miner_tx(get_block_height(prev_block) + 1, median_size, already_generated_coins, txs_size, fee, miner_addr, miner_addr, result.miner_tx, TRANSACTION_VERSION_PRE_HF4);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_miner_tx failed");
|
||||
|
||||
size_t coinbase_size = get_object_blobsize(result.miner_tx);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public:
|
|||
{
|
||||
m_miners[i].generate();
|
||||
|
||||
if (!construct_miner_tx(0, 0, 0, 2, 0, m_miners[i].get_keys().m_account_address, m_miner_txs[i]))
|
||||
if (!construct_miner_tx(0, 0, 0, 2, 0, m_miners[i].get_keys().m_account_address, m_miner_txs[i], TRANSACTION_VERSION_PRE_HF4))
|
||||
return false;
|
||||
|
||||
txout_to_key tx_out = boost::get<txout_to_key>(m_miner_txs[i].vout[0].target);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public:
|
|||
|
||||
m_bob.generate();
|
||||
|
||||
if (!construct_miner_tx(0, 0, 0, 2, 0, m_bob.get_keys().account_address, m_bob.get_keys().account_address, m_tx, blobdata(), CURRENCY_MINER_TX_MAX_OUTS))
|
||||
if (!construct_miner_tx(0, 0, 0, 2, 0, m_bob.get_keys().account_address, m_bob.get_keys().account_address, m_tx, TRANSACTION_VERSION_PRE_HF4, blobdata(), CURRENCY_MINER_TX_MAX_OUTS))
|
||||
return false;
|
||||
|
||||
m_tx_pub_key = get_tx_pub_key_from_extra(m_tx);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ TEST(parse_and_validate_tx_extra, is_correct_parse_and_validate_tx_extra)
|
|||
currency::account_base acc;
|
||||
acc.generate();
|
||||
currency::blobdata b = "dsdsdfsdfsf";
|
||||
bool r = currency::construct_miner_tx(0, 0, 10000000000000, 1000, TESTS_DEFAULT_FEE, acc.get_keys().account_address, acc.get_keys().account_address, tx, b, 1);
|
||||
bool r = currency::construct_miner_tx(0, 0, 10000000000000, 1000, TESTS_DEFAULT_FEE, acc.get_keys().account_address, acc.get_keys().account_address, tx, TRANSACTION_VERSION_PRE_HF4, b, 1);
|
||||
ASSERT_TRUE(r);
|
||||
crypto::public_key tx_pub_key;
|
||||
r = currency::parse_and_validate_tx_extra(tx, tx_pub_key);
|
||||
|
|
@ -26,7 +26,7 @@ TEST(parse_and_validate_tx_extra, is_correct_extranonce_too_big)
|
|||
currency::account_base acc;
|
||||
acc.generate();
|
||||
currency::blobdata b(260, 0);
|
||||
bool r = currency::construct_miner_tx(0, 0, 10000000000000, 1000, TESTS_DEFAULT_FEE, acc.get_keys().account_address, acc.get_keys().account_address, tx, b, 1);
|
||||
bool r = currency::construct_miner_tx(0, 0, 10000000000000, 1000, TESTS_DEFAULT_FEE, acc.get_keys().account_address, acc.get_keys().account_address, tx, TRANSACTION_VERSION_PRE_HF4, b, 1);
|
||||
ASSERT_FALSE(r);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue