forked from lthn/blockchain
tx hf id: WIP
This commit is contained in:
parent
8e2c70de93
commit
8dd8a6ac1c
25 changed files with 355 additions and 177 deletions
|
|
@ -1442,12 +1442,13 @@ namespace currency
|
|||
const std::vector<attachment_v>& attachments,
|
||||
transaction& tx,
|
||||
uint64_t tx_version,
|
||||
size_t tx_hardfork_id,
|
||||
uint64_t unlock_time,
|
||||
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, tx_version, one_time_secret_key, unlock_time, tx_outs_attr, shuffle);
|
||||
crypto::secret_key one_time_secret_key{};
|
||||
return construct_tx(sender_account_keys, sources, destinations, std::vector<extra_v>(), attachments, tx, tx_version, tx_hardfork_id, one_time_secret_key, unlock_time, tx_outs_attr, shuffle);
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
|
||||
|
|
@ -1967,6 +1968,7 @@ namespace currency
|
|||
const std::vector<attachment_v>& attachments,
|
||||
transaction& tx,
|
||||
uint64_t tx_version,
|
||||
size_t tx_hardfork_id,
|
||||
crypto::secret_key& one_time_secret_key,
|
||||
uint64_t unlock_time,
|
||||
uint8_t tx_outs_attr,
|
||||
|
|
@ -1979,7 +1981,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, tx_version, one_time_secret_key, unlock_time,
|
||||
return construct_tx(sender_account_keys, sources, destinations, extra, attachments, tx, tx_version, tx_hardfork_id, one_time_secret_key, unlock_time,
|
||||
crypt_destination_addr,
|
||||
0,
|
||||
tx_outs_attr,
|
||||
|
|
@ -1993,6 +1995,7 @@ namespace currency
|
|||
const std::vector<attachment_v>& attachments,
|
||||
transaction& tx,
|
||||
uint64_t tx_version,
|
||||
size_t tx_hardfork_id,
|
||||
crypto::secret_key& one_time_secret_key,
|
||||
uint64_t unlock_time,
|
||||
const account_public_address& crypt_destination_addr,
|
||||
|
|
@ -2002,8 +2005,9 @@ namespace currency
|
|||
uint64_t flags)
|
||||
{
|
||||
//extra copy operation, but creating transaction is not sensitive to this
|
||||
finalize_tx_param ftp = AUTO_VAL_INIT(ftp);
|
||||
finalize_tx_param ftp{};
|
||||
ftp.tx_version = tx_version;
|
||||
ftp.tx_hardfork_id = tx_hardfork_id;
|
||||
ftp.sources = sources;
|
||||
ftp.prepared_destinations = destinations;
|
||||
ftp.extra = extra;
|
||||
|
|
@ -2015,7 +2019,7 @@ namespace currency
|
|||
ftp.shuffle = shuffle;
|
||||
ftp.flags = flags;
|
||||
|
||||
finalized_tx ft = AUTO_VAL_INIT(ft);
|
||||
finalized_tx ft{};
|
||||
ft.tx = tx;
|
||||
ft.one_time_key = one_time_secret_key;
|
||||
bool r = construct_tx(sender_account_keys, ftp, ft);
|
||||
|
|
@ -2405,6 +2409,9 @@ namespace currency
|
|||
tx.signatures.clear();
|
||||
|
||||
tx.version = ftp.tx_version;
|
||||
if (tx.version >= TRANSACTION_VERSION_POST_HF5)
|
||||
tx.hardfork_id = ftp.tx_hardfork_id;
|
||||
|
||||
if (unlock_time != 0)
|
||||
set_tx_unlock_time(tx, unlock_time);
|
||||
|
||||
|
|
|
|||
|
|
@ -163,6 +163,7 @@ namespace currency
|
|||
uint64_t expiration_time;
|
||||
crypto::public_key spend_pub_key; // only for validations
|
||||
uint64_t tx_version;
|
||||
uint8_t tx_hardfork_id = 0;
|
||||
uint64_t mode_separate_fee = 0;
|
||||
|
||||
epee::misc_utils::events_dispatcher* pevents_dispatcher = nullptr;
|
||||
|
|
@ -187,6 +188,7 @@ namespace currency
|
|||
FIELD(expiration_time)
|
||||
FIELD(spend_pub_key)
|
||||
FIELD(tx_version)
|
||||
FIELD(tx_hardfork_id)
|
||||
FIELD(mode_separate_fee)
|
||||
if (flags & TX_FLAG_SIGNATURE_MODE_SEPARATE)
|
||||
{
|
||||
|
|
@ -318,9 +320,11 @@ namespace currency
|
|||
const std::vector<attachment_v>& attachments,
|
||||
transaction& tx,
|
||||
uint64_t tx_version,
|
||||
size_t tx_hardfork_id,
|
||||
uint64_t unlock_time,
|
||||
uint8_t tx_outs_attr = CURRENCY_TO_KEY_OUT_RELAXED,
|
||||
bool shuffle = true);
|
||||
|
||||
bool construct_tx(const account_keys& sender_account_keys,
|
||||
const std::vector<tx_source_entry>& sources,
|
||||
const std::vector<tx_destination_entry>& destinations,
|
||||
|
|
@ -328,6 +332,7 @@ namespace currency
|
|||
const std::vector<attachment_v>& attachments,
|
||||
transaction& tx,
|
||||
uint64_t tx_version,
|
||||
size_t tx_hardfork_id,
|
||||
crypto::secret_key& one_time_secret_key,
|
||||
uint64_t unlock_time,
|
||||
uint8_t tx_outs_attr = CURRENCY_TO_KEY_OUT_RELAXED,
|
||||
|
|
@ -341,6 +346,7 @@ namespace currency
|
|||
const std::vector<attachment_v>& attachments,
|
||||
transaction& tx,
|
||||
uint64_t tx_version,
|
||||
size_t tx_hardfork_id,
|
||||
crypto::secret_key& one_time_secret_key,
|
||||
uint64_t unlock_time,
|
||||
const account_public_address& crypt_account,
|
||||
|
|
|
|||
|
|
@ -975,7 +975,9 @@ bool gen_alias_too_much_reward::generate(std::vector<test_event_entry>& events)
|
|||
d.flags |= tx_destination_entry_flags::tdef_explicit_native_asset_id | tx_destination_entry_flags::tdef_zero_amount_blinding_mask;
|
||||
transaction tx_0{};
|
||||
crypto::secret_key sk{};
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, std::vector<currency::extra_v>({ ai }), empty_attachment, tx_0, get_tx_version_from_events(events), sk, 0);
|
||||
size_t tx_hardfork_id{};
|
||||
uint64_t tx_version = get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, std::vector<currency::extra_v>({ ai }), empty_attachment, tx_0, tx_version, tx_hardfork_id, sk, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
if (tx_0.version <= TRANSACTION_VERSION_PRE_HF4)
|
||||
|
|
@ -1166,8 +1168,9 @@ bool gen_alias_too_small_reward::make_tx_reg_alias(std::vector<test_event_entry>
|
|||
destinations.push_back(tx_destination_entry(sources_amount - (alias_reward + TESTS_DEFAULT_FEE), miner_acc.get_public_address())); // change
|
||||
|
||||
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));
|
||||
size_t tx_hardfork_id{};
|
||||
uint64_t tx_version = get_tx_version_and_hardfork_id(get_block_height(prev_block), m_hardforks, tx_hardfork_id);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx, tx_version, tx_hardfork_id, stub, uint64_t(0));
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
PRINT_EVENT_N_TEXT(events, "make_tx_reg_alias -> construct_tx()");
|
||||
events.push_back(tx);
|
||||
|
|
@ -1382,8 +1385,9 @@ 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);
|
||||
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);
|
||||
size_t tx_hardfork_id{};
|
||||
uint64_t tx_version = get_tx_version_and_hardfork_id(get_block_height(blk_0r), m_hardforks, tx_hardfork_id);
|
||||
r = construct_tx(preminer_acc.get_keys(), sources, destinations, empty_attachment, tx_1, tx_version, tx_hardfork_id, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
events.push_back(tx_1);
|
||||
|
|
@ -1494,9 +1498,10 @@ bool gen_alias_update_for_free::generate(std::vector<test_event_entry>& events)
|
|||
}
|
||||
|
||||
transaction tx{};
|
||||
uint64_t tx_version = currency::get_tx_version(get_block_height(blk_0r) + 1, generator.get_hardforks());
|
||||
size_t tx_hardfork_id{};
|
||||
uint64_t tx_version = currency::get_tx_version_and_hardfork_id(get_block_height(blk_0r) + 1, generator.get_hardforks(), tx_hardfork_id);
|
||||
crypto::secret_key sk{};
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, std::vector<extra_v>({ ai }), empty_attachment, tx, tx_version, sk, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, std::vector<extra_v>({ ai }), empty_attachment, tx, tx_version, tx_hardfork_id, sk, 0);
|
||||
|
||||
/*tx_builder tb;
|
||||
tb.step1_init();
|
||||
|
|
|
|||
|
|
@ -321,10 +321,9 @@ bool gen_block_miner_tx_has_2_in::generate(std::vector<test_event_entry>& events
|
|||
destinations.push_back(de);
|
||||
|
||||
transaction tmp_tx;
|
||||
std::vector<currency::attachment_v> attachments;
|
||||
|
||||
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))
|
||||
if (!construct_tx(miner_account.get_keys(), sources, destinations, empty_extra, empty_attachment, tmp_tx, tx_version))
|
||||
return false;
|
||||
|
||||
MAKE_MINER_TX_MANUALLY(miner_tx, blk_0);
|
||||
|
|
@ -369,9 +368,8 @@ bool gen_block_miner_tx_with_txin_to_key::generate(std::vector<test_event_entry>
|
|||
destinations.push_back(de);
|
||||
|
||||
transaction tmp_tx = AUTO_VAL_INIT(tmp_tx);
|
||||
std::vector<currency::attachment_v> attachments;
|
||||
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))
|
||||
if (!construct_tx(miner_account.get_keys(), sources, destinations, empty_extra, empty_attachment, tmp_tx, tx_version))
|
||||
return false;
|
||||
|
||||
MAKE_MINER_TX_MANUALLY(miner_tx, blk_1);
|
||||
|
|
|
|||
|
|
@ -532,9 +532,10 @@ 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()));
|
||||
destinations.push_back(tx_destination_entry(TESTS_DEFAULT_FEE, miner_acc.get_public_address())); //just to make two outputs (to please HF4 rules)
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
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);
|
||||
transaction tx_1{};
|
||||
size_t tx_hardfork_id{};
|
||||
uint64_t tx_version = get_tx_version_and_hardfork_id(get_block_height(blk_3), m_hardforks, tx_hardfork_id);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, tx_version, tx_hardfork_id, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
ADD_CUSTOM_EVENT(events, tx_1);
|
||||
|
||||
|
|
@ -544,8 +545,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
|
||||
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);
|
||||
tx_version = get_tx_version_and_hardfork_id(get_block_height(blk_3), m_hardforks, tx_hardfork_id);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_2, tx_version, tx_hardfork_id, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
ADD_CUSTOM_EVENT(events, tx_2);
|
||||
|
||||
|
|
@ -913,16 +914,10 @@ bool alt_chain_and_block_tx_fee_median::generate(
|
|||
|
||||
CHECK_AND_ASSERT_MES(success, false, "fail to fill sources, destinations");
|
||||
|
||||
tx_version = get_tx_version(get_block_height(blk_1r),
|
||||
m_hardforks);
|
||||
size_t tx_hardfork_id{};
|
||||
tx_version = get_tx_version_and_hardfork_id(get_block_height(blk_1r), m_hardforks, tx_hardfork_id);
|
||||
|
||||
success = construct_tx(miner.get_keys(),
|
||||
sources,
|
||||
destinations,
|
||||
empty_attachment,
|
||||
tx_0,
|
||||
tx_version,
|
||||
0);
|
||||
success = construct_tx(miner.get_keys(), sources, destinations, empty_attachment, tx_0, tx_version, tx_hardfork_id, 0);
|
||||
|
||||
CHECK_AND_ASSERT_MES(success, false, "fail to construct tx_0");
|
||||
|
||||
|
|
@ -934,8 +929,7 @@ bool alt_chain_and_block_tx_fee_median::generate(
|
|||
|
||||
// Transaction tx_1 is constructed and placed in block blk_2a.
|
||||
|
||||
tx_version = get_tx_version(get_block_height(blk_1r),
|
||||
m_hardforks);
|
||||
tx_version = get_tx_version_and_hardfork_id(get_block_height(blk_1r), m_hardforks, tx_hardfork_id);
|
||||
|
||||
success = fill_tx_sources_and_destinations(
|
||||
events,
|
||||
|
|
@ -950,13 +944,7 @@ bool alt_chain_and_block_tx_fee_median::generate(
|
|||
|
||||
CHECK_AND_ASSERT_MES(success, false, "fail to fill sources, destinations");
|
||||
|
||||
success = construct_tx(miner.get_keys(),
|
||||
sources,
|
||||
destinations,
|
||||
empty_attachment,
|
||||
tx_1,
|
||||
tx_version,
|
||||
0);
|
||||
success = construct_tx(miner.get_keys(), sources, destinations, empty_attachment, tx_1, tx_version, tx_hardfork_id, 0);
|
||||
|
||||
CHECK_AND_ASSERT_MES(success, false, "fail to construct tx_1");
|
||||
|
||||
|
|
|
|||
|
|
@ -1750,8 +1750,9 @@ bool construct_tx_to_key(const currency::hard_forks_descriptor& hf,
|
|||
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;
|
||||
uint64_t tx_version = currency::get_tx_version(get_block_height(blk_head) + 1, hf); // assuming the tx will be in the next block (blk_head + 1)
|
||||
return construct_tx(from.get_keys(), sources, destinations, extr, att, tx, tx_version, sk, 0, mix_attr);
|
||||
size_t tx_hardfork_id = 0;
|
||||
uint64_t tx_version = currency::get_tx_version_and_hardfork_id(get_block_height(blk_head) + 1, hf, tx_hardfork_id); // assuming the tx will be in the next block (blk_head + 1)
|
||||
return construct_tx(from.get_keys(), sources, destinations, extr, att, tx, tx_version, tx_hardfork_id, sk, 0, mix_attr);
|
||||
}
|
||||
|
||||
bool construct_tx_to_key(const currency::hard_forks_descriptor& hf,
|
||||
|
|
@ -1779,16 +1780,17 @@ bool construct_tx_to_key(const currency::hard_forks_descriptor& hf,
|
|||
return false;
|
||||
|
||||
uint64_t tx_expected_block_height = get_block_height(blk_head) + 1;
|
||||
uint64_t tx_version = currency::get_tx_version(tx_expected_block_height, hf);
|
||||
size_t tx_hardfork_id = 0;
|
||||
uint64_t tx_version = currency::get_tx_version_and_hardfork_id(tx_expected_block_height, hf, tx_hardfork_id);
|
||||
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, tx_version, sk, 0, mix_attr);
|
||||
return construct_tx(from.get_keys(), sources, destinations, extr, att, tx, tx_version, tx_hardfork_id, 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, tx_version, sk, 0, mix_attr);
|
||||
return construct_tx(from.get_keys(), sources, local_dst, extr, att, tx, tx_version, tx_hardfork_id, sk, 0, mix_attr);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1817,8 +1819,53 @@ bool construct_tx_with_many_outputs(const currency::hard_forks_descriptor& hf, s
|
|||
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
|
||||
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);
|
||||
size_t tx_hardfork_id = 0;
|
||||
uint64_t tx_version = currency::get_tx_version_and_hardfork_id(currency::get_block_height(blk_head), hf, tx_hardfork_id);
|
||||
return construct_tx(keys_from, sources, destinations, empty_attachment, tx, tx_version, tx_hardfork_id, 0);
|
||||
}
|
||||
|
||||
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<extra_v>& extra,
|
||||
const std::vector<attachment_v>& attachments,
|
||||
transaction& tx,
|
||||
uint64_t tx_version,
|
||||
size_t tx_hardfork_id,
|
||||
crypto::secret_key& one_time_secret_key,
|
||||
uint64_t unlock_time,
|
||||
uint64_t expiration_time,
|
||||
uint8_t tx_outs_attr,
|
||||
bool shuffle,
|
||||
uint64_t flags,
|
||||
uint64_t explicit_consolidated_tx_fee,
|
||||
tx_generation_context& gen_context)
|
||||
{
|
||||
// extra copy operation, but creating transaction is not sensitive to this
|
||||
finalize_tx_param ftp {};
|
||||
ftp.tx_version = tx_version;
|
||||
ftp.tx_hardfork_id = tx_hardfork_id;
|
||||
ftp.sources = sources;
|
||||
ftp.prepared_destinations = destinations;
|
||||
ftp.extra = extra;
|
||||
ftp.attachments = attachments;
|
||||
ftp.unlock_time = unlock_time;
|
||||
// ftp.crypt_address = crypt_destination_addr;
|
||||
ftp.expiration_time = expiration_time;
|
||||
ftp.tx_outs_attr = tx_outs_attr;
|
||||
ftp.shuffle = shuffle;
|
||||
ftp.flags = flags;
|
||||
ftp.mode_separate_fee = explicit_consolidated_tx_fee;
|
||||
|
||||
finalized_tx ft{};
|
||||
ft.tx = tx;
|
||||
ft.one_time_key = one_time_secret_key;
|
||||
ftp.gen_context = gen_context; // ftp, not ft here, this is UGLY -- sowle
|
||||
bool r = construct_tx(sender_account_keys, ftp, ft);
|
||||
tx = ft.tx;
|
||||
one_time_secret_key = ft.one_time_key;
|
||||
gen_context = ft.ftp.gen_context;
|
||||
return r;
|
||||
}
|
||||
|
||||
bool construct_tx(const account_keys& sender_account_keys,
|
||||
|
|
@ -1840,6 +1887,9 @@ bool construct_tx(const account_keys& sender_account_keys,
|
|||
// extra copy operation, but creating transaction is not sensitive to this
|
||||
finalize_tx_param ftp {};
|
||||
ftp.tx_version = tx_version;
|
||||
if (tx_version >= TRANSACTION_VERSION_POST_HF5)
|
||||
LOG_PRINT_YELLOW("warning: tx_hardfork_id not set for tx, while it seems to be HF5", LOG_LEVEL_0);
|
||||
ftp.tx_hardfork_id = 0;
|
||||
ftp.sources = sources;
|
||||
ftp.prepared_destinations = destinations;
|
||||
ftp.extra = extra;
|
||||
|
|
@ -1852,7 +1902,7 @@ bool construct_tx(const account_keys& sender_account_keys,
|
|||
ftp.flags = flags;
|
||||
ftp.mode_separate_fee = explicit_consolidated_tx_fee;
|
||||
|
||||
finalized_tx ft = AUTO_VAL_INIT(ft);
|
||||
finalized_tx ft{};
|
||||
ft.tx = tx;
|
||||
ft.one_time_key = one_time_secret_key;
|
||||
ftp.gen_context = gen_context; // ftp, not ft here, this is UGLY -- sowle
|
||||
|
|
@ -1863,6 +1913,60 @@ bool construct_tx(const account_keys& sender_account_keys,
|
|||
return r;
|
||||
}
|
||||
|
||||
bool construct_tx(const currency::account_keys& sender_account_keys,
|
||||
const std::vector<currency::tx_source_entry>& sources,
|
||||
const std::vector<currency::tx_destination_entry>& destinations,
|
||||
const std::vector<currency::extra_v>& extra,
|
||||
const std::vector<currency::attachment_v>& attachments,
|
||||
currency::transaction& tx,
|
||||
uint64_t tx_version,
|
||||
crypto::secret_key& one_time_secret_key,
|
||||
uint64_t unlock_time)
|
||||
{
|
||||
return construct_tx(sender_account_keys,
|
||||
sources,
|
||||
destinations,
|
||||
extra,
|
||||
attachments,
|
||||
tx,
|
||||
tx_version,
|
||||
one_time_secret_key,
|
||||
unlock_time,
|
||||
0, /* expiration_time */
|
||||
CURRENCY_TO_KEY_OUT_RELAXED, /* tx_outs_attr */
|
||||
true, /* shuffle */
|
||||
0, /* flags */
|
||||
0, /* explicit_consolidated_tx_fee */
|
||||
tx_generation_context{}
|
||||
);
|
||||
}
|
||||
|
||||
bool construct_tx(const currency::account_keys& sender_account_keys,
|
||||
const std::vector<currency::tx_source_entry>& sources,
|
||||
const std::vector<currency::tx_destination_entry>& destinations,
|
||||
const std::vector<currency::extra_v>& extra,
|
||||
const std::vector<currency::attachment_v>& attachments,
|
||||
currency::transaction& tx,
|
||||
uint64_t tx_version)
|
||||
{
|
||||
return construct_tx(sender_account_keys,
|
||||
sources,
|
||||
destinations,
|
||||
extra,
|
||||
attachments,
|
||||
tx,
|
||||
tx_version,
|
||||
crypto::secret_key{}, /* one_time_secret_key */
|
||||
0, /* unlock_time */
|
||||
0, /* expiration_time */
|
||||
CURRENCY_TO_KEY_OUT_RELAXED, /* tx_outs_attr */
|
||||
true, /* shuffle */
|
||||
0, /* flags */
|
||||
0, /* explicit_consolidated_tx_fee */
|
||||
tx_generation_context{}
|
||||
);
|
||||
}
|
||||
|
||||
uint64_t get_balance(const currency::account_keys& addr, const std::vector<currency::block>& blockchain, const map_hash2tx_t& mtx, bool dbg_log)
|
||||
{
|
||||
uint64_t res = 0;
|
||||
|
|
@ -2565,19 +2669,26 @@ 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
|
||||
uint64_t test_chain_unit_base::get_tx_version_from_events(const std::vector<test_event_entry> &events) const
|
||||
{
|
||||
[[maybe_unused]] size_t tx_hardfork_id{};
|
||||
return get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id);
|
||||
}
|
||||
|
||||
uint64_t test_chain_unit_base::get_tx_version_and_harfork_id_from_events(const std::vector<test_event_entry> &events, size_t& tx_hardfork_id) 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_and_hardfork_id(get_block_height(b), m_hardforks, tx_hardfork_id);
|
||||
}
|
||||
}
|
||||
return currency::get_tx_version(0, m_hardforks);
|
||||
return currency::get_tx_version_and_hardfork_id(0, m_hardforks, tx_hardfork_id);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -257,6 +257,7 @@ 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;
|
||||
uint64_t get_tx_version_and_harfork_id_from_events(const std::vector<test_event_entry> &events, size_t& tx_hardfork_id) const;
|
||||
|
||||
virtual void on_test_constructed() {} // called right after test class is constructed by the chaingen
|
||||
void on_test_generator_created(test_generator& generator) const; // tests can override this for special initialization
|
||||
|
|
@ -691,6 +692,41 @@ bool construct_tx(const currency::account_keys& sender_account_keys,
|
|||
uint64_t explicit_consolidated_tx_fee,
|
||||
currency::tx_generation_context& gen_context);
|
||||
|
||||
bool construct_tx(const currency::account_keys& sender_account_keys,
|
||||
const std::vector<currency::tx_source_entry>& sources,
|
||||
const std::vector<currency::tx_destination_entry>& destinations,
|
||||
const std::vector<currency::extra_v>& extra,
|
||||
const std::vector<currency::attachment_v>& attachments,
|
||||
currency::transaction& tx,
|
||||
uint64_t tx_version,
|
||||
size_t tx_hardfork_id,
|
||||
crypto::secret_key& one_time_secret_key,
|
||||
uint64_t unlock_time,
|
||||
uint64_t expiration_time,
|
||||
uint8_t tx_outs_attr,
|
||||
bool shuffle,
|
||||
uint64_t flags,
|
||||
uint64_t explicit_consolidated_tx_fee,
|
||||
currency::tx_generation_context& gen_context);
|
||||
|
||||
bool construct_tx(const currency::account_keys& sender_account_keys,
|
||||
const std::vector<currency::tx_source_entry>& sources,
|
||||
const std::vector<currency::tx_destination_entry>& destinations,
|
||||
const std::vector<currency::extra_v>& extra,
|
||||
const std::vector<currency::attachment_v>& attachments,
|
||||
currency::transaction& tx,
|
||||
uint64_t tx_version,
|
||||
crypto::secret_key& one_time_secret_key,
|
||||
uint64_t unlock_time);
|
||||
|
||||
bool construct_tx(const currency::account_keys& sender_account_keys,
|
||||
const std::vector<currency::tx_source_entry>& sources,
|
||||
const std::vector<currency::tx_destination_entry>& destinations,
|
||||
const std::vector<currency::extra_v>& extra,
|
||||
const std::vector<currency::attachment_v>& attachments,
|
||||
currency::transaction& tx,
|
||||
uint64_t tx_version);
|
||||
|
||||
void get_confirmed_txs(const std::vector<currency::block>& blockchain, const map_hash2tx_t& mtx, map_hash2tx_t& confirmed_txs);
|
||||
bool find_block_chain(const std::vector<test_event_entry>& events, std::vector<currency::block>& blockchain, map_hash2tx_t& mtx, const crypto::hash& head);
|
||||
bool fill_tx_sources(std::vector<currency::tx_source_entry>& sources, const std::vector<test_event_entry>& events,
|
||||
|
|
|
|||
|
|
@ -313,9 +313,10 @@ inline bool put_alias_via_tx_to_list(const currency::hard_forks_descriptor& hf,
|
|||
el.flags |= currency::tx_destination_entry_flags::tdef_explicit_native_asset_id | currency::tx_destination_entry_flags::tdef_zero_amount_blinding_mask; // all alias-burn outputs must have explicit native asset id and zero amount mask
|
||||
}
|
||||
|
||||
uint64_t tx_version = currency::get_tx_version(get_block_height(head_block) + 1, generator.get_hardforks()); // assuming the tx will be in the next block (head_block + 1)
|
||||
size_t tx_hardfork_id{};
|
||||
uint64_t tx_version = currency::get_tx_version_and_hardfork_id(get_block_height(head_block) + 1, generator.get_hardforks(), tx_hardfork_id); // assuming the tx will be in the next block (head_block + 1)
|
||||
tx_set.emplace_back();
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_set.back(), tx_version, generator.last_tx_generated_secret_key, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_set.back(), tx_version, tx_hardfork_id, generator.last_tx_generated_secret_key, 0);
|
||||
PRINT_EVENT_N_TEXT(events, "put_alias_via_tx_to_list()");
|
||||
events.push_back(tx_set.back());
|
||||
|
||||
|
|
|
|||
|
|
@ -930,8 +930,8 @@ bool gen_checkpoints_and_invalid_tx_to_pool::generate(std::vector<test_event_ent
|
|||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc, miner_acc, 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, get_tx_version_from_events(events), 0);
|
||||
transaction tx_0{};
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_extra, empty_attachment, tx_0, get_tx_version_from_events(events));
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
// invalidate tx_0 signature
|
||||
|
|
|
|||
|
|
@ -95,7 +95,9 @@ 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, this->get_tx_version_from_events(events), uint64_t(0)))
|
||||
size_t tx_hardfork_id{};
|
||||
uint64_t tx_version = get_tx_version_from_events(events);
|
||||
if (!construct_tx(bob_account.get_keys(), sources, destinations, attachments, tx_1, tx_version, tx_hardfork_id, uint64_t(0)))
|
||||
return false;
|
||||
|
||||
SET_EVENT_VISITOR_SETT(events, event_visitor_settings::set_txs_kept_by_block, txs_kept_by_block);
|
||||
|
|
|
|||
|
|
@ -181,8 +181,9 @@ bool pos_emission_test::generate(std::vector<test_event_entry> &events)
|
|||
for (size_t i = 0; i < m_pos_entries_to_generate; ++i)
|
||||
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, get_tx_version_from_events(events), 0);
|
||||
transaction tx_1{};
|
||||
size_t tx_hardfork_id{};
|
||||
r = construct_tx(preminer_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 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);
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ inline bool build_custom_escrow_template(const std::vector<test_event_entry>& ev
|
|||
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,
|
||||
size_t tx_hardfork_id,
|
||||
transaction& escrow_template_tx, /* OUT */
|
||||
crypto::secret_key& tx_key_sec, /* OUT */
|
||||
std::vector<tx_source_entry>& used_sources /* IN/OUT */)
|
||||
|
|
@ -231,7 +232,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_version, 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_hardfork_id, 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)
|
||||
|
|
@ -266,6 +267,7 @@ inline bool build_custom_escrow_proposal(const std::vector<test_event_entry>& ev
|
|||
uint64_t a_fee_proposal, uint64_t b_fee_release,
|
||||
uint64_t custom_config_mask,
|
||||
uint64_t tx_version,
|
||||
size_t tx_hardfork_id,
|
||||
transaction& escrow_proposal_tx, /* OUT */
|
||||
std::vector<tx_source_entry>& used_sources,/* IN/OUT */
|
||||
bc_services::proposal_body* p_pb = nullptr /* OUT */ )
|
||||
|
|
@ -283,7 +285,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, tx_version, 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, tx_hardfork_id, p_pb->tx_template, p_pb->tx_onetime_secret_key, used_sources);
|
||||
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_template failed");
|
||||
}
|
||||
|
||||
|
|
@ -309,7 +311,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_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);
|
||||
r = construct_tx(a_keys, sources, destinations, empty_extra, attachments, escrow_proposal_tx, tx_version, tx_hardfork_id, 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);
|
||||
|
|
@ -321,7 +323,8 @@ 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,
|
||||
uint64_t tx_version,
|
||||
size_t tx_hardfork_id,
|
||||
const transaction& escrow_template_tx, /* IN (needed for ms output, tx pub key) */
|
||||
uint64_t custom_config_mask, /* IN */
|
||||
transaction& tx /* OUT */
|
||||
|
|
@ -420,7 +423,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, tx_version, 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, tx_hardfork_id, 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);
|
||||
|
|
@ -470,6 +473,7 @@ inline bool build_custom_escrow_accept_proposal(
|
|||
uint64_t custom_config_mask, /* IN */
|
||||
crypto::secret_key one_time_secret_key, /* IN */
|
||||
uint64_t tx_version, /* IN */
|
||||
size_t tx_hardfork_id, /* IN */
|
||||
transaction& tx, /* IN (escrow template), OUT */
|
||||
std::vector<tx_source_entry>& used_sources /* IN/OUT */
|
||||
)
|
||||
|
|
@ -496,9 +500,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_version, 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_hardfork_id, 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_version, 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_hardfork_id, 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
|
||||
|
|
@ -529,7 +533,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, tx_version, 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, tx_hardfork_id, 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;
|
||||
|
|
@ -545,6 +549,7 @@ inline bool build_custom_escrow_cancel_proposal(
|
|||
uint64_t custom_config_mask, /* IN */
|
||||
const transaction& escrow_template_tx, /* IN */
|
||||
uint64_t tx_version, /* IN */
|
||||
size_t tx_hardfork_id, /* IN */
|
||||
transaction& tx, /* OUT */
|
||||
std::vector<tx_source_entry>& used_sources /* IN/OUT */
|
||||
)
|
||||
|
|
@ -568,7 +573,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, tx_version, 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, tx_hardfork_id, 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
|
||||
|
|
@ -593,7 +598,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, tx_version, 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, tx_hardfork_id, 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,11 @@ 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);
|
||||
size_t tx_hardfork_id{};
|
||||
uint64_t tx_version = get_tx_version_and_hardfork_id(get_block_height(blk_1r), m_hardforks, tx_hardfork_id);
|
||||
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, tx_version, 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, tx_hardfork_id, 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,9 +551,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, tx_version, escrow_proposal_tx, used_sources);
|
||||
tx_version = get_tx_version_and_hardfork_id(get_block_height(top_block), m_hardforks, tx_hardfork_id);
|
||||
transaction 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, tx_version, tx_hardfork_id, 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,10 +580,10 @@ 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);
|
||||
transaction tx{};
|
||||
tx_version = get_tx_version_and_hardfork_id(get_block_height(top_block), m_hardforks, tx_hardfork_id);
|
||||
// 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_version, 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_hardfork_id, 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);
|
||||
|
|
@ -592,11 +593,11 @@ 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);
|
||||
transaction tx{};
|
||||
tx_version = get_tx_version_and_hardfork_id(get_block_height(top_block), m_hardforks, tx_hardfork_id);
|
||||
// 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_version, 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_hardfork_id, 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);
|
||||
|
|
@ -606,9 +607,9 @@ bool escrow_incorrect_proposal::generate(std::vector<test_event_entry>& events)
|
|||
|
||||
{
|
||||
cpd.comment = "template zero expiration time";
|
||||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
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);
|
||||
transaction tx{};
|
||||
tx_version = get_tx_version_and_hardfork_id(get_block_height(top_block), m_hardforks, tx_hardfork_id);
|
||||
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_hardfork_id, 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);
|
||||
|
|
@ -618,11 +619,11 @@ 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);
|
||||
transaction tx{};
|
||||
tx_version = get_tx_version_and_hardfork_id(get_block_height(top_block), m_hardforks, tx_hardfork_id);
|
||||
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_version, 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_hardfork_id, 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);
|
||||
|
|
@ -1149,17 +1150,18 @@ 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);
|
||||
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);
|
||||
size_t tx_hardfork_id{};
|
||||
uint64_t tx_version = get_tx_version_and_hardfork_id(get_block_height(blk_1r), m_hardforks, tx_hardfork_id);
|
||||
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, tx_hardfork_id, 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);
|
||||
tx_version = get_tx_version_and_hardfork_id(get_block_height(blk_2), m_hardforks, tx_hardfork_id);
|
||||
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, tx_version, 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, tx_hardfork_id, 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);
|
||||
|
|
@ -1258,10 +1260,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);
|
||||
tx_version = get_tx_version_and_hardfork_id(get_block_height(prev_block), m_hardforks, tx_hardfork_id);
|
||||
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, tx_version, incorrect_acceptance_tx, used_sources);
|
||||
bob_fee_acceptance, m_bob_fee_release, mask, prop.tx_onetime_secret_key, tx_version, tx_hardfork_id, 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
|
||||
|
|
@ -1494,8 +1496,9 @@ bool escrow_custom_test::generate(std::vector<test_event_entry>& events) const
|
|||
destinations.push_back(tx_destination_entry(chunk_amount, bob_acc.get_public_address()));
|
||||
}
|
||||
// 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, get_tx_version_from_events(events), 0);
|
||||
transaction tx_1{};
|
||||
size_t tx_hardfork_id{};
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
events.push_back(tx_1);
|
||||
|
|
@ -1949,7 +1952,8 @@ 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, get_tx_version_from_events(events), 0);
|
||||
size_t tx_hardfork_id{};
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
events.push_back(tx_1);
|
||||
|
|
@ -1969,27 +1973,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);
|
||||
uint64_t tx_version = get_tx_version_and_hardfork_id(get_block_height(blk_1r), m_hardforks, tx_hardfork_id);
|
||||
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, tx_version, 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, tx_hardfork_id, 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);
|
||||
tx_version = get_tx_version_and_hardfork_id(get_block_height(blk_2), m_hardforks, tx_hardfork_id);
|
||||
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, tx_version, 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, tx_hardfork_id, 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);
|
||||
tx_version = get_tx_version_and_hardfork_id(get_block_height(blk_3), m_hardforks, tx_hardfork_id);
|
||||
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, tx_version, 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, tx_hardfork_id, 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);
|
||||
|
|
@ -2057,9 +2061,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);
|
||||
tx_version = get_tx_version_and_hardfork_id(get_block_height(blk_3), m_hardforks, tx_hardfork_id);
|
||||
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, tx_version, incorrect_cancellation_proposal_tx, used_sources);
|
||||
TESTS_DEFAULT_FEE, mask, prop.tx_template, tx_version, tx_hardfork_id, 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
|
||||
|
|
@ -2985,9 +2989,10 @@ 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);
|
||||
size_t tx_hardfork_tx{};
|
||||
uint64_t tx_version = get_tx_version_and_hardfork_id(get_block_height(blk_1), m_hardforks, tx_hardfork_tx);
|
||||
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, tx_version, 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, tx_hardfork_tx, 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);
|
||||
|
|
@ -2995,10 +3000,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);
|
||||
tx_version = get_tx_version_and_hardfork_id(get_block_height(blk_2), m_hardforks, tx_hardfork_tx);
|
||||
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, tx_version, 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, tx_hardfork_tx, 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);
|
||||
|
|
|
|||
|
|
@ -98,8 +98,9 @@ bool random_outs_and_burnt_coins::generate(std::vector<test_event_entry>& events
|
|||
r = fill_tx_sources(sources, events, blk_0r, miner_acc.get_keys(), m_amount * m_fake_amounts_count + TESTS_DEFAULT_FEE, 0);
|
||||
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, get_tx_version_from_events(events), 0);
|
||||
transaction tx_0{};
|
||||
size_t tx_hardfork_id{};
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
uint64_t burned_tx_amount_total = get_burned_amount(tx_0);
|
||||
|
|
|
|||
|
|
@ -437,7 +437,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, get_tx_version_from_events(events), 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), 0, 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");
|
||||
|
|
@ -882,7 +882,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, get_tx_version_from_events(events), 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), 0, 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");
|
||||
|
|
|
|||
|
|
@ -157,9 +157,10 @@ bool gen_uint_overflow_2::generate(std::vector<test_event_entry>& events) const
|
|||
// sources.front().amount = destinations[0].amount + destinations[2].amount + destinations[3].amount + TESTS_DEFAULT_FEE
|
||||
destinations.push_back(tx_destination_entry(sources.front().amount - TX_MAX_TRANSFER_AMOUNT - TX_MAX_TRANSFER_AMOUNT + 1 - TESTS_DEFAULT_FEE, bob_addr));
|
||||
|
||||
currency::transaction tx_1;
|
||||
currency::transaction tx_1{};
|
||||
std::vector<currency::attachment_v> attachments;
|
||||
if (!construct_tx(miner_account.get_keys(), sources, destinations, attachments, tx_1, get_tx_version_from_events(events), 0))
|
||||
size_t tx_hardfork_id{};
|
||||
if (!construct_tx(miner_account.get_keys(), sources, destinations, attachments, tx_1, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 0))
|
||||
return false;
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -186,7 +187,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, get_tx_version_from_events(events), 0))
|
||||
if (!construct_tx(bob_account.get_keys(), sources, destinations, attachments2, tx_2, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 0))
|
||||
return false;
|
||||
events.push_back(tx_2);
|
||||
|
||||
|
|
|
|||
|
|
@ -237,8 +237,9 @@ bool block_template_vs_invalid_txs_from_pool::generate(std::vector<test_event_en
|
|||
std::vector<tx_source_entry> sources;
|
||||
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, get_tx_version_from_events(events), 0);
|
||||
transaction tx_1m;
|
||||
size_t tx_hardfork_id{};
|
||||
r = construct_tx(miner_acc.get_keys(), sources, std::vector<tx_destination_entry>({ de }), empty_attachment, tx_1m, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_1m);
|
||||
|
||||
|
|
@ -269,18 +270,18 @@ bool block_template_vs_invalid_txs_from_pool::generate(std::vector<test_event_en
|
|||
se.real_out_tx_key = get_tx_pub_key_from_extra(tx_1m);
|
||||
se.ms_keys_count = boost::get<txout_multisig>(boost::get<currency::tx_out_bare>(tx_1m.vout[se.real_output_in_tx_index]).target).keys.size();
|
||||
se.ms_sigs_count = 1;
|
||||
transaction tx_2m = AUTO_VAL_INIT(tx_2m);
|
||||
transaction 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, get_tx_version_from_events(events), 0);
|
||||
empty_attachment, tx_2m, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 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);
|
||||
CHECK_AND_ASSERT_MES(r && input_fully_signed, false, "sign_multisig_input_in_tx failed, input_fully_signed=" << input_fully_signed);
|
||||
events.push_back(tx_2m);
|
||||
|
||||
transaction tx_2ma = AUTO_VAL_INIT(tx_2ma);
|
||||
transaction 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, get_tx_version_from_events(events), 0);
|
||||
empty_attachment, tx_2ma, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 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);
|
||||
|
|
@ -436,8 +437,9 @@ bool test_blockchain_vs_spent_multisig_outs::generate(std::vector<test_event_ent
|
|||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, MK_TEST_COINS(2), TESTS_DEFAULT_FEE, 0,
|
||||
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, get_tx_version_from_events(events), 0);
|
||||
transaction tx_0{};
|
||||
size_t tx_hardfork_id{};
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
|
|
@ -457,8 +459,8 @@ bool test_blockchain_vs_spent_multisig_outs::generate(std::vector<test_event_ent
|
|||
sources.push_back(se);
|
||||
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, get_tx_version_from_events(events), 0);
|
||||
transaction tx_1{};
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 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);
|
||||
|
|
|
|||
|
|
@ -495,7 +495,8 @@ bool assets_and_explicit_native_coins_in_outs::generate(std::vector<test_event_e
|
|||
std::vector<tx_destination_entry> destinations;
|
||||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc, alice_acc, m_alice_initial_balance, TESTS_DEFAULT_FEE, 0, sources, destinations, true /* spends */, false /* unlock time */);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_from_events(events), 0);
|
||||
size_t tx_hardfork_id{};
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
ADD_CUSTOM_EVENT(events, tx_0);
|
||||
|
|
@ -701,7 +702,8 @@ bool asset_depoyment_and_few_zc_utxos::generate(std::vector<test_event_entry>& e
|
|||
m_alice_initial_balance = TESTS_DEFAULT_FEE * 100;
|
||||
r = fill_tx_sources(sources, events, blk_0r, miner_acc.get_keys(), m_alice_initial_balance + 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, get_tx_version_from_events(events), 0);
|
||||
size_t tx_hardfork_id{};
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
ADD_CUSTOM_EVENT(events, tx_0);
|
||||
|
|
@ -1017,16 +1019,10 @@ bool asset_operation_and_hardfork_checks::generate(
|
|||
|
||||
CHECK_AND_ASSERT_MES(success, false, "fail to fill sources, destinations");
|
||||
|
||||
tx_version = get_tx_version(get_block_height(blk_0r),
|
||||
m_hardforks);
|
||||
size_t tx_hardfork_id{};
|
||||
tx_version = get_tx_version_and_hardfork_id(get_block_height(blk_0r), m_hardforks, tx_hardfork_id);
|
||||
|
||||
success = construct_tx(miner.get_keys(),
|
||||
sources,
|
||||
destinations,
|
||||
empty_attachment,
|
||||
tx_0,
|
||||
tx_version,
|
||||
0);
|
||||
success = construct_tx(miner.get_keys(), sources, destinations, empty_attachment, tx_0, tx_version, tx_hardfork_id, 0);
|
||||
|
||||
CHECK_AND_ASSERT_MES(success, false, "fail to construct tx_0");
|
||||
|
||||
|
|
@ -1058,7 +1054,7 @@ bool asset_operation_and_hardfork_checks::generate(
|
|||
/* to = */ alice.get_public_address(),
|
||||
/* asset_id = */ currency::null_pkey);
|
||||
|
||||
tx_version = get_tx_version(get_block_height(blk_1r), m_hardforks);
|
||||
tx_version = get_tx_version_and_hardfork_id(get_block_height(blk_1r), m_hardforks, tx_hardfork_id);
|
||||
size_t hf_n = m_hardforks.get_the_most_recent_hardfork_id_for_height(get_block_height(blk_1r));
|
||||
fill_ado_version_based_onhardfork(m_ado_hello, hf_n);
|
||||
fill_adb_version_based_onhardfork(*m_ado_hello.opt_descriptor, hf_n);
|
||||
|
|
@ -1069,6 +1065,7 @@ bool asset_operation_and_hardfork_checks::generate(
|
|||
empty_attachment,
|
||||
tx_1,
|
||||
tx_version,
|
||||
tx_hardfork_id,
|
||||
stub,
|
||||
0);
|
||||
|
||||
|
|
@ -1105,8 +1102,7 @@ bool asset_operation_and_hardfork_checks::generate(
|
|||
|
||||
CHECK_AND_ASSERT_MES(success, false, "fail to fill sources, destinations");
|
||||
|
||||
tx_version = get_tx_version(get_block_height(blk_2r),
|
||||
m_hardforks);
|
||||
tx_version = get_tx_version_and_hardfork_id(get_block_height(blk_2r), m_hardforks, tx_hardfork_id);
|
||||
|
||||
hf_n = m_hardforks.get_the_most_recent_hardfork_id_for_height(get_block_height(blk_2r));
|
||||
fill_ado_version_based_onhardfork(m_ado_hello, hf_n);
|
||||
|
|
@ -1118,6 +1114,7 @@ bool asset_operation_and_hardfork_checks::generate(
|
|||
empty_attachment,
|
||||
tx_2,
|
||||
tx_version,
|
||||
tx_hardfork_id,
|
||||
stub,
|
||||
0);
|
||||
|
||||
|
|
@ -1159,6 +1156,7 @@ bool asset_operation_and_hardfork_checks::generate(
|
|||
/* attachments = */ {m_ado_bye},
|
||||
tx_3,
|
||||
tx_version,
|
||||
hf_n,
|
||||
0);
|
||||
|
||||
CHECK_AND_ASSERT_MES(success, false, "fail to construct tx_3");
|
||||
|
|
@ -1199,6 +1197,7 @@ bool asset_operation_and_hardfork_checks::generate(
|
|||
/* attachments = */ {m_ado_bye},
|
||||
tx_4,
|
||||
tx_version,
|
||||
hf_n,
|
||||
stub,
|
||||
0);
|
||||
|
||||
|
|
@ -2068,6 +2067,7 @@ bool asset_current_and_total_supplies_comparative_constraints::generate(std::vec
|
|||
GENERATE_ACCOUNT(miner);
|
||||
GENERATE_ACCOUNT(alice);
|
||||
transaction tx_0{}, tx_1{}, tx_2{}, tx_3{}, tx_4{};
|
||||
size_t tx_hardfork_id{};
|
||||
|
||||
m_accounts.push_back(miner);
|
||||
m_accounts.push_back(alice);
|
||||
|
|
@ -2091,7 +2091,7 @@ bool asset_current_and_total_supplies_comparative_constraints::generate(std::vec
|
|||
|
||||
success = fill_tx_sources_and_destinations(events, top, miner.get_keys(), alice.get_public_address(), MK_TEST_COINS(8), TESTS_DEFAULT_FEE, 0, sources, destinations);
|
||||
CHECK_AND_ASSERT_EQ(success, true);
|
||||
success = construct_tx(miner.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version(get_block_height(top), m_hardforks), 0);
|
||||
success = construct_tx(miner.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_and_hardfork_id(get_block_height(top), m_hardforks, tx_hardfork_id), tx_hardfork_id, 0);
|
||||
CHECK_AND_ASSERT_EQ(success, true);
|
||||
}
|
||||
|
||||
|
|
@ -2115,7 +2115,7 @@ bool asset_current_and_total_supplies_comparative_constraints::generate(std::vec
|
|||
destinations.emplace_back(ado.opt_descriptor->current_supply, alice.get_public_address(), null_pkey);
|
||||
CHECK_AND_ASSERT_EQ(ado.opt_descriptor->total_max_supply, 0);
|
||||
CHECK_AND_ASSERT_EQ(ado.opt_descriptor->total_max_supply, ado.opt_descriptor->current_supply);
|
||||
success = construct_tx(alice.get_keys(), sources, destinations, {ado}, empty_attachment, tx_1, get_tx_version(get_block_height(top), m_hardforks), one_time, 0);
|
||||
success = construct_tx(alice.get_keys(), sources, destinations, {ado}, empty_attachment, tx_1, get_tx_version_and_hardfork_id(get_block_height(top), m_hardforks, tx_hardfork_id), tx_hardfork_id, one_time, 0);
|
||||
CHECK_AND_ASSERT_EQ(success, true);
|
||||
}
|
||||
|
||||
|
|
@ -2140,7 +2140,7 @@ bool asset_current_and_total_supplies_comparative_constraints::generate(std::vec
|
|||
CHECK_AND_ASSERT_EQ(success, true);
|
||||
destinations.emplace_back(ado.opt_descriptor->current_supply, alice.get_public_address(), null_pkey);
|
||||
CHECK_AND_ASSERT_MES(ado.opt_descriptor->current_supply > ado.opt_descriptor->total_max_supply, false, "current_supply <= total_max_supply");
|
||||
success = construct_tx(alice.get_keys(), sources, destinations, {ado}, empty_attachment, tx_2, get_tx_version(get_block_height(top), m_hardforks), one_time, 0);
|
||||
success = construct_tx(alice.get_keys(), sources, destinations, {ado}, empty_attachment, tx_2, get_tx_version_and_hardfork_id(get_block_height(top), m_hardforks, tx_hardfork_id), tx_hardfork_id, one_time, 0);
|
||||
CHECK_AND_ASSERT_EQ(success, true);
|
||||
}
|
||||
|
||||
|
|
@ -2165,7 +2165,7 @@ bool asset_current_and_total_supplies_comparative_constraints::generate(std::vec
|
|||
CHECK_AND_ASSERT_EQ(success, true);
|
||||
destinations.emplace_back(ado.opt_descriptor->current_supply, alice.get_public_address(), null_pkey);
|
||||
CHECK_AND_ASSERT(ado.opt_descriptor->current_supply <= ado.opt_descriptor->total_max_supply, false);
|
||||
success = construct_tx(alice.get_keys(), sources, destinations, {ado}, empty_attachment, tx_3, get_tx_version(get_block_height(top), m_hardforks), one_time, 0);
|
||||
success = construct_tx(alice.get_keys(), sources, destinations, {ado}, empty_attachment, tx_3, get_tx_version_and_hardfork_id(get_block_height(top), m_hardforks, tx_hardfork_id), tx_hardfork_id, one_time, 0);
|
||||
CHECK_AND_ASSERT_EQ(success, true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -880,7 +880,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, get_tx_version_from_events(events), 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx, get_tx_version_from_events(events), 0, 0);
|
||||
CHECK_AND_ASSERT_MES(r == false, false, "construct_tx was expected to fail, but successed");
|
||||
|
||||
|
||||
|
|
@ -893,7 +893,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, get_tx_version_from_events(events), 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_from_events(events), 0, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -917,7 +917,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, get_tx_version_from_events(events), 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, 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);
|
||||
|
|
@ -947,7 +947,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, get_tx_version_from_events(events), 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, 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);
|
||||
|
|
@ -966,7 +966,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, get_tx_version_from_events(events), 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_4, get_tx_version_from_events(events), 0, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_4);
|
||||
|
||||
|
|
@ -984,7 +984,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, get_tx_version_from_events(events), 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, 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)
|
||||
|
|
@ -1009,7 +1009,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, get_tx_version_from_events(events), 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_6, get_tx_version_from_events(events), 0, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_6);
|
||||
|
||||
|
|
@ -1028,7 +1028,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, get_tx_version_from_events(events), 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, 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)
|
||||
|
|
@ -1051,7 +1051,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, get_tx_version_from_events(events), 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_8, get_tx_version_from_events(events), 0, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_8);
|
||||
|
||||
|
|
@ -1071,7 +1071,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, get_tx_version_from_events(events), 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, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
boost::get<currency::NLSAG_sig>(tx_9.signatures[0]).s.resize(redundant_keys_count, invalid_signature);
|
||||
|
|
@ -1256,7 +1256,7 @@ bool multisig_and_unlock_time::generate(std::vector<test_event_entry>& events) c
|
|||
r = fill_tx_sources_and_destinations(events, blk_2, alice_acc, bob_acc, amount - TESTS_DEFAULT_FEE * 2, TESTS_DEFAULT_FEE, 0 /*nmix*/, sources, destinations, true, false /* check_for_unlocktime */);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx_3{};
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_3, get_tx_version_from_events(events), 0);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_3, get_tx_version_from_events(events), 0, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
ADD_CUSTOM_EVENT(events, tx_3);
|
||||
|
||||
|
|
@ -1281,7 +1281,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, get_tx_version_from_events(events), 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), 0, 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");
|
||||
|
|
@ -1289,7 +1289,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, get_tx_version_from_events(events), 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), 0, stub_key, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_5);
|
||||
|
||||
|
|
@ -1316,7 +1316,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, get_tx_version_from_events(events), 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), 0, 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);
|
||||
|
|
@ -1429,7 +1429,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, get_tx_version_from_events(events), 0);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_from_events(events), 0, 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);
|
||||
|
|
@ -1493,7 +1493,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, get_tx_version_from_events(events), 0);
|
||||
empty_attachment, tx_2, get_tx_version_from_events(events), 0, 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);
|
||||
|
|
@ -2259,7 +2259,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, get_tx_version_from_events(events), 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_from_events(events), 0, 0);
|
||||
events.push_back(tx_1);
|
||||
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_1);
|
||||
|
|
@ -2289,7 +2289,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, get_tx_version_from_events(events), 0);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx, get_tx_version_from_events(events), 0, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
// sign the transaction by (m_minimum_signs_to_spend) participants in random order
|
||||
|
|
|
|||
|
|
@ -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, get_tx_version_from_events(events), 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_from_events(events), 0, 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);
|
||||
|
|
|
|||
|
|
@ -174,7 +174,8 @@ bool pos_mining_with_decoys::generate(std::vector<test_event_entry>& events) con
|
|||
destinations.emplace_back(COIN, carol_acc.get_public_address());
|
||||
|
||||
transaction tx_0{};
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_from_events(events), 0);
|
||||
size_t tx_hardfork_id{};
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 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);
|
||||
|
|
|
|||
|
|
@ -101,7 +101,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, get_tx_version(0, hf), 0);
|
||||
bool r = construct_tx(miner_acc2.get_keys(), sources, destinations, attachments, tx_rc1, get_tx_version(0, hf), 0, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "failed to construct transaction");
|
||||
|
||||
crypto::hash pref_hash = get_transaction_prefix_hash(tx_rc1);
|
||||
|
|
|
|||
|
|
@ -1239,8 +1239,9 @@ bool tx_expiration_time::generate(std::vector<test_event_entry>& events) const
|
|||
std::vector<tx_destination_entry> destinations;
|
||||
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, get_tx_version_from_events(events), 0);
|
||||
transaction tx_2{};
|
||||
size_t tx_hardfork_id{};
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_2, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 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);
|
||||
|
|
@ -1258,7 +1259,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, get_tx_version_from_events(events), 0);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_3, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 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);
|
||||
|
|
@ -1322,8 +1323,9 @@ bool tx_expiration_time_and_block_template::generate(std::vector<test_event_entr
|
|||
std::vector<tx_destination_entry> destinations;
|
||||
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, get_tx_version_from_events(events), 0);
|
||||
transaction tx_1{};
|
||||
size_t tx_hardfork_id{};
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 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);
|
||||
|
|
@ -1394,8 +1396,9 @@ bool tx_expiration_time_and_chain_switching::generate(std::vector<test_event_ent
|
|||
std::vector<tx_destination_entry> destinations;
|
||||
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, get_tx_version_from_events(events), 0);
|
||||
transaction tx_0{};
|
||||
size_t tx_hardfork_id{};
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 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);
|
||||
|
|
@ -1515,8 +1518,9 @@ bool tx_key_image_pool_conflict::generate(std::vector<test_event_entry>& events)
|
|||
std::vector<tx_destination_entry> destinations;
|
||||
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, get_tx_version_from_events(events), 0);
|
||||
transaction tx_0{};
|
||||
size_t tx_hardfork_id{};
|
||||
r = construct_tx(m_miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 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
|
||||
|
|
@ -1643,15 +1647,18 @@ bool tx_version_against_hardfork::generate(std::vector<test_event_entry>& events
|
|||
// tx_1 tx_1 is accepted
|
||||
|
||||
uint64_t tx_version_good = 0, tx_version_bad = 0;
|
||||
size_t tx_hardfork_id = 0;
|
||||
|
||||
// select good and bad tx versions based on active hardfork
|
||||
size_t most_recent_hardfork_id = m_hardforks.get_the_most_recent_hardfork_id_for_height(get_block_height(blk_0r));
|
||||
switch(most_recent_hardfork_id)
|
||||
{
|
||||
case ZANO_HARDFORK_04_ZARCANUM:
|
||||
tx_hardfork_id = 0;
|
||||
case ZANO_HARDFORK_05:
|
||||
tx_version_good = TRANSACTION_VERSION_POST_HF4;
|
||||
tx_version_bad = TRANSACTION_VERSION_PRE_HF4;
|
||||
tx_hardfork_id = ZANO_HARDFORK_05;
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR("hardfork " << most_recent_hardfork_id << " is not supported by this test");
|
||||
|
|
@ -1667,7 +1674,7 @@ bool tx_version_against_hardfork::generate(std::vector<test_event_entry>& events
|
|||
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{};
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, tx_version_good, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, tx_version_good, tx_hardfork_id, 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);
|
||||
|
|
@ -1681,7 +1688,7 @@ bool tx_version_against_hardfork::generate(std::vector<test_event_entry>& events
|
|||
r = fill_tx_sources_and_destinations(events, blk_0, 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{};
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, tx_version_bad, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, tx_version_bad, tx_hardfork_id, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
// check tx pool rejection
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
|
|
|
|||
|
|
@ -2306,7 +2306,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, tx_version, 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, 0, one_time_secret_key, 0, 0, true, 0))
|
||||
return false;
|
||||
|
||||
size_t sz = get_object_blobsize(tx);
|
||||
|
|
|
|||
|
|
@ -520,7 +520,8 @@ bool zarcanum_txs_with_big_shuffled_decoy_set_shuffled::generate(std::vector<tes
|
|||
CHECK_AND_ASSERT_MES(shuffle_source_entries(sources), false, "shuffle_source_entries failed");
|
||||
|
||||
transaction tx_1_a{};
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_1_a, get_tx_version_from_events(events), 0 /* unlock time */);
|
||||
size_t tx_hardfork_id{};
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_1_a, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 0 /* unlock time */);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
ADD_CUSTOM_EVENT(events, tx_1_a);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1r, miner_acc, tx_1_a);
|
||||
|
|
@ -532,7 +533,7 @@ bool zarcanum_txs_with_big_shuffled_decoy_set_shuffled::generate(std::vector<tes
|
|||
CHECK_AND_ASSERT_MES(fill_tx_sources_and_destinations(events, blk_2, alice_acc, miner_acc, alice_amount - TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, nmix, sources, destinations), false, "");
|
||||
CHECK_AND_ASSERT_MES(shuffle_source_entries(sources), false, "shuffle_source_entries failed");
|
||||
transaction tx_1_b{};
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_1_b, get_tx_version_from_events(events), 0 /* unlock time */);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_1_b, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 0 /* unlock time */);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
ADD_CUSTOM_EVENT(events, tx_1_b);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_3, blk_2, miner_acc, tx_1_b);
|
||||
|
|
@ -571,7 +572,7 @@ bool zarcanum_txs_with_big_shuffled_decoy_set_shuffled::generate(std::vector<tes
|
|||
CHECK_AND_ASSERT_MES(fill_tx_sources_and_destinations(events, blk_5r, alice_acc, miner_acc, alice_amount - TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, nmix, sources, destinations), false, "");
|
||||
CHECK_AND_ASSERT_MES(shuffle_source_entries(sources), false, "shuffle_source_entries failed");
|
||||
transaction tx_3_a{};
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_3_a, get_tx_version_from_events(events), 0 /* unlock time */);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_3_a, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 0 /* unlock time */);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
ADD_CUSTOM_EVENT(events, tx_3_a);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_6, blk_5r, miner_acc, tx_3_a);
|
||||
|
|
@ -583,7 +584,7 @@ bool zarcanum_txs_with_big_shuffled_decoy_set_shuffled::generate(std::vector<tes
|
|||
CHECK_AND_ASSERT_MES(fill_tx_sources_and_destinations(events, blk_6, alice_acc, miner_acc, alice_amount - TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, nmix, sources, destinations), false, "");
|
||||
CHECK_AND_ASSERT_MES(shuffle_source_entries(sources), false, "shuffle_source_entries failed");
|
||||
transaction tx_3_b{};
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_3_b, get_tx_version_from_events(events), 0 /* unlock time */);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_3_b, get_tx_version_and_harfork_id_from_events(events, tx_hardfork_id), tx_hardfork_id, 0 /* unlock time */);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
ADD_CUSTOM_EVENT(events, tx_3_b);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_7, blk_6, miner_acc, tx_3_b);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue