1
0
Fork 0
forked from lthn/blockchain

multiple fixes on coretests

This commit is contained in:
crypro.zoidberg 2019-04-25 23:37:43 +02:00
parent 18c35f2274
commit 7fc1eb4d8a
17 changed files with 358 additions and 358 deletions

View file

@ -160,7 +160,7 @@ bool gen_alias_tests::generate(std::vector<test_event_entry>& events) const
size_t small_outs_to_transfer = MAX_ALIAS_PER_BLOCK + 10;
transaction tx_1 = AUTO_VAL_INIT(tx_1);
bool r = construct_tx_with_many_outputs(events, blk_0, preminer_account.get_keys(), miner_account.get_public_address(), small_outs_to_transfer * TX_DEFAULT_FEE * 11, small_outs_to_transfer, TX_DEFAULT_FEE, tx_1);
bool r = construct_tx_with_many_outputs(events, blk_0, preminer_account.get_keys(), miner_account.get_public_address(), small_outs_to_transfer * TESTS_DEFAULT_FEE * 11, small_outs_to_transfer, TESTS_DEFAULT_FEE, tx_1);
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
events.push_back(tx_1); // 4N+4
MAKE_NEXT_BLOCK_TX1(events, blk_a, blk_0r, miner_account, tx_1); // 4N+5
@ -398,7 +398,7 @@ bool gen_alias_tests::check_too_many_aliases_registration(currency::core& c, siz
ai.m_address = someone.get_public_address();
ai.m_alias = gen_random_alias(random_in_range(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED + 20));
transaction alias_reg_tx = AUTO_VAL_INIT(alias_reg_tx);
miner_wlt->request_alias_registration(ai, alias_reg_tx, TX_DEFAULT_FEE, estimated_alias_cost);
miner_wlt->request_alias_registration(ai, alias_reg_tx, TESTS_DEFAULT_FEE, estimated_alias_cost);
b.tx_hashes.push_back(get_transaction_hash(alias_reg_tx)); // add this tx to block template
}
@ -815,7 +815,7 @@ bool gen_alias_blocking_reg_by_invalid_tx::generate(std::vector<test_event_entry
ai.m_address = attacker.get_public_address();
ai.m_sign.push_back(invalid_signature); // it's an invalid sign, so effectivly it's an update alias request
std::vector<currency::extra_v> ex(1, ai);
MAKE_TX_FEE_MIX_ATTR_EXTRA(events, tx_0, attacker, attacker, TX_DEFAULT_FEE, TX_DEFAULT_FEE, 0, blk_1, CURRENCY_TO_KEY_OUT_RELAXED, ex, false);
MAKE_TX_FEE_MIX_ATTR_EXTRA(events, tx_0, attacker, attacker, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, 0, blk_1, CURRENCY_TO_KEY_OUT_RELAXED, ex, false);
// No one can't include this tx into a block
DO_CALLBACK(events, "mark_invalid_block");
@ -1061,7 +1061,7 @@ bool gen_alias_too_small_reward::generate(std::vector<test_event_entry>& events)
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
transaction tx_1 = AUTO_VAL_INIT(tx_1);
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), miner_acc.get_public_address(), 3 * aliases_count * TX_DEFAULT_FEE * 100, 3 * aliases_count, TX_DEFAULT_FEE, tx_1);
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), miner_acc.get_public_address(), 3 * aliases_count * TESTS_DEFAULT_FEE * 100, 3 * aliases_count, TESTS_DEFAULT_FEE, tx_1);
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
events.push_back(tx_1);
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_1);
@ -1074,12 +1074,12 @@ bool gen_alias_too_small_reward::generate(std::vector<test_event_entry>& events)
transaction tx = AUTO_VAL_INIT(tx);
DO_CALLBACK(events, "mark_invalid_tx"); // should be rejected, because it's paid TX_POOL_MINIMUM_FEE / 10
if (!make_tx_reg_alias(events, generator, blk_1, aliases[i].name, aliases[i].addr, TX_DEFAULT_FEE / 10, miner_acc, tx, used_sources))
if (!make_tx_reg_alias(events, generator, blk_1, aliases[i].name, aliases[i].addr, ALIAS_VERY_INITAL_COAST / 10, miner_acc, tx, used_sources))
return false;
// this block commented due to new fee median rules, TODO: review
// DO_CALLBACK(events, "mark_invalid_tx"); // should be rejected, because it's paid TX_POOL_MINIMUM_FEE / 10 less then required
// if (!make_tx_reg_alias(events, generator, blk_1, aliases[i].name, aliases[i].addr, alias_reward - TX_DEFAULT_FEE / 10, miner_acc, tx, used_sources))
// if (!make_tx_reg_alias(events, generator, blk_1, aliases[i].name, aliases[i].addr, alias_reward - TESTS_DEFAULT_FEE / 10, miner_acc, tx, used_sources))
// return false;
// should be accepted
@ -1265,7 +1265,7 @@ bool gen_alias_switch_and_check_block_template::generate(std::vector<test_event_
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
std::vector<currency::extra_v> extra(1, ai);
MAKE_TX_FEE_MIX_ATTR_EXTRA(events, tx_0, miner_acc, miner_acc, 1, TX_DEFAULT_FEE, 0, blk_2, CURRENCY_TO_KEY_OUT_RELAXED, extra, true); // 2N+6
MAKE_TX_FEE_MIX_ATTR_EXTRA(events, tx_0, miner_acc, miner_acc, 1, TESTS_DEFAULT_FEE, 0, blk_2, CURRENCY_TO_KEY_OUT_RELAXED, extra, true); // 2N+6
MAKE_NEXT_BLOCK_TX1(events, blk_3, blk_2, miner_acc, tx_0); // 2N+7
// split the chain
@ -1344,10 +1344,10 @@ bool gen_alias_too_many_regs_in_block_template::generate(std::vector<test_event_
uint64_t total_alias_cost = 0;
for(size_t i = 0; i < m_total_alias_to_gen; ++i)
{
destinations.push_back(tx_destination_entry(m_estimated_alias_cost + TX_DEFAULT_FEE, alice_acc.get_public_address()));
total_alias_cost += m_estimated_alias_cost + TX_DEFAULT_FEE;
destinations.push_back(tx_destination_entry(m_estimated_alias_cost + TESTS_DEFAULT_FEE, alice_acc.get_public_address()));
total_alias_cost += m_estimated_alias_cost + TESTS_DEFAULT_FEE;
}
total_alias_cost += TX_DEFAULT_FEE;
total_alias_cost += TESTS_DEFAULT_FEE;
r = fill_tx_sources(sources, events, blk_0r, preminer_acc.get_keys(), total_alias_cost, 0);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
uint64_t sources_amount = get_sources_total_amount(sources);
@ -1390,7 +1390,7 @@ bool gen_alias_too_many_regs_in_block_template::add_block_from_template(currency
ai.m_address = someone.get_public_address();
ai.m_alias = gen_random_alias(random_in_range(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED + 20));
transaction alias_reg_tx = AUTO_VAL_INIT(alias_reg_tx);
alice_wlt->request_alias_registration(ai, alias_reg_tx, TX_DEFAULT_FEE, m_estimated_alias_cost);
alice_wlt->request_alias_registration(ai, alias_reg_tx, TESTS_DEFAULT_FEE, m_estimated_alias_cost);
}
}
catch (std::exception& e)
@ -1450,13 +1450,13 @@ bool gen_alias_update_for_free::generate(std::vector<test_event_entry>& events)
// create a tx with chargeback, paying only the minimum required fee
std::vector<tx_source_entry> sources;
std::vector<tx_destination_entry> destinations;
r = fill_tx_sources(sources, events, blk_0r, miner_acc.get_keys(), TX_DEFAULT_FEE, 0, true, true);
r = fill_tx_sources(sources, events, blk_0r, miner_acc.get_keys(), TESTS_DEFAULT_FEE, 0, true, true);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
uint64_t input_amount = 0;
for (auto se : sources)
input_amount += se.amount;
if (input_amount > TX_DEFAULT_FEE)
destinations.push_back(tx_destination_entry(input_amount - TX_DEFAULT_FEE, miner_acc.get_public_address()));
if (input_amount > TESTS_DEFAULT_FEE)
destinations.push_back(tx_destination_entry(input_amount - TESTS_DEFAULT_FEE, miner_acc.get_public_address()));
tx_builder tb;
tb.step1_init();

View file

@ -72,7 +72,7 @@ bool block_template_against_txs_size::c1(currency::core& c, size_t ev_index, con
uint64_t base_block_reward_pow = get_base_block_reward(false, bcs.total_coins(), top_block_height + 1);
uint64_t base_block_reward_pos = get_base_block_reward(true, bcs.total_coins(), top_block_height + 1);
g_block_txs_fee = TX_DEFAULT_FEE; // passing an argument to custom_fill_block_template_func via global variable (not perfect but works well)
g_block_txs_fee = TESTS_DEFAULT_FEE; // passing an argument to custom_fill_block_template_func via global variable (not perfect but works well)
CHECK_AND_ASSERT_MES(blocksize_limit > CURRENCY_COINBASE_BLOB_RESERVED_SIZE, false, "internal invariant failed");

View file

@ -249,13 +249,13 @@ bool bad_chain_switching_with_rollback::generate(std::vector<test_event_entry>&
MAKE_GENESIS_BLOCK(events, blk_0, preminer_acc, test_core_time::get_time());
REWIND_BLOCKS_N(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 4);
MAKE_TX(events, tx_1, miner_acc, alice_acc, TX_DEFAULT_FEE * 2, blk_0r);
MAKE_TX(events, tx_1, miner_acc, alice_acc, TESTS_DEFAULT_FEE * 2, blk_0r);
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_1);
MAKE_NEXT_BLOCK(events, blk_2, blk_1, miner_acc);
// make tx_2 referring to tx_1 output
MAKE_TX(events, tx_2, alice_acc, bob_acc, TX_DEFAULT_FEE, blk_2);
MAKE_TX(events, tx_2, alice_acc, bob_acc, TESTS_DEFAULT_FEE, blk_2);
MAKE_NEXT_BLOCK_TX1(events, blk_3, blk_2, miner_acc, tx_2);
// check balance at gentime
@ -267,12 +267,12 @@ bool bad_chain_switching_with_rollback::generate(std::vector<test_event_entry>&
CHECK_AND_ASSERT_MES(r, false, "refresh_test_wallet failed");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", 0, 0, 0, 0, 0), false, "");
// Bob should have TX_DEFAULT_FEE
// Bob should have TESTS_DEFAULT_FEE
std::shared_ptr<tools::wallet2> bob_wlt;
generator.init_test_wallet(bob_acc, get_block_hash(blk_0), bob_wlt);
r = generator.refresh_test_wallet(events, bob_wlt.get(), get_block_hash(blk_3), CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 4 + 3);
CHECK_AND_ASSERT_MES(r, false, "refresh_test_wallet failed");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", TX_DEFAULT_FEE, 0, 0, 0, 0), false, "");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", TESTS_DEFAULT_FEE, 0, 0, 0, 0), false, "");
// start altchain from blk_0r, include tx_2 but NOT include tx_1
DO_CALLBACK(events, "mark_invalid_block");
@ -355,8 +355,8 @@ bool chain_switching_and_tx_with_attachment_blobsize::generate(std::vector<test_
std::vector<attachment_v> attachment({comment_att});
// create txs with attachment (and put it in the pool)
MAKE_TX_ATTACH(events, tx_1, miner_acc, miner_acc, TX_DEFAULT_FEE, blk_0r, attachment);
MAKE_TX_ATTACH(events, tx_2, miner_acc, miner_acc, TX_DEFAULT_FEE, blk_0r, attachment);
MAKE_TX_ATTACH(events, tx_1, miner_acc, miner_acc, TESTS_DEFAULT_FEE, blk_0r, attachment);
MAKE_TX_ATTACH(events, tx_2, miner_acc, miner_acc, TESTS_DEFAULT_FEE, blk_0r, attachment);
// make sure the pool has correct txs
DO_CALLBACK_PARAMS_STR(events, "check_tx_pool_txs", epee::serialization::store_t_to_json(params_tx_pool(get_transaction_hash(tx_1), get_object_blobsize(tx_1), get_transaction_hash(tx_2), get_object_blobsize(tx_2))));
@ -477,7 +477,7 @@ bool alt_chain_coins_pow_mined_then_spent::generate(std::vector<test_event_entry
// +-------------tx_1 tx_1 spents 2a.miner_tx output
events.push_back(event_visitor_settings(event_visitor_settings::set_txs_kept_by_block, true)); // simulate alt-block tx behaviour
MAKE_TX(events, tx_1, alice_acc, alice_acc, TX_DEFAULT_FEE, blk_2ra);
MAKE_TX(events, tx_1, alice_acc, alice_acc, TESTS_DEFAULT_FEE, blk_2ra);
events.push_back(event_visitor_settings(event_visitor_settings::set_txs_kept_by_block, false));
MAKE_NEXT_BLOCK_TX1(events, blk_3a, blk_2ra, miner_acc, tx_1);
@ -516,7 +516,7 @@ bool alt_blocks_validation_and_same_new_amount_in_two_txs::generate(std::vector<
// make two txs with one output (huge fee, probably - doesn't matter) with amount that is never seen before
std::vector<tx_source_entry> sources;
r = fill_tx_sources(sources, events, blk_1r, miner_acc.get_keys(), new_amount + TX_DEFAULT_FEE, 0);
r = fill_tx_sources(sources, events, blk_1r, miner_acc.get_keys(), new_amount + TESTS_DEFAULT_FEE, 0);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
std::vector<tx_destination_entry> destinations;
destinations.push_back(tx_destination_entry(new_amount, miner_acc.get_public_address())); // no cashback, just payment
@ -527,7 +527,7 @@ bool alt_blocks_validation_and_same_new_amount_in_two_txs::generate(std::vector<
// second tx
sources.clear();
r = fill_tx_sources(sources, events, blk_1r, miner_acc.get_keys(), new_amount + TX_DEFAULT_FEE, 0, sources);
r = fill_tx_sources(sources, events, blk_1r, miner_acc.get_keys(), new_amount + TESTS_DEFAULT_FEE, 0, sources);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
transaction tx_2 = AUTO_VAL_INIT(tx_2);
// use the same destinations
@ -577,7 +577,7 @@ bool alt_blocks_with_the_same_txs::generate(std::vector<test_event_entry>& event
// \- (2a)- (3a)- (4 )-
// tx_0
MAKE_TX(events, tx_0, miner_acc, miner_acc, TX_DEFAULT_FEE, blk_1r);
MAKE_TX(events, tx_0, miner_acc, miner_acc, TESTS_DEFAULT_FEE, blk_1r);
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1r, miner_acc, tx_0);
MAKE_NEXT_BLOCK(events, blk_3, blk_2, miner_acc);

View file

@ -61,8 +61,8 @@ bool gen_chain_switch_pow_pos::generate(std::vector<test_event_entry>& events) c
uint64_t buttloads_of_money = currency::get_outs_money_amount(blk_0.miner_tx);
m_premine_amount = buttloads_of_money;
MAKE_TX_FEE(events, tx_1, miner_acc, alice, buttloads_of_money - TX_DEFAULT_FEE, TX_DEFAULT_FEE, blk_0r); // N+5
buttloads_of_money -= TX_DEFAULT_FEE;
MAKE_TX_FEE(events, tx_1, miner_acc, alice, buttloads_of_money - TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, blk_0r); // N+5
buttloads_of_money -= TESTS_DEFAULT_FEE;
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_1); // N+6

View file

@ -887,7 +887,7 @@ bool test_generator::construct_pow_block_with_alias_info_in_coinbase(const accou
if (ai.m_sign.empty())
{
// if no alias update - reduce block reward by alias cost
uint64_t alias_cost = get_alias_coast_from_fee(ai.m_alias, TX_DEFAULT_FEE);
uint64_t alias_cost = get_alias_coast_from_fee(ai.m_alias, TESTS_DEFAULT_FEE);
uint64_t block_reward = get_outs_money_amount(miner_tx);
CHECK_AND_ASSERT_MES(alias_cost <= block_reward, false, "Alias '" << ai.m_alias << "' can't be registered via block coinbase, because it's price: " << print_money(alias_cost) << " is greater than block reward: " << print_money(block_reward));
block_reward -= alias_cost;
@ -1251,9 +1251,9 @@ bool fill_tx_sources_and_destinations(const std::vector<test_event_entry>& event
uint64_t source_amount_found = 0;
bool r = fill_tx_sources(sources, events, blk_head, from, amount + fee, nmix, std::vector<currency::tx_source_entry>(), check_for_spends, check_for_unlocktime, use_ref_by_id, &source_amount_found);
CHECK_AND_ASSERT_MES(r, false, "couldn't fill transaction sources: " << ENDL <<
" required: " << print_money(amount + fee) << " = " << std::fixed << std::setprecision(1) << ceil(1.0 * (amount + fee) / TX_DEFAULT_FEE) << " x TX_DEFAULT_FEE" << ENDL <<
" unspent coins: " << print_money(source_amount_found) << " = " << std::fixed << std::setprecision(1) << ceil(1.0 * source_amount_found / TX_DEFAULT_FEE) << " x TX_DEFAULT_FEE" << ENDL <<
" lack of coins: " << print_money(amount + fee - source_amount_found) << " = " << std::fixed << std::setprecision(1) << ceil(1.0 * (amount + fee - source_amount_found) / TX_DEFAULT_FEE) << " x TX_DEFAULT_FEE"
" required: " << print_money(amount + fee) << " = " << std::fixed << std::setprecision(1) << ceil(1.0 * (amount + fee) / TESTS_DEFAULT_FEE) << " x TESTS_DEFAULT_FEE" << ENDL <<
" unspent coins: " << print_money(source_amount_found) << " = " << std::fixed << std::setprecision(1) << ceil(1.0 * source_amount_found / TESTS_DEFAULT_FEE) << " x TESTS_DEFAULT_FEE" << ENDL <<
" lack of coins: " << print_money(amount + fee - source_amount_found) << " = " << std::fixed << std::setprecision(1) << ceil(1.0 * (amount + fee - source_amount_found) / TESTS_DEFAULT_FEE) << " x TESTS_DEFAULT_FEE"
);
uint64_t inputs_amount = get_inputs_amount(sources);

View file

@ -16,7 +16,7 @@
#include "chaingen_helpers.h"
#define TESTS_DEFAULT_FEE ((uint64_t)TX_DEFAULT_FEE)
#define MK_TEST_COINS(amount) (static_cast<uint64_t>(amount) * TESTS_DEFAULT_FEE)
#define MK_TEST_COINS(amount) (static_cast<uint64_t>(amount) * TX_DEFAULT_FEE)
#define TESTS_POS_CONFIG_MIN_COINSTAKE_AGE 4
#define TESTS_POS_CONFIG_POS_MINIMUM_HEIGH 4
@ -553,7 +553,7 @@ bool construct_tx_to_key(const std::vector<test_event_entry>& events,
const currency::block& blk_head,
const currency::account_base& from,
const std::vector<currency::tx_destination_entry>& destinations,
uint64_t fee = TX_DEFAULT_FEE,
uint64_t fee = TESTS_DEFAULT_FEE,
size_t nmix = 0,
uint8_t mix_attr = CURRENCY_TO_KEY_OUT_RELAXED,
const std::vector<currency::extra_v>& extr = empty_extra,
@ -622,7 +622,7 @@ bool make_tx_multisig_to_key(const currency::transaction& source_tx,
const std::list<currency::account_keys>& participants,
const currency::account_public_address& target_address,
currency::transaction& tx,
uint64_t fee = TX_DEFAULT_FEE,
uint64_t fee = TESTS_DEFAULT_FEE,
const std::vector<currency::attachment_v>& attachments = empty_attachment,
const std::vector<currency::extra_v>& extra = empty_extra);
@ -1124,7 +1124,7 @@ void append_vector_by_another_vector(U& dst, const V& src)
transaction TX_VAR = AUTO_VAL_INIT(TX_VAR); \
{ \
std::vector<tx_destination_entry> destinations(1, tx_destination_entry(MONEY, DEST_ACC.get_public_address())); \
WLT_WAR->transfer(destinations, 0, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), TX_VAR); \
WLT_WAR->transfer(destinations, 0, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), TX_VAR); \
} \
EVENTS_VEC.push_back(TX_VAR)
@ -1132,7 +1132,7 @@ void append_vector_by_another_vector(U& dst, const V& src)
transaction TX_VAR = AUTO_VAL_INIT(TX_VAR); \
{ \
std::vector<tx_destination_entry> destinations(1, tx_destination_entry(MONEY, DEST_ACC.get_public_address())); \
WLT_WAR->transfer(destinations, 0, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), ATTACH, TX_VAR); \
WLT_WAR->transfer(destinations, 0, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), ATTACH, TX_VAR); \
} \
EVENTS_VEC.push_back(TX_VAR)
@ -1140,7 +1140,7 @@ void append_vector_by_another_vector(U& dst, const V& src)
transaction TX_VAR = AUTO_VAL_INIT(TX_VAR); \
{ \
std::vector<tx_destination_entry> destinations(1, tx_destination_entry(MONEY, DEST_ACC.get_public_address())); \
WLT_WAR->transfer(destinations, 0, 0, TX_DEFAULT_FEE, EXTRA, std::vector<attachment_v>(), TX_VAR); \
WLT_WAR->transfer(destinations, 0, 0, TESTS_DEFAULT_FEE, EXTRA, std::vector<attachment_v>(), TX_VAR); \
} \
EVENTS_VEC.push_back(TX_VAR)

View file

@ -138,7 +138,7 @@ bool gen_checkpoints_invalid_keyimage::generate(std::vector<test_event_entry>& e
std::vector<tx_source_entry> sources;
std::vector<tx_destination_entry> destinations;
bool r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc, miner_acc, MK_TEST_COINS(1), TX_DEFAULT_FEE, 0, sources, destinations);
bool 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");
tx_builder tb;
tb.step1_init();

View file

@ -169,7 +169,7 @@ bool pos_emission_test::generate(std::vector<test_event_entry> &events)
m_total_money_in_minting = m_pos_entries_to_generate * pos_entry_amount;
std::vector<tx_source_entry> sources;
bool r = fill_tx_sources(sources, events, blk_0r, preminer_acc.get_keys(), m_total_money_in_minting + TX_DEFAULT_FEE, 0);
bool r = fill_tx_sources(sources, events, blk_0r, preminer_acc.get_keys(), m_total_money_in_minting + TESTS_DEFAULT_FEE, 0);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
std::vector<tx_destination_entry> destinations;
for (size_t i = 0; i < m_pos_entries_to_generate; ++i)
@ -271,7 +271,7 @@ bool pos_emission_test::c1(currency::core& c, size_t ev_index, const std::vector
{
uint64_t amount = std::min(wallet_balance_unlocked, wallet_balance - m_total_money_in_minting);
size_t tx_count_before = c.get_pool_transactions_count();
alice_wlt->transfer(amount - TX_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address()); // transfer out excess of money
alice_wlt->transfer(amount - TESTS_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address()); // transfer out excess of money
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() > tx_count_before, false, "invalid number of txs in tx pool: " << c.get_pool_transactions_count());
}
@ -445,7 +445,7 @@ bool pos_emission_test::populate_wallet_with_pos_entries(std::shared_ptr<tools::
uint64_t total_stake_transferred = m_pos_entries_to_generate * m_pos_entry_amount;
CHECK_AND_ASSERT_MES(total_stake_transferred <= m_total_money_in_minting, false, "total_stake_transferred: " << total_stake_transferred << ", m_total_money_in_minting: " << m_total_money_in_minting);
uint64_t remainder = m_total_money_in_minting - total_stake_transferred;
if (remainder > TX_DEFAULT_FEE)
if (remainder > TESTS_DEFAULT_FEE)
coin_source->transfer(remainder, w->get_account().get_public_address());
return true;
@ -525,8 +525,8 @@ bool pos_emission_test::c3(currency::core& c, size_t ev_index, const std::vector
uint64_t unlocked_balance = 0;
uint64_t total_balance = current_wallet->balance(unlocked_balance);
CHECK_AND_ASSERT_MES(unlocked_balance == total_balance, false, "Total and unlocked balances don't equal: " << unlocked_balance << " != " << total_balance);
if (unlocked_balance > TX_DEFAULT_FEE)
current_wallet->transfer(unlocked_balance - TX_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address()); // transfer out all the money to Miner -- clear pos entries
if (unlocked_balance > TESTS_DEFAULT_FEE)
current_wallet->transfer(unlocked_balance - TESTS_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address()); // transfer out all the money to Miner -- clear pos entries
r = populate_wallet_with_pos_entries(current_wallet, dan_wlt, change_pos_entries_iter_index++, pos_entries_change_scheme::change_pos_entries_count);
CHECK_AND_ASSERT_MES(r, false, "populate_wallet_with_pos_entries failed");

View file

@ -177,7 +177,7 @@ inline bool build_custom_escrow_template(const std::vector<test_event_entry>& ev
std::vector<tx_destination_entry> destinations;
bool r = false, need_to_resign = false;
uint64_t a_inputs_amount = (~custom_config_mask & eccf_template_inv_a_inputs) ? cpd.amount_a_pledge + cpd.amount_to_pay : TX_DEFAULT_FEE * 2;
uint64_t a_inputs_amount = (~custom_config_mask & eccf_template_inv_a_inputs) ? cpd.amount_a_pledge + cpd.amount_to_pay : TESTS_DEFAULT_FEE * 2;
uint64_t ms_amount = (~custom_config_mask & eccf_template_inv_ms_amount) ? cpd.amount_a_pledge + cpd.amount_b_pledge + cpd.amount_to_pay + b_fee_release : cpd.amount_a_pledge + cpd.amount_b_pledge + cpd.amount_to_pay;
r = fill_tx_sources(sources, events, head, a_keys, a_inputs_amount, nmix, used_sources);
@ -204,7 +204,7 @@ inline bool build_custom_escrow_template(const std::vector<test_event_entry>& ev
else if (custom_config_mask & eccf_template_more_than_1_multisig)
{
destinations.push_back(tx_destination_entry(ms_amount, std::list<account_public_address>({ a_keys.m_account_address, cpd.b_addr }))); // seems to be correct
destinations.push_back(tx_destination_entry(TX_DEFAULT_FEE, std::list<account_public_address>({ a_keys.m_account_address, cpd.b_addr }))); // double multisig - incorrect
destinations.push_back(tx_destination_entry(TESTS_DEFAULT_FEE, std::list<account_public_address>({ a_keys.m_account_address, cpd.b_addr }))); // double multisig - incorrect
}
else
destinations.push_back(tx_destination_entry(ms_amount, std::list<account_public_address>({ a_keys.m_account_address, cpd.b_addr }))); // truly correct
@ -334,7 +334,7 @@ inline bool build_custom_escrow_release_template(
// inputs
// create multisig (A-B) source, add keys from B
tx_source_entry se = AUTO_VAL_INIT(se);
se.amount = (~custom_config_mask & eccf_rel_template_inv_ms_amount) ? escrow_template_tx.vout[ms_idx].amount : escrow_template_tx.vout[ms_idx].amount + 10 * TX_DEFAULT_FEE;
se.amount = (~custom_config_mask & eccf_rel_template_inv_ms_amount) ? escrow_template_tx.vout[ms_idx].amount : escrow_template_tx.vout[ms_idx].amount + 10 * TESTS_DEFAULT_FEE;
se.multisig_id = ms_id;
se.real_output_in_tx_index = ms_idx;
se.real_out_tx_key = get_tx_pub_key_from_extra(escrow_template_tx);
@ -363,7 +363,7 @@ inline bool build_custom_escrow_release_template(
{
destinations.push_back(tx_destination_entry(cpd.amount_a_pledge, cpd.a_addr));
destinations.push_back(tx_destination_entry(cpd.amount_b_pledge + cpd.amount_to_pay, cpd.b_addr));
destinations.push_back(tx_destination_entry(10 * TX_DEFAULT_FEE, cpd.b_addr));
destinations.push_back(tx_destination_entry(10 * TESTS_DEFAULT_FEE, cpd.b_addr));
}
else
{ // correct

View file

@ -64,7 +64,7 @@ bool escrow_wallet_test::prepare_proposal_accepted_test(currency::core& c, const
LOG_PRINT_MAGENTA("Seller Address: " << currency::get_account_address_as_str(accunt_seller.get_public_address()), LOG_LEVEL_0);
#define AMOUNT_TO_TRANSFER_ESCROW (TX_DEFAULT_FEE*10)
#define AMOUNT_TO_TRANSFER_ESCROW (TESTS_DEFAULT_FEE*10)
std::shared_ptr<tools::wallet2> miner_wlt = init_playtime_test_wallet(events, c, m_mining_accunt);
size_t blocks_fetched = 0;
@ -74,11 +74,11 @@ bool escrow_wallet_test::prepare_proposal_accepted_test(currency::core& c, const
// CHECK_AND_FORCE_ASSERT_MES(blocks_fetched == CURRENCY_MINED_MONEY_UNLOCK_WINDOW, false, "Incorrect numbers of blocks fetched");
CHECK_AND_FORCE_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
miner_wlt->transfer(AMOUNT_TO_TRANSFER_ESCROW * 2 + TX_DEFAULT_FEE, accunt_buyer.get_public_address());
LOG_PRINT_MAGENTA("Transaction sent to buyer_account: " << AMOUNT_TO_TRANSFER_ESCROW * 2 + TX_DEFAULT_FEE, LOG_LEVEL_0);
miner_wlt->transfer(AMOUNT_TO_TRANSFER_ESCROW * 2 + TESTS_DEFAULT_FEE, accunt_buyer.get_public_address());
LOG_PRINT_MAGENTA("Transaction sent to buyer_account: " << AMOUNT_TO_TRANSFER_ESCROW * 2 + TESTS_DEFAULT_FEE, LOG_LEVEL_0);
miner_wlt->transfer(AMOUNT_TO_TRANSFER_ESCROW + TX_DEFAULT_FEE * 2, accunt_seller.get_public_address());
LOG_PRINT_MAGENTA("Transaction sent to seller_account: " << AMOUNT_TO_TRANSFER_ESCROW + TX_DEFAULT_FEE * 2, LOG_LEVEL_0);
miner_wlt->transfer(AMOUNT_TO_TRANSFER_ESCROW + TESTS_DEFAULT_FEE * 2, accunt_seller.get_public_address());
LOG_PRINT_MAGENTA("Transaction sent to seller_account: " << AMOUNT_TO_TRANSFER_ESCROW + TESTS_DEFAULT_FEE * 2, LOG_LEVEL_0);
bool r = mine_next_pow_blocks_in_playtime(m_mining_accunt.get_public_address(), c, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
CHECK_AND_ASSERT_MES(r, false, "mine_next_pow_blocks_in_playtime failed");
@ -92,8 +92,8 @@ bool escrow_wallet_test::prepare_proposal_accepted_test(currency::core& c, const
wallet_seller->callback(seller_backend_mock);
wallet_buyer->refresh();
wallet_seller->refresh();
CHECK_AND_FORCE_ASSERT_MES(wallet_buyer->balance() == AMOUNT_TO_TRANSFER_ESCROW * 2 + TX_DEFAULT_FEE, false, "Incorrect balance");
CHECK_AND_FORCE_ASSERT_MES(wallet_seller->balance() == AMOUNT_TO_TRANSFER_ESCROW + TX_DEFAULT_FEE * 2, false, "Incorrect balance");
CHECK_AND_FORCE_ASSERT_MES(wallet_buyer->balance() == AMOUNT_TO_TRANSFER_ESCROW * 2 + TESTS_DEFAULT_FEE, false, "Incorrect balance");
CHECK_AND_FORCE_ASSERT_MES(wallet_seller->balance() == AMOUNT_TO_TRANSFER_ESCROW + TESTS_DEFAULT_FEE * 2, false, "Incorrect balance");
bc_services::contract_private_details cpd = AUTO_VAL_INIT(cpd);
@ -106,7 +106,7 @@ bool escrow_wallet_test::prepare_proposal_accepted_test(currency::core& c, const
cpd.amount_to_pay = AMOUNT_TO_TRANSFER_ESCROW;
cpd.comment = "I'll build by own theme park. With black jack, and hookers.";
cpd.title = "Afterlife? If I thought I had to live another life, I'd kill myself right now!";
wallet_buyer->send_escrow_proposal(cpd, 0, 0, 3600, TX_DEFAULT_FEE, TX_DEFAULT_FEE, "", escrow_proposal_tx, escrow_template_tx);
wallet_buyer->send_escrow_proposal(cpd, 0, 0, 3600, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, "", escrow_proposal_tx, escrow_template_tx);
auto it = std::find_if(escrow_template_tx.vout.begin(), escrow_template_tx.vout.end(), [](const tx_out& o){
if (o.target.type() == typeid(txout_multisig))
@ -145,7 +145,7 @@ bool escrow_wallet_test::prepare_proposal_accepted_test(currency::core& c, const
//----------------------
// accept proposal
//----------------------
wallet_seller->accept_proposal(multisig_id, TX_DEFAULT_FEE);
wallet_seller->accept_proposal(multisig_id, TESTS_DEFAULT_FEE);
r = mine_next_pow_blocks_in_playtime(m_mining_accunt.get_public_address(), c, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
@ -229,11 +229,11 @@ bool escrow_wallet_test::exec_test_with_cancel_release_type(currency::core& c, c
//----------------------
wallet_miner = init_playtime_test_wallet(events, c, m_mining_accunt);
wallet_miner->refresh();
wallet_miner->transfer(TX_DEFAULT_FEE, wallet_buyer->get_account().get_public_address());
wallet_miner->transfer(TESTS_DEFAULT_FEE, wallet_buyer->get_account().get_public_address());
r = mine_next_pow_blocks_in_playtime(m_mining_accunt.get_public_address(), c, 10);
wallet_buyer->refresh();
tools::wallet2::escrow_contracts_container contracts_buyer, contracts_seller;
wallet_buyer->request_cancel_contract(multisig_id, TX_DEFAULT_FEE, 60 * 60);
wallet_buyer->request_cancel_contract(multisig_id, TESTS_DEFAULT_FEE, 60 * 60);
r = mine_next_pow_blocks_in_playtime(m_mining_accunt.get_public_address(), c, 2);
wallet_buyer->refresh();
wallet_seller->refresh();
@ -295,7 +295,7 @@ bool escrow_wallet_test::c1(currency::core& c, size_t ev_index, const std::vecto
//------------------------------------------------------------------------------
escrow_w_and_fake_outputs::escrow_w_and_fake_outputs()
: m_pledge_amount(TX_DEFAULT_FEE * 9)
: m_pledge_amount(TESTS_DEFAULT_FEE * 9)
, m_alice_bob_start_chunk_amount(0)
{
REGISTER_CALLBACK_METHOD(escrow_w_and_fake_outputs, c1);
@ -366,7 +366,7 @@ bool escrow_w_and_fake_outputs::c1(currency::core& c, size_t ev_index, const std
bc_services::contract_private_details cpd = AUTO_VAL_INIT(cpd);
cpd.amount_a_pledge = m_pledge_amount;
cpd.amount_b_pledge = m_pledge_amount;
cpd.amount_to_pay = TX_DEFAULT_FEE * 7;
cpd.amount_to_pay = TESTS_DEFAULT_FEE * 7;
cpd.a_addr = m_accounts[ALICE_ACC_IDX].get_public_address();
cpd.b_addr = m_accounts[BOB_ACC_IDX].get_public_address();
cpd.comment = get_random_text(1024);
@ -375,13 +375,13 @@ bool escrow_w_and_fake_outputs::c1(currency::core& c, size_t ev_index, const std
transaction proposal_tx = AUTO_VAL_INIT(proposal_tx);
transaction escrow_template_tx = AUTO_VAL_INIT(escrow_template_tx);
test_core_time::adjust(boost::get<block>(events[ev_index - 1]).timestamp + 5); // determenistic time, 'cause escrow template uses current time => time affects hashes
alice_wlt->send_escrow_proposal(cpd, fake_outs_count, 0, 0, TX_DEFAULT_FEE, TX_DEFAULT_FEE, "", proposal_tx, escrow_template_tx);
alice_wlt->send_escrow_proposal(cpd, fake_outs_count, 0, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, "", proposal_tx, escrow_template_tx);
uint64_t alice_post_proposal_balance = alice_wlt->balance();
uint64_t alice_spent_for_proposal = alice_start_balance - alice_post_proposal_balance;
uint64_t alice_expected_spends_for_proposal = TX_DEFAULT_FEE;
uint64_t alice_expected_spends_for_proposal = TESTS_DEFAULT_FEE;
CHECK_AND_ASSERT_MES(alice_spent_for_proposal == alice_expected_spends_for_proposal, false, "Incorrect Alice post-proposal balance: " << alice_post_proposal_balance << ENDL <<
"Alice has spent for sending proposal: " << alice_spent_for_proposal << ENDL <<
"Alice should spend for sending proposal: " << alice_expected_spends_for_proposal << " (pledge: " << cpd.amount_a_pledge << ", amount: " << cpd.amount_to_pay << ", fee: " << TX_DEFAULT_FEE << ")");
"Alice should spend for sending proposal: " << alice_expected_spends_for_proposal << " (pledge: " << cpd.amount_a_pledge << ", amount: " << cpd.amount_to_pay << ", fee: " << TESTS_DEFAULT_FEE << ")");
CHECK_AND_ASSERT_MES(check_wallet_balance_blocked_for_escrow(*alice_wlt.get(), "Alice", cpd.amount_a_pledge + cpd.amount_to_pay), false, "");
// check that inputs contain correct number of fake mix-ins
@ -402,7 +402,7 @@ bool escrow_w_and_fake_outputs::c1(currency::core& c, size_t ev_index, const std
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
bob_wlt->refresh();
bob_wlt->accept_proposal(ms_id, TX_DEFAULT_FEE);
bob_wlt->accept_proposal(ms_id, TESTS_DEFAULT_FEE);
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
@ -424,20 +424,20 @@ bool escrow_w_and_fake_outputs::c1(currency::core& c, size_t ev_index, const std
alice_wlt->reset_history(); // just for watching full wallet's history in the log on refresh
alice_wlt->refresh();
// Alice pays fee ones: for sending a proposal
uint64_t alice_estimated_end_balance = alice_start_balance - cpd.amount_to_pay - TX_DEFAULT_FEE * 1;
uint64_t alice_estimated_end_balance = alice_start_balance - cpd.amount_to_pay - TESTS_DEFAULT_FEE * 1;
if (!check_balance_via_wallet(*alice_wlt.get(), "alice", alice_estimated_end_balance, 0, alice_estimated_end_balance, 0, 0))
return false;
bob_wlt->reset_history(); // just for watching full wallet's history in the log on refresh
bob_wlt->refresh();
// Bob pays double fee: one for accepting prorpsal and another for finishing contract
uint64_t bob_estimated_end_balance = bob_start_balance + cpd.amount_to_pay - TX_DEFAULT_FEE * 2;
uint64_t bob_estimated_end_balance = bob_start_balance + cpd.amount_to_pay - TESTS_DEFAULT_FEE * 2;
if (!check_balance_via_wallet(*bob_wlt.get(), "bob", bob_estimated_end_balance, 0, bob_estimated_end_balance, 0, 0))
return false;
// withdraw all money from Bob and Alice accounts to make sure they're spendadble
alice_wlt->transfer(alice_estimated_end_balance - TX_DEFAULT_FEE, m_accounts[CAROL_ACC_IDX].get_public_address());
bob_wlt->transfer(bob_estimated_end_balance - TX_DEFAULT_FEE, m_accounts[CAROL_ACC_IDX].get_public_address());
alice_wlt->transfer(alice_estimated_end_balance - TESTS_DEFAULT_FEE, m_accounts[CAROL_ACC_IDX].get_public_address());
bob_wlt->transfer(bob_estimated_end_balance - TESTS_DEFAULT_FEE, m_accounts[CAROL_ACC_IDX].get_public_address());
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 2, false, "Incorrect txs count in the pool");
@ -449,7 +449,7 @@ bool escrow_w_and_fake_outputs::c1(currency::core& c, size_t ev_index, const std
// make sure money was successfully transferred
std::shared_ptr<tools::wallet2> carol_wlt = init_playtime_test_wallet(events, c, CAROL_ACC_IDX);
carol_wlt->refresh();
if (!check_balance_via_wallet(*carol_wlt.get(), "carol", alice_estimated_end_balance + bob_estimated_end_balance - TX_DEFAULT_FEE * 2))
if (!check_balance_via_wallet(*carol_wlt.get(), "carol", alice_estimated_end_balance + bob_estimated_end_balance - TESTS_DEFAULT_FEE * 2))
return false;
// and make sure Alice's and Bob's wallets are empty
@ -488,13 +488,13 @@ bool escrow_incorrect_proposal::generate(std::vector<test_event_entry>& events)
std::vector<tx_source_entry> used_sources;
bc_services::contract_private_details cpd = AUTO_VAL_INIT(cpd);
cpd.amount_a_pledge = TX_DEFAULT_FEE * 12;
cpd.amount_b_pledge = TX_DEFAULT_FEE * 13;
cpd.amount_to_pay = TX_DEFAULT_FEE * 3;
cpd.amount_a_pledge = TESTS_DEFAULT_FEE * 12;
cpd.amount_b_pledge = TESTS_DEFAULT_FEE * 13;
cpd.amount_to_pay = TESTS_DEFAULT_FEE * 3;
cpd.a_addr = miner_acc.get_public_address();
cpd.b_addr = alice_acc.get_public_address();
MAKE_TX(events, tx_1, miner_acc, alice_acc, cpd.amount_b_pledge + TX_DEFAULT_FEE * 2, blk_0r);
MAKE_TX(events, tx_1, miner_acc, alice_acc, cpd.amount_b_pledge + TESTS_DEFAULT_FEE * 2, blk_0r);
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_1);
REWIND_BLOCKS_N_WITH_TIME(events, blk_1r, blk_1, miner_acc, WALLET_DEFAULT_TX_SPENDABLE_AGE);
@ -506,7 +506,7 @@ bool escrow_incorrect_proposal::generate(std::vector<test_event_entry>& events)
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, TX_DEFAULT_FEE, TX_DEFAULT_FEE, normal_escrow_mask, normal_escrow_proposal_tx, used_sources);
r = build_custom_escrow_proposal(events, blk_1r, miner_acc.get_keys(), cpd, 0, 0, 0, blk_1r.timestamp + 3600, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, normal_escrow_mask, normal_escrow_proposal_tx, used_sources);
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_proposal failed");
events.push_back(normal_escrow_proposal_tx);
@ -551,7 +551,7 @@ bool escrow_incorrect_proposal::generate(std::vector<test_event_entry>& events)
cpd.comment = "#" + std::to_string(i) + " " + custom_config_masks[i].name;
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, TX_DEFAULT_FEE, TX_DEFAULT_FEE, config_mask, escrow_proposal_tx, used_sources);
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, 0, 0, 0, top_block.timestamp + 3600, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, config_mask, 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);
@ -580,7 +580,7 @@ bool escrow_incorrect_proposal::generate(std::vector<test_event_entry>& events)
cpd.comment = "incorrect unlock time (past)";
transaction tx = AUTO_VAL_INIT(tx);
// 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, TX_DEFAULT_FEE, TX_DEFAULT_FEE, eccf_normal, tx, used_sources);
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, top_block.timestamp, 0, top_block.timestamp, 0, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, eccf_normal, tx, 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);
@ -593,7 +593,7 @@ bool escrow_incorrect_proposal::generate(std::vector<test_event_entry>& events)
transaction tx = AUTO_VAL_INIT(tx);
// 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, TX_DEFAULT_FEE, TX_DEFAULT_FEE, eccf_normal, tx, used_sources);
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, unlock_time, 0, unlock_time, 0, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, eccf_normal, tx, used_sources);
CHECK_AND_ASSERT_MES(r, false, "build_custom_escrow_proposal failed");
LOG_PRINT_YELLOW("proposal tx: " << get_transaction_hash(tx) << " is built for " << cpd.comment, LOG_LEVEL_0);
events.push_back(tx);
@ -604,7 +604,7 @@ bool escrow_incorrect_proposal::generate(std::vector<test_event_entry>& events)
{
cpd.comment = "template zero expiration time";
transaction tx = AUTO_VAL_INIT(tx);
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, 0, 0, 0, 0, 0, TX_DEFAULT_FEE, TX_DEFAULT_FEE, eccf_normal, tx, used_sources);
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, 0, 0, 0, 0, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, eccf_normal, tx, used_sources);
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);
@ -617,7 +617,7 @@ bool escrow_incorrect_proposal::generate(std::vector<test_event_entry>& events)
transaction tx = AUTO_VAL_INIT(tx);
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, TX_DEFAULT_FEE, TX_DEFAULT_FEE, eccf_normal, tx, used_sources);
r = build_custom_escrow_proposal(events, top_block, miner_acc.get_keys(), cpd, 0, proposal_expiration_time, 0, template_expiration_time, 0, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, eccf_normal, tx, 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);
@ -648,7 +648,7 @@ bool escrow_incorrect_proposal::check_normal_proposal(currency::core& c, size_t
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
alice_wlt->accept_proposal(contract_id, TX_DEFAULT_FEE);
alice_wlt->accept_proposal(contract_id, TESTS_DEFAULT_FEE);
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
@ -758,9 +758,9 @@ bool escrow_proposal_expiration::c1(currency::core& c, size_t ev_index, const st
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
bc_services::contract_private_details cpd = AUTO_VAL_INIT(cpd);
cpd.amount_a_pledge = TX_DEFAULT_FEE * 9;
cpd.amount_b_pledge = TX_DEFAULT_FEE * 9;
cpd.amount_to_pay = TX_DEFAULT_FEE * 7;
cpd.amount_a_pledge = TESTS_DEFAULT_FEE * 9;
cpd.amount_b_pledge = TESTS_DEFAULT_FEE * 9;
cpd.amount_to_pay = TESTS_DEFAULT_FEE * 7;
cpd.a_addr = m_accounts[ALICE_ACC_IDX].get_public_address();
cpd.b_addr = m_accounts[BOB_ACC_IDX].get_public_address();
cpd.comment = get_random_text(2048);
@ -770,10 +770,10 @@ bool escrow_proposal_expiration::c1(currency::core& c, size_t ev_index, const st
transaction proposal_tx = AUTO_VAL_INIT(proposal_tx);
transaction escrow_template_tx = AUTO_VAL_INIT(escrow_template_tx);
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_period, TX_DEFAULT_FEE, TX_DEFAULT_FEE, "", proposal_tx, escrow_template_tx);
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_period, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, "", proposal_tx, escrow_template_tx);
LOG_PRINT_CYAN("alice transfers: " << ENDL << alice_wlt->dump_trunsfers(), LOG_LEVEL_0);
uint64_t alice_post_proposal_balance = alice_wlt->balance();
uint64_t alice_post_proposal_balance_expected = alice_start_balance - TX_DEFAULT_FEE;
uint64_t alice_post_proposal_balance_expected = alice_start_balance - TESTS_DEFAULT_FEE;
CHECK_AND_ASSERT_MES(alice_post_proposal_balance == alice_post_proposal_balance_expected, false, "Incorrect alice_post_proposal_balance: " << print_money(alice_post_proposal_balance) << ", expected: " << print_money(alice_post_proposal_balance_expected));
std::deque<tools::wallet2::transfer_details> transfers;
alice_wlt->get_transfers(transfers);
@ -803,7 +803,7 @@ bool escrow_proposal_expiration::c1(currency::core& c, size_t ev_index, const st
// check Alice's balance
alice_wlt->refresh();
uint64_t alice_balance = alice_wlt->balance();
uint64_t alice_expected_balance = alice_start_balance - TX_DEFAULT_FEE;
uint64_t alice_expected_balance = alice_start_balance - TESTS_DEFAULT_FEE;
CHECK_AND_ASSERT_MES(alice_balance == alice_expected_balance, false, "Alice has incorrect balance after her proposal is expired: " << alice_balance << ", expected: " << alice_expected_balance);
// check Bob's contracts
@ -813,7 +813,7 @@ bool escrow_proposal_expiration::c1(currency::core& c, size_t ev_index, const st
r = false;
try
{
bob_wlt->accept_proposal(ms_id, TX_DEFAULT_FEE);
bob_wlt->accept_proposal(ms_id, TESTS_DEFAULT_FEE);
}
catch (tools::error::tx_rejected&)
{
@ -841,9 +841,9 @@ bool escrow_proposal_expiration::c2(currency::core& c, size_t ev_index, const st
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool: " << c.get_pool_transactions_count());
bc_services::contract_private_details cpd = AUTO_VAL_INIT(cpd);
cpd.amount_a_pledge = TX_DEFAULT_FEE * 7;
cpd.amount_b_pledge = TX_DEFAULT_FEE * 7;
cpd.amount_to_pay = TX_DEFAULT_FEE * 13;
cpd.amount_a_pledge = TESTS_DEFAULT_FEE * 7;
cpd.amount_b_pledge = TESTS_DEFAULT_FEE * 7;
cpd.amount_to_pay = TESTS_DEFAULT_FEE * 13;
cpd.a_addr = m_accounts[ALICE_ACC_IDX].get_public_address();
cpd.b_addr = m_accounts[BOB_ACC_IDX].get_public_address();
cpd.comment = get_random_text(2048);
@ -853,7 +853,7 @@ bool escrow_proposal_expiration::c2(currency::core& c, size_t ev_index, const st
transaction proposal_tx = AUTO_VAL_INIT(proposal_tx);
transaction escrow_template_tx = AUTO_VAL_INIT(escrow_template_tx);
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_period, TX_DEFAULT_FEE, TX_DEFAULT_FEE, "", proposal_tx, escrow_template_tx);
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_period, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, "", proposal_tx, escrow_template_tx);
LOG_PRINT_CYAN("%%%%% Escrow proposal sent, Alice's transfers: " << ENDL << alice_wlt->dump_trunsfers(), LOG_LEVEL_0);
CHECK_AND_ASSERT_MES(check_wallet_balance_blocked_for_escrow(*alice_wlt.get(), "Alice", cpd.amount_a_pledge + cpd.amount_to_pay), false, "");
crypto::hash ms_id = get_multisig_out_id(escrow_template_tx, get_multisig_out_index(escrow_template_tx.vout));
@ -887,7 +887,7 @@ bool escrow_proposal_expiration::c2(currency::core& c, size_t ev_index, const st
r = false;
try
{
bob_wlt->accept_proposal(ms_id, TX_DEFAULT_FEE);
bob_wlt->accept_proposal(ms_id, TESTS_DEFAULT_FEE);
}
catch (tools::error::tx_rejected&)
{
@ -910,7 +910,7 @@ bool escrow_proposal_expiration::c2(currency::core& c, size_t ev_index, const st
r = false;
try
{
bob_wlt->accept_proposal(ms_id, TX_DEFAULT_FEE);
bob_wlt->accept_proposal(ms_id, TESTS_DEFAULT_FEE);
}
catch (tools::error::tx_rejected&)
{
@ -918,7 +918,7 @@ bool escrow_proposal_expiration::c2(currency::core& c, size_t ev_index, const st
}
CHECK_AND_ASSERT_MES(r, false, "Bob tried to accept an expired proposal, but wallet exception was not caught");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TX_DEFAULT_FEE), false, "");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TESTS_DEFAULT_FEE), false, "");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_start_balance), false, "");
return true;
@ -1079,7 +1079,7 @@ bool escrow_proposal_and_accept_expiration::c1(currency::core& c, size_t ev_inde
}
CHECK_AND_ASSERT_MES(r, false, "Bob tried to accept an expired proposal, but wallet exception was not caught");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TX_DEFAULT_FEE), false, "");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TESTS_DEFAULT_FEE), false, "");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_start_balance), false, "");
return true;
@ -1131,20 +1131,20 @@ bool escrow_incorrect_proposal_acceptance::generate(std::vector<test_event_entry
REWIND_BLOCKS_N_WITH_TIME(events, blk_1r, blk_1, miner_acc, WALLET_DEFAULT_TX_SPENDABLE_AGE);
// prepare contract details
m_cpd.amount_a_pledge = TX_DEFAULT_FEE * 12;
m_cpd.amount_b_pledge = TX_DEFAULT_FEE * 13;
m_cpd.amount_to_pay = TX_DEFAULT_FEE * 3;
m_cpd.amount_a_pledge = TESTS_DEFAULT_FEE * 12;
m_cpd.amount_b_pledge = TESTS_DEFAULT_FEE * 13;
m_cpd.amount_to_pay = TESTS_DEFAULT_FEE * 3;
m_cpd.a_addr = alice_acc.get_public_address();
m_cpd.b_addr = bob_acc.get_public_address();
m_bob_fee_release = 10 * TX_DEFAULT_FEE; // Alice states that Bob should pay this much money for upcoming contract release (which will be sent by Alice)
uint64_t bob_fee_acceptance = TX_DEFAULT_FEE;
m_bob_fee_release = 10 * TESTS_DEFAULT_FEE; // Alice states that Bob should pay this much money for upcoming contract release (which will be sent by Alice)
uint64_t bob_fee_acceptance = TESTS_DEFAULT_FEE;
std::vector<tx_source_entry> used_sources;
// create escrow proposal
bc_services::proposal_body prop = AUTO_VAL_INIT(prop);
transaction escrow_proposal_tx = AUTO_VAL_INIT(escrow_proposal_tx);
r = build_custom_escrow_proposal(events, blk_1r, alice_acc.get_keys(), m_cpd, 0, 0, 0, blk_1r.timestamp + 36000, 0, TX_DEFAULT_FEE, m_bob_fee_release, eccf_normal, escrow_proposal_tx, used_sources, &prop);
r = build_custom_escrow_proposal(events, blk_1r, alice_acc.get_keys(), m_cpd, 0, 0, 0, blk_1r.timestamp + 36000, 0, TESTS_DEFAULT_FEE, m_bob_fee_release, eccf_normal, 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);
@ -1152,7 +1152,7 @@ bool escrow_incorrect_proposal_acceptance::generate(std::vector<test_event_entry
// create normal acceptance
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, TX_DEFAULT_FEE, m_bob_fee_release, normal_acceptance_mask, prop.tx_onetime_secret_key, escrow_normal_acceptance_tx, used_sources);
r = build_custom_escrow_accept_proposal(events, blk_2, 0, bob_acc.get_keys(), m_cpd, 0, 0, 0, 0, TESTS_DEFAULT_FEE, m_bob_fee_release, normal_acceptance_mask, prop.tx_onetime_secret_key, 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);
@ -1311,13 +1311,13 @@ bool escrow_incorrect_proposal_acceptance::check_normal_acceptance(currency::cor
alice_wlt->dump_trunsfers(ss, false);
LOG_PRINT_L0("check_normal_acceptance(" << release_instruction << "):" << ENDL << "Alice transfers: " << ENDL << ss.str());
uint64_t alice_balance = alice_wlt->balance();
uint64_t alice_balance_expected = m_alice_bob_start_amount - m_cpd.amount_a_pledge - m_cpd.amount_to_pay - TX_DEFAULT_FEE;
uint64_t alice_balance_expected = m_alice_bob_start_amount - m_cpd.amount_a_pledge - m_cpd.amount_to_pay - TESTS_DEFAULT_FEE;
CHECK_AND_ASSERT_MES(alice_balance == alice_balance_expected, false, "Alice has incorrect balance: " << alice_balance << ", expected: " << alice_balance_expected);
std::shared_ptr<tools::wallet2> bob_wlt = init_playtime_test_wallet(events, c, BOB_ACC_IDX);
bob_wlt->refresh();
uint64_t bob_balance = bob_wlt->balance();
uint64_t bob_balance_expected = m_alice_bob_start_amount - m_cpd.amount_b_pledge - m_bob_fee_release - TX_DEFAULT_FEE;
uint64_t bob_balance_expected = m_alice_bob_start_amount - m_cpd.amount_b_pledge - m_bob_fee_release - TESTS_DEFAULT_FEE;
CHECK_AND_ASSERT_MES(bob_balance == bob_balance_expected, false, "Bob has incorrect balance: " << bob_balance << ", expected: " << bob_balance_expected);
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
@ -1352,8 +1352,8 @@ bool escrow_incorrect_proposal_acceptance::check_normal_acceptance(currency::cor
CHECK_AND_ASSERT_MES(contracts.begin()->second.state == contract_expected_state, false, "Bob has invalid contract state: " << contracts.begin()->second.state << " expected: " << contract_expected_state);
uint64_t bob_balance_end = bob_wlt->balance();
bob_balance_expected = release_normal ? (m_alice_bob_start_amount + m_cpd.amount_to_pay - m_bob_fee_release - TX_DEFAULT_FEE) :
(m_alice_bob_start_amount - m_cpd.amount_b_pledge - m_bob_fee_release - TX_DEFAULT_FEE);
bob_balance_expected = release_normal ? (m_alice_bob_start_amount + m_cpd.amount_to_pay - m_bob_fee_release - TESTS_DEFAULT_FEE) :
(m_alice_bob_start_amount - m_cpd.amount_b_pledge - m_bob_fee_release - TESTS_DEFAULT_FEE);
CHECK_AND_ASSERT_MES(bob_balance_end == bob_balance_expected, false, "Bob has incorrect balance: " << bob_balance_end << ", expected: " << bob_balance_expected);
alice_wlt->refresh();
@ -1366,8 +1366,8 @@ bool escrow_incorrect_proposal_acceptance::check_normal_acceptance(currency::cor
CHECK_AND_ASSERT_MES(contracts.begin()->second.state == contract_expected_state, false, "Alice has invalid contract state: " << contracts.begin()->second.state << " expected: " << contract_expected_state);
uint64_t alice_balance_end = alice_wlt->balance();
alice_balance_expected = release_normal ? (m_alice_bob_start_amount - m_cpd.amount_to_pay - TX_DEFAULT_FEE) :
(m_alice_bob_start_amount - m_cpd.amount_a_pledge - m_cpd.amount_to_pay - TX_DEFAULT_FEE);
alice_balance_expected = release_normal ? (m_alice_bob_start_amount - m_cpd.amount_to_pay - TESTS_DEFAULT_FEE) :
(m_alice_bob_start_amount - m_cpd.amount_a_pledge - m_cpd.amount_to_pay - TESTS_DEFAULT_FEE);
CHECK_AND_ASSERT_MES(alice_balance_end == alice_balance_expected, false, "Alice has incorrect balance: " << alice_balance_end << ", expected: " << alice_balance_expected);
return true;
@ -1473,12 +1473,12 @@ bool escrow_custom_test::generate(std::vector<test_event_entry>& events) const
ADJUST_TEST_CORE_TIME(ts);
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 4);
const uint64_t chunk_amount = 10 * TX_DEFAULT_FEE;
const uint64_t chunk_amount = 10 * TESTS_DEFAULT_FEE;
const size_t chunks_count = 20;
uint64_t alice_bob_start_amount = chunks_count * chunk_amount;
std::vector<tx_source_entry> sources;
std::vector<tx_destination_entry> destinations;
r = fill_tx_sources(sources, events, blk_0r, miner_acc.get_keys(), 2 * alice_bob_start_amount, 0, true, true, false);
r = fill_tx_sources(sources, events, blk_0r, miner_acc.get_keys(), 2 * alice_bob_start_amount + TESTS_DEFAULT_FEE, 0, true, true, false);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
for(size_t i = 0; i < chunks_count; ++i)
{
@ -1505,17 +1505,17 @@ bool escrow_custom_test::generate(std::vector<test_event_entry>& events) const
escrow_custom_test_callback_details cd = AUTO_VAL_INIT(cd);
cd.alice_bob_start_amount = alice_bob_start_amount;
cd.cpd.comment = "normal contract";
cd.cpd.amount_a_pledge = 70 * TX_DEFAULT_FEE;
cd.cpd.amount_b_pledge = 94 * TX_DEFAULT_FEE;
cd.cpd.amount_to_pay = 18 * TX_DEFAULT_FEE;
cd.cpd.amount_a_pledge = 70 * TESTS_DEFAULT_FEE;
cd.cpd.amount_b_pledge = 94 * TESTS_DEFAULT_FEE;
cd.cpd.amount_to_pay = 18 * TESTS_DEFAULT_FEE;
cd.cpd.a_addr = alice_acc.get_public_address();
cd.cpd.b_addr = bob_acc.get_public_address();
cd.fake_outputs_count = 0;
cd.unlock_time = 0;
cd.proposal_expiration_period = 3600;
cd.a_proposal_fee = 10 * TX_DEFAULT_FEE;
cd.b_accept_fee = 1 * TX_DEFAULT_FEE;
cd.b_release_fee = 5 * TX_DEFAULT_FEE;
cd.a_proposal_fee = 10 * TESTS_DEFAULT_FEE;
cd.b_accept_fee = 1 * TESTS_DEFAULT_FEE;
cd.b_release_fee = 5 * TESTS_DEFAULT_FEE;
cd.payment_id = "payment id";
cd.release_type = BC_ESCROW_SERVICE_INSTRUCTION_RELEASE_NORMAL;
test_details.push_back(cd);
@ -1574,7 +1574,7 @@ bool escrow_custom_test::generate(std::vector<test_event_entry>& events) const
escrow_custom_test_callback_details cd = test_details[0];
cd.cpd.comment = "simple cancellation";
cd.release_type = BC_ESCROW_SERVICE_INSTRUCTION_RELEASE_CANCEL;
cd.a_cancel_proposal_fee = 3 * TX_DEFAULT_FEE;
cd.a_cancel_proposal_fee = 3 * TESTS_DEFAULT_FEE;
cd.cancellation_expiration_period = 1000;
test_details.push_back(cd);
}
@ -1583,7 +1583,7 @@ bool escrow_custom_test::generate(std::vector<test_event_entry>& events) const
escrow_custom_test_callback_details cd = test_details[0];
cd.cpd.comment = "release normal after cancellation request";
cd.release_type = BC_ESCROW_SERVICE_INSTRUCTION_RELEASE_NORMAL;
cd.a_cancel_proposal_fee = 3 * TX_DEFAULT_FEE; // this will trigger cancellation request
cd.a_cancel_proposal_fee = 3 * TESTS_DEFAULT_FEE; // this will trigger cancellation request
cd.cancellation_expiration_period = 1000;
test_details.push_back(cd);
}
@ -1894,14 +1894,14 @@ bool escrow_incorrect_cancel_proposal::generate(std::vector<test_event_entry>& e
MAKE_GENESIS_BLOCK(events, blk_0, preminer_acc, ts);
ADJUST_TEST_CORE_TIME(ts);
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 4);
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 9);
const uint64_t chunk_amount = 20 * TX_DEFAULT_FEE;
const uint64_t chunk_amount = 20 * TESTS_DEFAULT_FEE;
const size_t chunks_count = 20;
m_alice_bob_start_amount = chunks_count * chunk_amount;
std::vector<tx_source_entry> sources;
std::vector<tx_destination_entry> destinations;
r = fill_tx_sources(sources, events, blk_0r, miner_acc.get_keys(), 2 * m_alice_bob_start_amount, 0, true, true, false);
r = fill_tx_sources(sources, events, blk_0r, miner_acc.get_keys(), 2 * m_alice_bob_start_amount+ TESTS_DEFAULT_FEE, 0, true, true, false);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
for(size_t i = 0; i < chunks_count; ++i)
{
@ -1919,19 +1919,19 @@ bool escrow_incorrect_cancel_proposal::generate(std::vector<test_event_entry>& e
REWIND_BLOCKS_N_WITH_TIME(events, blk_1r, blk_1, miner_acc, WALLET_DEFAULT_TX_SPENDABLE_AGE);
// prepare contract details
m_cpd.amount_a_pledge = TX_DEFAULT_FEE * 12;
m_cpd.amount_b_pledge = TX_DEFAULT_FEE * 13;
m_cpd.amount_to_pay = TX_DEFAULT_FEE * 3;
m_cpd.amount_a_pledge = TESTS_DEFAULT_FEE * 12;
m_cpd.amount_b_pledge = TESTS_DEFAULT_FEE * 13;
m_cpd.amount_to_pay = TESTS_DEFAULT_FEE * 3;
m_cpd.a_addr = alice_acc.get_public_address();
m_cpd.b_addr = bob_acc.get_public_address();
m_bob_fee_release = 10 * TX_DEFAULT_FEE; // Alice states that Bob should pay this much money for upcoming contract release (which will be sent by Alice)
m_bob_fee_release = 10 * TESTS_DEFAULT_FEE; // Alice states that Bob should pay this much money for upcoming contract release (which will be sent by Alice)
std::vector<tx_source_entry> used_sources;
// create normal escrow proposal
bc_services::proposal_body prop = AUTO_VAL_INIT(prop);
transaction escrow_proposal_tx = AUTO_VAL_INIT(escrow_proposal_tx);
r = build_custom_escrow_proposal(events, blk_1r, alice_acc.get_keys(), m_cpd, 0, 0, 0, blk_1r.timestamp + 36000, 0, TX_DEFAULT_FEE, m_bob_fee_release, eccf_normal, escrow_proposal_tx, used_sources, &prop);
r = build_custom_escrow_proposal(events, blk_1r, alice_acc.get_keys(), m_cpd, 0, 0, 0, blk_1r.timestamp + 36000, 0, TESTS_DEFAULT_FEE, m_bob_fee_release, eccf_normal, 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);
@ -1939,7 +1939,7 @@ bool escrow_incorrect_cancel_proposal::generate(std::vector<test_event_entry>& e
// create normal escrow proposal acceptance
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, TX_DEFAULT_FEE, m_bob_fee_release, normal_acceptance_mask, prop.tx_onetime_secret_key, escrow_normal_acceptance_tx, used_sources);
r = build_custom_escrow_accept_proposal(events, blk_2, 0, bob_acc.get_keys(), m_cpd, 0, 0, 0, 0, TESTS_DEFAULT_FEE, m_bob_fee_release, normal_acceptance_mask, prop.tx_onetime_secret_key, 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);
@ -1947,7 +1947,7 @@ bool escrow_incorrect_cancel_proposal::generate(std::vector<test_event_entry>& e
// create normal cancel proposal
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, TX_DEFAULT_FEE, eccf_normal, prop.tx_template, escrow_normal_cancel_proposal_tx, used_sources);
r = build_custom_escrow_cancel_proposal(events, blk_3, 0, alice_acc.get_keys(), m_cpd, 0, 0, 0, blk_3.timestamp + 3600, TESTS_DEFAULT_FEE, eccf_normal, prop.tx_template, 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);
@ -2016,7 +2016,7 @@ bool escrow_incorrect_cancel_proposal::generate(std::vector<test_event_entry>& e
transaction incorrect_cancellation_proposal_tx = prop.tx_template;
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,
TX_DEFAULT_FEE, mask, prop.tx_template, incorrect_cancellation_proposal_tx, used_sources);
TESTS_DEFAULT_FEE, mask, prop.tx_template, 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
@ -2067,13 +2067,13 @@ bool escrow_incorrect_cancel_proposal::check_normal_cancel_proposal(currency::co
alice_wlt->dump_trunsfers(ss, false);
LOG_PRINT_L0("check_normal_cancel_proposal:" << ENDL << "Alice transfers: " << ENDL << ss.str());
uint64_t alice_balance = alice_wlt->balance();
uint64_t alice_balance_expected = m_alice_bob_start_amount - m_cpd.amount_a_pledge - m_cpd.amount_to_pay - TX_DEFAULT_FEE - TX_DEFAULT_FEE; // one fee for escrow request, second - for cancel request
uint64_t alice_balance_expected = m_alice_bob_start_amount - m_cpd.amount_a_pledge - m_cpd.amount_to_pay - TESTS_DEFAULT_FEE - TESTS_DEFAULT_FEE; // one fee for escrow request, second - for cancel request
CHECK_AND_ASSERT_MES(alice_balance == alice_balance_expected, false, "Alice has incorrect balance: " << alice_balance << ", expected: " << alice_balance_expected);
std::shared_ptr<tools::wallet2> bob_wlt = init_playtime_test_wallet(events, c, BOB_ACC_IDX);
bob_wlt->refresh();
uint64_t bob_balance = bob_wlt->balance();
uint64_t bob_balance_expected = m_alice_bob_start_amount - m_cpd.amount_b_pledge - m_bob_fee_release - TX_DEFAULT_FEE;
uint64_t bob_balance_expected = m_alice_bob_start_amount - m_cpd.amount_b_pledge - m_bob_fee_release - TESTS_DEFAULT_FEE;
CHECK_AND_ASSERT_MES(bob_balance == bob_balance_expected, false, "Bob has incorrect balance: " << bob_balance << ", expected: " << bob_balance_expected);
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
@ -2110,7 +2110,7 @@ bool escrow_incorrect_cancel_proposal::check_normal_cancel_proposal(currency::co
CHECK_AND_ASSERT_MES(contracts.begin()->second.state == contract_expected_state, false, "Alice has invalid contract state: " << contracts.begin()->second.state << " expected: " << contract_expected_state);
uint64_t alice_balance_end = alice_wlt->balance();
alice_balance_expected = m_alice_bob_start_amount - 2 * TX_DEFAULT_FEE;
alice_balance_expected = m_alice_bob_start_amount - 2 * TESTS_DEFAULT_FEE;
CHECK_AND_ASSERT_MES(alice_balance_end == alice_balance_expected, false, "Alice has incorrect balance: " << alice_balance_end << ", expected: " << alice_balance_expected);
bob_wlt->refresh();
@ -2122,7 +2122,7 @@ bool escrow_incorrect_cancel_proposal::check_normal_cancel_proposal(currency::co
CHECK_AND_ASSERT_MES(contracts.begin()->second.state == contract_expected_state, false, "Bob has invalid contract state: " << contracts.begin()->second.state << " expected: " << contract_expected_state);
uint64_t bob_balance_end = bob_wlt->balance();
bob_balance_expected = m_alice_bob_start_amount - m_bob_fee_release - TX_DEFAULT_FEE;
bob_balance_expected = m_alice_bob_start_amount - m_bob_fee_release - TESTS_DEFAULT_FEE;
CHECK_AND_ASSERT_MES(bob_balance_end == bob_balance_expected, false, "Bob has incorrect balance: " << bob_balance_end << ", expected: " << bob_balance_expected);
return true;
@ -2155,13 +2155,13 @@ bool escrow_incorrect_cancel_proposal::check_incorrect_cancel_proposal_internal(
alice_wlt->dump_trunsfers(ss, false);
LOG_PRINT_L0("Alice transfers: " << ENDL << ss.str());
uint64_t alice_balance = alice_wlt->balance();
uint64_t alice_balance_expected = m_alice_bob_start_amount - m_cpd.amount_a_pledge - m_cpd.amount_to_pay - TX_DEFAULT_FEE - TX_DEFAULT_FEE; // one fee for escrow request, second - for cancel request
uint64_t alice_balance_expected = m_alice_bob_start_amount - m_cpd.amount_a_pledge - m_cpd.amount_to_pay - TESTS_DEFAULT_FEE - TESTS_DEFAULT_FEE; // one fee for escrow request, second - for cancel request
CHECK_AND_ASSERT_MES(alice_balance == alice_balance_expected, false, "Alice has incorrect balance: " << alice_balance << ", expected: " << alice_balance_expected);
std::shared_ptr<tools::wallet2> bob_wlt = init_playtime_test_wallet(events, c, BOB_ACC_IDX);
bob_wlt->refresh();
uint64_t bob_balance = bob_wlt->balance();
uint64_t bob_balance_expected = m_alice_bob_start_amount - m_cpd.amount_b_pledge - m_bob_fee_release - TX_DEFAULT_FEE;
uint64_t bob_balance_expected = m_alice_bob_start_amount - m_cpd.amount_b_pledge - m_bob_fee_release - TESTS_DEFAULT_FEE;
CHECK_AND_ASSERT_MES(bob_balance == bob_balance_expected, false, "Bob has incorrect balance: " << bob_balance << ", expected: " << bob_balance_expected);
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
@ -2257,7 +2257,7 @@ bool escrow_proposal_not_enough_money::c1(currency::core& c, size_t ev_index, co
try
{
uint64_t expiration_time = test_core_time::get_time() + 10; // ten seconds
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_time, TX_DEFAULT_FEE, COIN * 10000000, "", proposal_tx, escrow_template_tx); // use too big b_release_fee just to make sure it does not affects anything on that stage
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_time, TESTS_DEFAULT_FEE, COIN * 10000000, "", proposal_tx, escrow_template_tx); // use too big b_release_fee just to make sure it does not affects anything on that stage
}
catch(std::exception& e)
{
@ -2304,12 +2304,12 @@ bool escrow_cancellation_and_tx_order::generate(std::vector<test_event_entry>& e
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
transaction tx_0 = AUTO_VAL_INIT(tx_0);
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TX_DEFAULT_FEE, tx_0);
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_0);
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
events.push_back(tx_0);
transaction tx_1 = AUTO_VAL_INIT(tx_1);
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TX_DEFAULT_FEE, tx_1);
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_1);
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
events.push_back(tx_1);
@ -2347,7 +2347,7 @@ bool escrow_cancellation_and_tx_order::c1(currency::core& c, size_t ev_index, co
transaction escrow_template_tx = AUTO_VAL_INIT(escrow_template_tx);
uint64_t expiration_time = test_core_time::get_time() + 60;
LOG_PRINT_GREEN("\n" "alice_wlt->send_escrow_proposal()", LOG_LEVEL_0);
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_time, TX_DEFAULT_FEE, TX_DEFAULT_FEE, "", proposal_tx, escrow_template_tx);
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_time, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, "", proposal_tx, escrow_template_tx);
tools::wallet2::escrow_contracts_container contracts;
r = alice_wlt->get_contracts(contracts);
@ -2373,7 +2373,7 @@ bool escrow_cancellation_and_tx_order::c1(currency::core& c, size_t ev_index, co
// Bob accepts the proposal
LOG_PRINT_GREEN("\n" "bob_wlt->accept_proposal()", LOG_LEVEL_0);
bob_wlt->accept_proposal(contract_id, TX_DEFAULT_FEE);
bob_wlt->accept_proposal(contract_id, TESTS_DEFAULT_FEE);
// mine a block containing contract acceptance
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool: " << c.get_pool_transactions_count());
@ -2391,7 +2391,7 @@ bool escrow_cancellation_and_tx_order::c1(currency::core& c, size_t ev_index, co
// Alice requests cancellation
LOG_PRINT_GREEN("\n" "alice_wlt->request_cancel_contract()", LOG_LEVEL_0);
alice_wlt->request_cancel_contract(contract_id, TX_DEFAULT_FEE, 60 * 60);
alice_wlt->request_cancel_contract(contract_id, TESTS_DEFAULT_FEE, 60 * 60);
// cancel request must be in the pool now
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool: " << c.get_pool_transactions_count());
@ -2504,12 +2504,12 @@ bool escrow_cancellation_proposal_expiration::generate(std::vector<test_event_en
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
transaction tx_0 = AUTO_VAL_INIT(tx_0);
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TX_DEFAULT_FEE, tx_0);
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_0);
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
events.push_back(tx_0);
transaction tx_1 = AUTO_VAL_INIT(tx_1);
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TX_DEFAULT_FEE, tx_1);
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_1);
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
events.push_back(tx_1);
@ -2542,13 +2542,13 @@ bool escrow_cancellation_proposal_expiration::c1(currency::core& c, size_t ev_in
cpd.amount_to_pay = MK_TEST_COINS(8);
cpd.a_addr = m_accounts[ALICE_ACC_IDX].get_public_address();
cpd.b_addr = m_accounts[BOB_ACC_IDX].get_public_address();
uint64_t b_release_fee = TX_DEFAULT_FEE * 2;
uint64_t b_release_fee = TESTS_DEFAULT_FEE * 2;
transaction proposal_tx = AUTO_VAL_INIT(proposal_tx);
transaction escrow_template_tx = AUTO_VAL_INIT(escrow_template_tx);
uint64_t expiration_time = test_core_time::get_time() + 60;
LOG_PRINT_GREEN("\n" "alice_wlt->send_escrow_proposal()", LOG_LEVEL_0);
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_time, TX_DEFAULT_FEE, b_release_fee, "", proposal_tx, escrow_template_tx);
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_time, TESTS_DEFAULT_FEE, b_release_fee, "", proposal_tx, escrow_template_tx);
tools::wallet2::escrow_contracts_container contracts;
r = alice_wlt->get_contracts(contracts);
@ -2577,7 +2577,7 @@ bool escrow_cancellation_proposal_expiration::c1(currency::core& c, size_t ev_in
// Bob accepts the proposal
LOG_PRINT_GREEN("\n" "bob_wlt->accept_proposal()", LOG_LEVEL_0);
bob_wlt->accept_proposal(contract_id, TX_DEFAULT_FEE);
bob_wlt->accept_proposal(contract_id, TESTS_DEFAULT_FEE);
uint64_t bob_blocked_transfers_sum = 0;
CHECK_AND_ASSERT_MES(estimate_wallet_balance_blocked_for_escrow(*bob_wlt.get(), bob_blocked_transfers_sum, false), false, "");
@ -2600,7 +2600,7 @@ bool escrow_cancellation_proposal_expiration::c1(currency::core& c, size_t ev_in
// Alice requests cancellation for the first time -- this request will not be included into a block and will expire in tx pool
uint64_t cancel_request_expiration_period = 3; // seconds
LOG_PRINT_GREEN("\n" "alice_wlt->request_cancel_contract()", LOG_LEVEL_0);
alice_wlt->request_cancel_contract(contract_id, TX_DEFAULT_FEE, cancel_request_expiration_period);
alice_wlt->request_cancel_contract(contract_id, TESTS_DEFAULT_FEE, cancel_request_expiration_period);
uint64_t cancel_request_time = test_core_time::get_time(); // remember current time in order to check expiration
LOG_PRINT_YELLOW(">>>>>>>>>>>>>>>>>>>>>> (1/2) cancel_request_time = " << cancel_request_time << " + period = " << cancel_request_expiration_period + cancel_request_time, LOG_LEVEL_0);
@ -2659,15 +2659,15 @@ bool escrow_cancellation_proposal_expiration::c1(currency::core& c, size_t ev_in
CHECK_AND_ASSERT_MES(refresh_wallet_and_check_1_contract_state("Bob", bob_wlt, tools::wallet_rpc::escrow_contract_details::contract_accepted, 1), false, "");
// check balances
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TX_DEFAULT_FEE - cpd.amount_a_pledge - cpd.amount_to_pay - TX_DEFAULT_FEE), false, "");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_start_balance - TX_DEFAULT_FEE - b_release_fee - cpd.amount_b_pledge), false, "");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TESTS_DEFAULT_FEE - cpd.amount_a_pledge - cpd.amount_to_pay - TESTS_DEFAULT_FEE), false, "");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_start_balance - TESTS_DEFAULT_FEE - b_release_fee - cpd.amount_b_pledge), false, "");
// ===== (2/2) =====
// Alice requests cancellation for the second time -- this request will be included into a block and then will expire
cancel_request_expiration_period = 3 * DIFFICULTY_POW_TARGET + 15;
LOG_PRINT_GREEN("\n" "alice_wlt->request_cancel_contract()", LOG_LEVEL_0);
alice_wlt->request_cancel_contract(contract_id, TX_DEFAULT_FEE, cancel_request_expiration_period);
alice_wlt->request_cancel_contract(contract_id, TESTS_DEFAULT_FEE, cancel_request_expiration_period);
cancel_request_time = test_core_time::get_time(); // remember current time in order to check expiration
LOG_PRINT_YELLOW(">>>>>>>>>>>>>>>>>>>>>> (2/2) cancel_request_time = " << cancel_request_time << " + period = " << cancel_request_expiration_period + cancel_request_time, LOG_LEVEL_0);
@ -2721,8 +2721,8 @@ bool escrow_cancellation_proposal_expiration::c1(currency::core& c, size_t ev_in
CHECK_AND_ASSERT_MES(refresh_wallet_and_check_1_contract_state("Bob", bob_wlt, tools::wallet_rpc::escrow_contract_details::contract_accepted, 7), false, "");
// check balances
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TX_DEFAULT_FEE - cpd.amount_a_pledge - cpd.amount_to_pay - TX_DEFAULT_FEE - TX_DEFAULT_FEE), false, "");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_start_balance - TX_DEFAULT_FEE - b_release_fee - cpd.amount_b_pledge), false, "");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TESTS_DEFAULT_FEE - cpd.amount_a_pledge - cpd.amount_to_pay - TESTS_DEFAULT_FEE - TESTS_DEFAULT_FEE), false, "");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_start_balance - TESTS_DEFAULT_FEE - b_release_fee - cpd.amount_b_pledge), false, "");
return true;
}
@ -2751,12 +2751,12 @@ bool escrow_cancellation_acceptance_expiration::generate(std::vector<test_event_
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
transaction tx_0 = AUTO_VAL_INIT(tx_0);
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(100), 20, TX_DEFAULT_FEE, tx_0);
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(100), 20, TESTS_DEFAULT_FEE, tx_0);
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
events.push_back(tx_0);
transaction tx_1 = AUTO_VAL_INIT(tx_1);
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(100), 20, TX_DEFAULT_FEE, tx_1);
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(100), 20, TESTS_DEFAULT_FEE, tx_1);
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
events.push_back(tx_1);
@ -2789,7 +2789,7 @@ bool escrow_cancellation_acceptance_expiration::c1(currency::core& c, size_t ev_
cpd.amount_to_pay = MK_TEST_COINS(3);
cpd.a_addr = m_accounts[ALICE_ACC_IDX].get_public_address();
cpd.b_addr = m_accounts[BOB_ACC_IDX].get_public_address();
uint64_t b_release_fee = TX_DEFAULT_FEE * 2;
uint64_t b_release_fee = TESTS_DEFAULT_FEE * 2;
transaction proposal_tx = AUTO_VAL_INIT(proposal_tx);
transaction escrow_template_tx = AUTO_VAL_INIT(escrow_template_tx);
@ -2818,7 +2818,7 @@ bool escrow_cancellation_acceptance_expiration::c1(currency::core& c, size_t ev_
// Bob accepts the proposal
LOG_PRINT_GREEN("\n" "bob_wlt->accept_proposal()", LOG_LEVEL_0);
bob_wlt->accept_proposal(contract_id, TX_DEFAULT_FEE);
bob_wlt->accept_proposal(contract_id, TESTS_DEFAULT_FEE);
//uint64_t bob_blocked_transfers_sum = 0;
//CHECK_AND_ASSERT_MES(estimate_wallet_balance_blocked_for_escrow(*bob_wlt.get(), bob_blocked_transfers_sum, false), false, "");
@ -2834,7 +2834,7 @@ bool escrow_cancellation_acceptance_expiration::c1(currency::core& c, size_t ev_
// Alice requests cancellation
uint64_t cancel_request_expiration_period = DIFFICULTY_TOTAL_TARGET;
LOG_PRINT_GREEN("\n" "alice_wlt->request_cancel_contract()", LOG_LEVEL_0);
alice_wlt->request_cancel_contract(contract_id, TX_DEFAULT_FEE, cancel_request_expiration_period);
alice_wlt->request_cancel_contract(contract_id, TESTS_DEFAULT_FEE, cancel_request_expiration_period);
// confirm cancellation request in blockchain
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool: " << c.get_pool_transactions_count());
@ -2875,8 +2875,8 @@ bool escrow_cancellation_acceptance_expiration::c1(currency::core& c, size_t ev_
CHECK_AND_ASSERT_MES(refresh_wallet_and_check_1_contract_state("Bob", bob_wlt, tools::wallet_rpc::escrow_contract_details::contract_accepted, 7), false, "");
// check final balances
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TX_DEFAULT_FEE - cpd.amount_a_pledge - cpd.amount_to_pay - TX_DEFAULT_FEE), false, "");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_start_balance - TX_DEFAULT_FEE - b_release_fee - cpd.amount_b_pledge), false, "");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TESTS_DEFAULT_FEE - cpd.amount_a_pledge - cpd.amount_to_pay - TESTS_DEFAULT_FEE), false, "");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_start_balance - TESTS_DEFAULT_FEE - b_release_fee - cpd.amount_b_pledge), false, "");
@ -2894,8 +2894,8 @@ bool escrow_cancellation_acceptance_expiration::c1(currency::core& c, size_t ev_
CHECK_AND_ASSERT_MES(refresh_wallet_and_check_1_contract_state("Bob", bob_wlt, tools::wallet_rpc::escrow_contract_details::contract_accepted, 0), false, "");
// no changes with balances expected
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TX_DEFAULT_FEE - cpd.amount_a_pledge - cpd.amount_to_pay - TX_DEFAULT_FEE), false, "");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_start_balance - TX_DEFAULT_FEE - b_release_fee - cpd.amount_b_pledge), false, "");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", alice_start_balance - TESTS_DEFAULT_FEE - cpd.amount_a_pledge - cpd.amount_to_pay - TESTS_DEFAULT_FEE), false, "");
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_start_balance - TESTS_DEFAULT_FEE - b_release_fee - cpd.amount_b_pledge), false, "");
return true;
}
@ -2931,19 +2931,19 @@ bool escrow_proposal_acceptance_in_alt_chain::generate(std::vector<test_event_en
// prepare contract details
bc_services::contract_private_details cpd = AUTO_VAL_INIT(cpd);
cpd.amount_a_pledge = TX_DEFAULT_FEE * 12;
cpd.amount_b_pledge = TX_DEFAULT_FEE * 13;
cpd.amount_to_pay = TX_DEFAULT_FEE * 3;
cpd.amount_a_pledge = TESTS_DEFAULT_FEE * 12;
cpd.amount_b_pledge = TESTS_DEFAULT_FEE * 13;
cpd.amount_to_pay = TESTS_DEFAULT_FEE * 3;
cpd.a_addr = alice_acc.get_public_address();
cpd.b_addr = bob_acc.get_public_address();
uint64_t bob_fee_release = 10 * TX_DEFAULT_FEE; // Alice states that Bob should pay this much money for upcoming contract release (which will be sent by Alice)
uint64_t bob_fee_release = 10 * TESTS_DEFAULT_FEE; // Alice states that Bob should pay this much money for upcoming contract release (which will be sent by Alice)
std::vector<tx_source_entry> used_sources;
// escrow proposal
bc_services::proposal_body prop = AUTO_VAL_INIT(prop);
transaction escrow_proposal_tx = AUTO_VAL_INIT(escrow_proposal_tx);
r = build_custom_escrow_proposal(events, blk_1, alice_acc.get_keys(), cpd, 0, 0, 0, blk_1.timestamp + 36000, 0, TX_DEFAULT_FEE, bob_fee_release, eccf_normal, escrow_proposal_tx, used_sources, &prop);
r = build_custom_escrow_proposal(events, blk_1, alice_acc.get_keys(), cpd, 0, 0, 0, blk_1.timestamp + 36000, 0, TESTS_DEFAULT_FEE, bob_fee_release, eccf_normal, 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);
@ -2953,7 +2953,7 @@ bool escrow_proposal_acceptance_in_alt_chain::generate(std::vector<test_event_en
// escrow proposal acceptance
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, TX_DEFAULT_FEE, bob_fee_release, normal_acceptance_mask, prop.tx_onetime_secret_key, escrow_normal_acceptance_tx, used_sources);
r = build_custom_escrow_accept_proposal(events, blk_2, 0, bob_acc.get_keys(), cpd, 0, 0, 0, 0, TESTS_DEFAULT_FEE, bob_fee_release, normal_acceptance_mask, prop.tx_onetime_secret_key, 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);

View file

@ -41,7 +41,7 @@ bool get_random_outs_test::generate(std::vector<test_event_entry>& events) const
MAKE_NEXT_BLOCK_TX_LIST(events, blk_4, blk_3r, miner_account, txs_blk_4); // 2N+10
MAKE_TX_LIST_START(events, txs_blk_5, bob_account, miner_account, m_amount - TX_DEFAULT_FEE, blk_4); // 2N+11
MAKE_TX_LIST_START(events, txs_blk_5, bob_account, miner_account, m_amount - TESTS_DEFAULT_FEE, blk_4); // 2N+11
MAKE_NEXT_BLOCK_TX_LIST(events, blk_5, blk_4, miner_account, txs_blk_5); // 2N+12
REWIND_BLOCKS_N_WITH_TIME(events, blk_5r, blk_5, miner_account, CURRENCY_MINED_MONEY_UNLOCK_WINDOW); // 4N+12
DO_CALLBACK(events, "check_get_rand_outs"); // 4N+13

View file

@ -226,7 +226,7 @@ bool mix_in_spent_outs::generate(std::vector<test_event_entry>& events) const
DO_CALLBACK_PARAMS_STR(events, "check_outs_count", epee::serialization::store_t_to_json(check_outs_count_params(m_test_amount, 4)));
// spend 2 of 3 Alice's outputs with direct transfer (not mixins)
MAKE_TX(events, tx_1, alice_acc, miner_acc, m_test_amount * 2 - TX_DEFAULT_FEE, blk_2); // mix_attr == 0
MAKE_TX(events, tx_1, alice_acc, miner_acc, m_test_amount * 2 - TESTS_DEFAULT_FEE, blk_2); // mix_attr == 0
MAKE_NEXT_BLOCK_TX1(events, blk_3, blk_2, miner_acc, tx_1);
// despite the fact all Alice's outputs are spent now, total number of outputs with such amount should not changed
@ -262,7 +262,7 @@ bool mix_in_spent_outs::c1(currency::core& c, size_t ev_index, const std::vector
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "There are txs in the pool");
std::vector<tx_destination_entry> destinations({ tx_destination_entry(m_test_amount - TX_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address()) });
std::vector<tx_destination_entry> destinations({ tx_destination_entry(m_test_amount - TESTS_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address()) });
// check that mixing in 3 or 2 fake outputs fails because of using already spend outputs
for(size_t fake_outputs_to_mixin = 2; fake_outputs_to_mixin >= 2; fake_outputs_to_mixin--)
@ -270,7 +270,7 @@ bool mix_in_spent_outs::c1(currency::core& c, size_t ev_index, const std::vector
r = false;
try
{
bob_wlt->transfer(destinations, fake_outputs_to_mixin, 0, TX_DEFAULT_FEE, empty_extra, empty_attachment);
bob_wlt->transfer(destinations, fake_outputs_to_mixin, 0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment);
}
catch (tools::error::not_enough_outs_to_mix& e)
{
@ -282,7 +282,7 @@ bool mix_in_spent_outs::c1(currency::core& c, size_t ev_index, const std::vector
}
transaction tx = AUTO_VAL_INIT(tx);
bob_wlt->transfer(destinations, 1, 0, TX_DEFAULT_FEE, empty_extra, empty_attachment, tx); // mixing in 1 fake output should be okay as Alice did not spend it
bob_wlt->transfer(destinations, 1, 0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment, tx); // mixing in 1 fake output should be okay as Alice did not spend it
CHECK_AND_ASSERT_MES(tx.vin.size() == 1, false, "tx vin.size() is not 1");
CHECK_AND_ASSERT_MES(tx.vin[0].type() == typeid(txin_to_key) && boost::get<txin_to_key>(tx.vin[0]).key_offsets.size() == 2, false, "Incorrect vin[0] type of key_offsets"); // make sure 1 fake output was used

View file

@ -155,10 +155,10 @@ bool multisig_wallet_test::c1(currency::core& c, size_t ev_index, const std::vec
//multisig
dst.back().addr.push_back(m_accunt_a.get_public_address());
dst.back().addr.push_back(m_accunt_b.get_public_address());
dst.back().amount = AMOUNT_TO_TRANSFER_MULTISIG + TX_DEFAULT_FEE;
dst.back().amount = AMOUNT_TO_TRANSFER_MULTISIG + TESTS_DEFAULT_FEE;
dst.back().minimum_sigs = dst.back().addr.size();
transaction result_tx = AUTO_VAL_INIT(result_tx);
miner_wlt->transfer(dst, 0, 0, TX_DEFAULT_FEE, extra, attachments, tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), result_tx);
miner_wlt->transfer(dst, 0, 0, TESTS_DEFAULT_FEE, extra, attachments, tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), result_tx);
bool r = mine_next_pow_blocks_in_playtime(m_mining_accunt.get_public_address(), c, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
CHECK_AND_ASSERT_MES(r, false, "mine_next_pow_blocks_in_playtime failed");
@ -201,7 +201,7 @@ bool multisig_wallet_test::c1(currency::core& c, size_t ev_index, const std::vec
multisig_id,
dst2,
0,
TX_DEFAULT_FEE,
TESTS_DEFAULT_FEE,
extra,
attachments,
tools::detail::digit_split_strategy,
@ -377,46 +377,46 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
CHECK_AND_ASSERT_MES(blocks_fetched == CURRENCY_MINED_MONEY_UNLOCK_WINDOW, false, "Incorrect numbers of blocks fetched");
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
uint64_t amount1 = TX_DEFAULT_FEE * 13 + 1;
uint64_t amount2 = TX_DEFAULT_FEE * 11 + 2;
uint64_t amount3 = TX_DEFAULT_FEE * 7 + 3;
uint64_t amount4 = TX_DEFAULT_FEE * 5 + 4;
uint64_t amount5 = TX_DEFAULT_FEE * 21;
uint64_t amount6 = TX_DEFAULT_FEE * 23;
uint64_t amount1 = TESTS_DEFAULT_FEE * 13 + 1;
uint64_t amount2 = TESTS_DEFAULT_FEE * 11 + 2;
uint64_t amount3 = TESTS_DEFAULT_FEE * 7 + 3;
uint64_t amount4 = TESTS_DEFAULT_FEE * 5 + 4;
uint64_t amount5 = TESTS_DEFAULT_FEE * 21;
uint64_t amount6 = TESTS_DEFAULT_FEE * 23;
tx_destination_entry de1 = AUTO_VAL_INIT(de1);
de1.addr.push_back(m_accounts[ALICE_ACC_IDX].get_public_address());
de1.addr.push_back(m_accounts[BOB_ACC_IDX].get_public_address());
de1.amount = amount1 + TX_DEFAULT_FEE;
de1.amount = amount1 + TESTS_DEFAULT_FEE;
de1.minimum_sigs = de1.addr.size();
tx_destination_entry de2 = AUTO_VAL_INIT(de2);
de2.addr.push_back(m_accounts[CAROL_ACC_IDX].get_public_address());
de2.addr.push_back(m_accounts[DAN_ACC_IDX].get_public_address());
de2.amount = amount2 + TX_DEFAULT_FEE;
de2.amount = amount2 + TESTS_DEFAULT_FEE;
de2.minimum_sigs = de2.addr.size();
tx_destination_entry de3 = AUTO_VAL_INIT(de3);
de3.addr.push_back(m_accounts[ALICE_ACC_IDX].get_public_address());
de3.addr.push_back(m_accounts[DAN_ACC_IDX].get_public_address());
de3.amount = amount3 + TX_DEFAULT_FEE;
de3.amount = amount3 + TESTS_DEFAULT_FEE;
de3.minimum_sigs = de3.addr.size();
tx_destination_entry de4 = AUTO_VAL_INIT(de4);
de4.addr.push_back(m_accounts[CAROL_ACC_IDX].get_public_address());
de4.addr.push_back(m_accounts[BOB_ACC_IDX].get_public_address());
de4.amount = amount4 + TX_DEFAULT_FEE;
de4.amount = amount4 + TESTS_DEFAULT_FEE;
de4.minimum_sigs = de4.addr.size();
tx_destination_entry de5 = AUTO_VAL_INIT(de5);
de5.addr.push_back(m_accounts[ALICE_ACC_IDX].get_public_address());
de5.amount = amount5 + TX_DEFAULT_FEE;
de5.amount = amount5 + TESTS_DEFAULT_FEE;
de5.minimum_sigs = de5.addr.size();
tx_destination_entry de6 = AUTO_VAL_INIT(de6);
de6.addr.push_back(m_accounts[DAN_ACC_IDX].get_public_address());
de6.amount = amount6 + TX_DEFAULT_FEE;
de6.amount = amount6 + TESTS_DEFAULT_FEE;
de6.minimum_sigs = de6.addr.size();
// Send multisig tx
transaction ms_tx = AUTO_VAL_INIT(ms_tx);
miner_wlt->transfer(std::vector<tx_destination_entry>({ de1, de2, de3, de4, de5, de6 }),
0, 0, TX_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), ms_tx);
0, 0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), ms_tx);
// calculate multisig hashes for further usage
crypto::hash ms1_hash = currency::get_multisig_out_id(ms_tx, get_tx_out_index_by_amount(ms_tx, de1.amount));
@ -437,7 +437,7 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
std::shared_ptr<tools::wallet2> alice_wlt = init_playtime_test_wallet(events, c, m_accounts[ALICE_ACC_IDX]);
alice_wlt->refresh(blocks_fetched, received_money, atomic_false);
CHECK_AND_ASSERT_MES(blocks_fetched == CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 1, false, "Incorrect numbers of blocks fetched");
r = check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", amount5 + TX_DEFAULT_FEE);
r = check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", amount5 + TESTS_DEFAULT_FEE);
CHECK_AND_ASSERT_MES(r, false, "Invalid wallet balance");
tools::wallet2::multisig_transfer_container alice_mstc;
alice_wlt->get_multisig_transfers(alice_mstc);
@ -467,7 +467,7 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
std::shared_ptr<tools::wallet2> dan_wlt = init_playtime_test_wallet(events, c, m_accounts[DAN_ACC_IDX]);
dan_wlt->refresh(blocks_fetched, received_money, atomic_false);
CHECK_AND_ASSERT_MES(blocks_fetched == CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 1, false, "Incorrect numbers of blocks fetched");
r = check_balance_via_wallet(*dan_wlt.get(), "dan_wlt", amount6 + TX_DEFAULT_FEE);
r = check_balance_via_wallet(*dan_wlt.get(), "dan_wlt", amount6 + TESTS_DEFAULT_FEE);
CHECK_AND_ASSERT_MES(r, false, "Invalid wallet balance");
tools::wallet2::multisig_transfer_container dan_mstc;
dan_wlt->get_multisig_transfers(dan_mstc);
@ -484,7 +484,7 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
currency::transaction tx = AUTO_VAL_INIT(tx);
transfer_multisig(*alice_wlt.get(), std::list<account_keys>({ m_accounts[BOB_ACC_IDX].get_keys() }), ms1_hash, std::vector<tx_destination_entry>({ tx_destination_entry(amount1, receiver_acc.get_public_address()) }),
0, TX_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
@ -499,7 +499,7 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
{
// as 'false' means don't send to network. This should fail during preparation, not during sending/processing
transfer_multisig(*bob_wlt.get(), std::list<account_keys>({ m_accounts[ALICE_ACC_IDX].get_keys() }), ms1_hash, std::vector<tx_destination_entry>({ tx_destination_entry(amount1, receiver_acc.get_public_address()) }),
0, TX_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, 0, 0, true, false);
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, 0, 0, true, false);
}
catch (tools::error::wallet_internal_error&)
{
@ -518,7 +518,7 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
tx = AUTO_VAL_INIT(tx);
transfer_multisig(*carol_wlt.get(), std::list<account_keys>({ m_accounts[DAN_ACC_IDX].get_keys() }), ms2_hash, std::vector<tx_destination_entry>({ tx_destination_entry(amount2, receiver_acc.get_public_address()) }),
0, TX_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
@ -530,7 +530,7 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
{
// as 'false' means don't send to network. This should fail during preparation, not during sending/processing
transfer_multisig(*dan_wlt.get(), std::list<account_keys>({ m_accounts[CAROL_ACC_IDX].get_keys() }), ms2_hash, std::vector<tx_destination_entry>({ tx_destination_entry(amount2, receiver_acc.get_public_address()) }),
0, TX_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, 0, 0, true, false);
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, 0, 0, true, false);
}
catch (tools::error::wallet_internal_error&)
{
@ -546,7 +546,7 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
// Re-try spending Carol-Dan multisig out on behalf of Dan. It should be OK now
transfer_multisig(*dan_wlt.get(), std::list<account_keys>({ m_accounts[CAROL_ACC_IDX].get_keys() }), ms2_hash, std::vector<tx_destination_entry>({ tx_destination_entry(amount2, receiver_acc.get_public_address()) }),
0, TX_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
@ -564,7 +564,7 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
tx = AUTO_VAL_INIT(tx);
transfer_multisig(*alice_wlt.get(), std::list<account_keys>({ m_accounts[DAN_ACC_IDX].get_keys() }), ms3_hash, std::vector<tx_destination_entry>({ tx_destination_entry(amount3, receiver_acc.get_public_address()) }),
0, TX_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
@ -575,7 +575,7 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
{
// last 'false' means don't send to network. This should fail during preparation, not during sending/processing
transfer_multisig(*dan_wlt.get(), std::list<account_keys>({ m_accounts[ALICE_ACC_IDX].get_keys() }), ms3_hash, std::vector<tx_destination_entry>({ tx_destination_entry(amount3, receiver_acc.get_public_address()) }),
0, TX_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, 0, 0, true, false);
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, 0, 0, true, false);
}
catch (tools::error::wallet_internal_error&)
{
@ -605,7 +605,7 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
try
{
transfer_multisig(*dan_wlt.get(), std::list<account_keys>({ m_accounts[ALICE_ACC_IDX].get_keys() }), ms3_hash, std::vector<tx_destination_entry>({ tx_destination_entry(amount3, receiver_acc.get_public_address()) }),
0, TX_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, 0, 0, true, false);
0, TESTS_DEFAULT_FEE, std::vector<currency::extra_v>(), std::vector<currency::attachment_v>(), tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx, 0, 0, true, false);
}
catch (tools::error::wallet_internal_error&)
{
@ -671,7 +671,7 @@ bool multisig_wallet_same_dst_addr::c1(currency::core& c, size_t ev_index, const
size_t blocks_fetched = 0;
bool received_money = false, r = false;
std::atomic<bool> atomic_false(false);
static const uint64_t amount = TX_DEFAULT_FEE * 13;
static const uint64_t amount = TESTS_DEFAULT_FEE * 13;
std::shared_ptr<tools::wallet2> miner_wlt = init_playtime_test_wallet(events, c, m_accounts[MINER_ACC_IDX]);
miner_wlt->refresh(blocks_fetched, received_money, atomic_false);
@ -680,12 +680,12 @@ bool multisig_wallet_same_dst_addr::c1(currency::core& c, size_t ev_index, const
tx_destination_entry de = AUTO_VAL_INIT(de);
de.addr.push_back(m_accounts[ALICE_ACC_IDX].get_public_address());
de.addr.push_back(m_accounts[ALICE_ACC_IDX].get_public_address()); // multisig to the same address
de.amount = amount + TX_DEFAULT_FEE;
de.amount = amount + TESTS_DEFAULT_FEE;
de.minimum_sigs = de.addr.size();
// transfer multisig to Alice
transaction ms_tx = AUTO_VAL_INIT(ms_tx);
miner_wlt->transfer(std::vector<tx_destination_entry>({ de }), 0, 0, TX_DEFAULT_FEE, empty_extra, empty_attachment, ms_tx);
miner_wlt->transfer(std::vector<tx_destination_entry>({ de }), 0, 0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment, ms_tx);
// mine the next PoW and make sure everythig is allright
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect number of tx in the pool");
@ -704,7 +704,7 @@ bool multisig_wallet_same_dst_addr::c1(currency::core& c, size_t ev_index, const
transaction tx = AUTO_VAL_INIT(tx);
transfer_multisig(*alice_wlt.get(), std::list<account_keys>({ m_accounts[ALICE_ACC_IDX].get_keys() }), ms_hash,
std::vector<tx_destination_entry>({ tx_destination_entry(amount, m_accounts[BOB_ACC_IDX].get_public_address()) }),
0, TX_DEFAULT_FEE, empty_extra, empty_attachment, tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment, tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect number of tx in the pool");
r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
@ -760,7 +760,7 @@ bool multisig_wallet_ms_to_ms::c1(currency::core& c, size_t ev_index, const std:
size_t blocks_fetched = 0;
bool received_money = false, r = false;
std::atomic<bool> atomic_false(false);
static const uint64_t amount = TX_DEFAULT_FEE * 13;
static const uint64_t amount = TESTS_DEFAULT_FEE * 13;
std::shared_ptr<tools::wallet2> miner_wlt = init_playtime_test_wallet(events, c, m_accounts[MINER_ACC_IDX]);
miner_wlt->refresh(blocks_fetched, received_money, atomic_false);
@ -769,12 +769,12 @@ bool multisig_wallet_ms_to_ms::c1(currency::core& c, size_t ev_index, const std:
tx_destination_entry de = AUTO_VAL_INIT(de);
de.addr.push_back(m_accounts[ALICE_ACC_IDX].get_public_address());
de.addr.push_back(m_accounts[BOB_ACC_IDX].get_public_address());
de.amount = amount + TX_DEFAULT_FEE;
de.amount = amount + TESTS_DEFAULT_FEE;
de.minimum_sigs = de.addr.size();
// transfer multisig to Alice + Bob
transaction ms_tx = AUTO_VAL_INIT(ms_tx);
miner_wlt->transfer(std::vector<tx_destination_entry>({ de }), 0, 0, TX_DEFAULT_FEE, empty_extra, empty_attachment, ms_tx);
miner_wlt->transfer(std::vector<tx_destination_entry>({ de }), 0, 0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment, ms_tx);
// mine the next PoW and make sure everythig is allright
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect number of tx in the pool");
@ -798,7 +798,7 @@ bool multisig_wallet_ms_to_ms::c1(currency::core& c, size_t ev_index, const std:
transaction ms_tx2 = AUTO_VAL_INIT(ms_tx2);
transfer_multisig(*alice_wlt.get(), std::list<account_keys>({ m_accounts[BOB_ACC_IDX].get_keys() }), ms_hash,
std::vector<tx_destination_entry>({ de }),
0, TX_DEFAULT_FEE, empty_extra, empty_attachment, tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), ms_tx2);
0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment, tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), ms_tx2);
// check the pool and mine a block
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect number of tx in the pool");
@ -814,8 +814,8 @@ bool multisig_wallet_ms_to_ms::c1(currency::core& c, size_t ev_index, const std:
// spend the last multisig(Miner, Bob) and transfer to Bob
transaction tx = AUTO_VAL_INIT(tx);
transfer_multisig(*miner_wlt.get(), std::list<account_keys>({ m_accounts[BOB_ACC_IDX].get_keys() }), ms_hash2,
std::vector<tx_destination_entry>({ tx_destination_entry(amount - TX_DEFAULT_FEE, m_accounts[BOB_ACC_IDX].get_public_address()) }),
0, TX_DEFAULT_FEE, empty_extra, empty_attachment, tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
std::vector<tx_destination_entry>({ tx_destination_entry(amount - TESTS_DEFAULT_FEE, m_accounts[BOB_ACC_IDX].get_public_address()) }),
0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment, tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), tx);
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect number of tx in the pool");
r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
@ -827,7 +827,7 @@ bool multisig_wallet_ms_to_ms::c1(currency::core& c, size_t ev_index, const std:
bob_wlt->refresh(blocks_fetched, received_money, atomic_false);
CHECK_AND_ASSERT_MES(blocks_fetched == CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 3, false, "Incorrect number of blocks fetched.");
r = check_balance_via_wallet(*bob_wlt.get(), "bob_wlt", amount - TX_DEFAULT_FEE);
r = check_balance_via_wallet(*bob_wlt.get(), "bob_wlt", amount - TESTS_DEFAULT_FEE);
CHECK_AND_ASSERT_MES(r, false, "check_balance_via_wallet failed");
return true;
@ -863,14 +863,14 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
bool r = false;
uint64_t amount = TX_DEFAULT_FEE * 17;
uint64_t amount = TESTS_DEFAULT_FEE * 17;
std::list<account_public_address> ms_addr_list({ miner_acc.get_public_address(), alice_acc.get_public_address(), bob_acc.get_public_address() });
// Case 1. Create multisig for three participants (Miner, Alice, Bob) and specify minimum_sigs == 4 (should fail on construction)
std::vector<tx_source_entry> sources;
std::vector<tx_destination_entry> destinations;
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 4);
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 4);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction tx = AUTO_VAL_INIT(tx);
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx, 0);
@ -882,7 +882,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
// 2.2. Spend using 2 keys (Alice, Bob) by sending money to Bob
sources.clear();
destinations.clear();
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 2);
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, 2);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction tx_1 = AUTO_VAL_INIT(tx_1);
@ -906,7 +906,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
se.ms_keys_count = boost::get<txout_multisig>(tx_1.vout[se.real_output_in_tx_index].target).keys.size();
se.ms_sigs_count = 2;
tx_destination_entry de(se.amount - TX_DEFAULT_FEE, bob_acc.get_public_address());
tx_destination_entry de(se.amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address());
// Transaction should be successfully created, but rejected by the core
transaction tx_2 = AUTO_VAL_INIT(tx_2);
@ -940,7 +940,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 - TX_DEFAULT_FEE, bob_acc.get_public_address()) }), empty_attachment, tx_3, 0);
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address()) }), empty_attachment, tx_3, 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);
@ -955,7 +955,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
// create source tx: tx_4
sources.clear();
destinations.clear();
r = fill_tx_sources_and_destinations(events, blk_2, miner_acc.get_keys(), ms_addr_list, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
r = fill_tx_sources_and_destinations(events, blk_2, miner_acc.get_keys(), ms_addr_list, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction tx_4 = AUTO_VAL_INIT(tx_4);
@ -977,7 +977,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 - TX_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_5, 0);
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_5, 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)
@ -998,7 +998,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
// Case 5. Spending multisig output using more keys than required and, moreover, add some fake keys
sources.clear();
destinations.clear();
r = fill_tx_sources_and_destinations(events, blk_4, miner_acc.get_keys(), ms_addr_list, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
r = fill_tx_sources_and_destinations(events, blk_4, miner_acc.get_keys(), ms_addr_list, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction tx_6 = AUTO_VAL_INIT(tx_6);
@ -1021,7 +1021,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 - TX_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_7, 0);
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_7, 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)
@ -1040,7 +1040,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
// Case 6. Spending multisig using too many redundant keys
sources.clear();
destinations.clear();
r = fill_tx_sources_and_destinations(events, blk_5, miner_acc.get_keys(), ms_addr_list, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
r = fill_tx_sources_and_destinations(events, blk_5, miner_acc.get_keys(), ms_addr_list, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction tx_8 = AUTO_VAL_INIT(tx_8);
@ -1064,7 +1064,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 - TX_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_9, 0);
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_9, 0);
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
tx_9.signatures[0].resize(redundant_keys_count, invalid_signature);
@ -1110,7 +1110,7 @@ bool multisig_and_fake_outputs::generate(std::vector<test_event_entry>& events)
// tx_1: 1 real + 2 fake inputs => 1 multisig output (Miner + Alice, minimum_sigs = 1)
std::vector<tx_source_entry> sources;
std::vector<tx_destination_entry> destinations;
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, amount, TX_DEFAULT_FEE, 2, sources, destinations, true, true, 1);
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, amount, TESTS_DEFAULT_FEE, 2, sources, destinations, true, true, 1);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
// Make sure tx_1 is successfully created
@ -1141,7 +1141,7 @@ bool multisig_and_fake_outputs::generate(std::vector<test_event_entry>& events)
se.real_out_tx_key = get_tx_pub_key_from_extra(tx_1);
destinations.clear();
destinations.push_back(tx_destination_entry(amount - TX_DEFAULT_FEE, alice_acc.get_public_address()));
destinations.push_back(tx_destination_entry(amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()));
// Make sure tx is successfully created
transaction tx_2 = AUTO_VAL_INIT(tx_2);
@ -1157,7 +1157,7 @@ bool multisig_and_fake_outputs::generate(std::vector<test_event_entry>& events)
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1, miner_acc, tx_2);
// Finally, check the balance of Alice's wallet
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, amount - TX_DEFAULT_FEE));
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, amount - TESTS_DEFAULT_FEE));
return true;
}
@ -1182,13 +1182,13 @@ bool multisig_and_unlock_time::generate(std::vector<test_event_entry>& events) c
test_core_time::adjust(blk_0r.timestamp); // adjust gentime time to blockchain timestamps
bool r = false;
uint64_t amount = TX_DEFAULT_FEE * 9;
uint64_t amount = TESTS_DEFAULT_FEE * 9;
std::list<account_public_address> ms_addr_list({ miner_acc.get_public_address(), alice_acc.get_public_address() });
// noramal input -> multisig output with unlock time
std::vector<tx_source_entry> sources;
std::vector<tx_destination_entry> destinations;
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, amount, TX_DEFAULT_FEE, 1, sources, destinations, true, true, 1);
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, amount, TESTS_DEFAULT_FEE, 1, sources, destinations, true, true, 1);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
uint64_t unlock_time = blk_0r.timestamp + DIFFICULTY_TOTAL_TARGET * 3 + CURRENCY_LOCKED_TX_ALLOWED_DELTA_SECONDS;
@ -1218,7 +1218,7 @@ bool multisig_and_unlock_time::generate(std::vector<test_event_entry>& events) c
se.ms_sigs_count = 1;
sources.assign({ se });
destinations.assign({ tx_destination_entry(amount - TX_DEFAULT_FEE, alice_acc.get_public_address()) });
destinations.assign({ tx_destination_entry(amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) });
ADJUST_TEST_CORE_TIME(unlock_time - CURRENCY_LOCKED_TX_ALLOWED_DELTA_SECONDS - 1);
@ -1245,13 +1245,13 @@ bool multisig_and_unlock_time::generate(std::vector<test_event_entry>& events) c
ADJUST_TEST_CORE_TIME(unlock_time_2 - CURRENCY_LOCKED_TX_ALLOWED_DELTA_SECONDS - 1);
DO_CALLBACK(events, "mark_invalid_tx");
MAKE_TX(events, tx_3, alice_acc, bob_acc, amount - TX_DEFAULT_FEE * 2, blk_2);
MAKE_TX(events, tx_3, alice_acc, bob_acc, amount - TESTS_DEFAULT_FEE * 2, blk_2);
ADJUST_TEST_CORE_TIME(unlock_time_2 - CURRENCY_LOCKED_TX_ALLOWED_DELTA_SECONDS + 1);
events.push_back(tx_3);
MAKE_NEXT_BLOCK_TX1(events, blk_3, blk_2, miner_acc, tx_3);
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TX_DEFAULT_FEE * 2));
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TESTS_DEFAULT_FEE * 2));
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, 0));
// Expiration time
@ -1260,7 +1260,7 @@ bool multisig_and_unlock_time::generate(std::vector<test_event_entry>& events) c
uint64_t expiration_time = generator.get_timestamps_median(get_block_hash(blk_3), TX_EXPIRATION_TIMESTAMP_CHECK_WINDOW) - DIFFICULTY_TOTAL_TARGET * 3;
sources.clear();
destinations.clear();
r = fill_tx_sources_and_destinations(events, blk_3, miner_acc.get_keys(), ms_addr_list, amount, TX_DEFAULT_FEE, 1, sources, destinations, true, true, 1);
r = fill_tx_sources_and_destinations(events, blk_3, miner_acc.get_keys(), ms_addr_list, amount, TESTS_DEFAULT_FEE, 1, sources, destinations, true, true, 1);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction tx_4 = AUTO_VAL_INIT(tx_4);
@ -1296,7 +1296,7 @@ bool multisig_and_unlock_time::generate(std::vector<test_event_entry>& events) c
se.ms_sigs_count = 1;
sources.assign({ se });
destinations.assign({ tx_destination_entry(amount - TX_DEFAULT_FEE, alice_acc.get_public_address()) });
destinations.assign({ tx_destination_entry(amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) });
expiration_time = generator.get_timestamps_median(get_block_hash(blk_4), TX_EXPIRATION_TIMESTAMP_CHECK_WINDOW) - DIFFICULTY_TOTAL_TARGET * 3;
extra_expiration_time = AUTO_VAL_INIT(extra_expiration_time);
@ -1412,7 +1412,7 @@ bool multisig_and_coinbase::generate(std::vector<test_event_entry>& events) cons
se.ms_sigs_count = 1;
sources.assign({ se });
destinations.assign({ tx_destination_entry(se.amount - TX_DEFAULT_FEE, bob_acc.get_public_address()) });
destinations.assign({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address()) });
transaction tx_1 = AUTO_VAL_INIT(tx_1);
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
@ -1425,7 +1425,7 @@ bool multisig_and_coinbase::generate(std::vector<test_event_entry>& events) cons
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1r, miner_acc, tx_1);
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, 0));
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, se.amount - TX_DEFAULT_FEE));
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, se.amount - TESTS_DEFAULT_FEE));
//
// Part 2. The same for PoW
@ -1442,7 +1442,7 @@ bool multisig_and_coinbase::generate(std::vector<test_event_entry>& events) cons
std::list<account_public_address> ms_addr_list({ miner_acc.get_public_address(), alice_acc.get_public_address() });
std::vector<tx_source_entry> sources;
std::vector<tx_destination_entry> destinations;
r = fill_tx_sources_and_destinations(events, prev_block, miner_acc.get_keys(), ms_addr_list, blk_2_reward, TX_DEFAULT_FEE, 0, sources, destinations, false, false, 1);
r = fill_tx_sources_and_destinations(events, prev_block, miner_acc.get_keys(), ms_addr_list, blk_2_reward, TESTS_DEFAULT_FEE, 0, sources, destinations, false, false, 1);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction miner_tx = AUTO_VAL_INIT(miner_tx);
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, miner_tx, height + CURRENCY_MINED_MONEY_UNLOCK_WINDOW, CURRENCY_TO_KEY_OUT_RELAXED, true);
@ -1478,7 +1478,7 @@ bool multisig_and_coinbase::generate(std::vector<test_event_entry>& events) cons
se.ms_sigs_count = 1;
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 - TX_DEFAULT_FEE, alice_acc.get_public_address()) }),
r = construct_tx(alice_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }),
empty_attachment, tx_2, 0);
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
@ -1488,7 +1488,7 @@ bool multisig_and_coinbase::generate(std::vector<test_event_entry>& events) cons
MAKE_NEXT_BLOCK_TX1(events, blk_4, blk_3r, miner_acc, tx_2);
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, se.amount - TX_DEFAULT_FEE));
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, se.amount - TESTS_DEFAULT_FEE));
return true;
}
@ -1515,7 +1515,7 @@ bool multisig_with_same_id_in_pool::generate(std::vector<test_event_entry>& even
uint64_t amount_many_out_have = 0, stub = 0;
r = calculate_amounts_many_outs_have_and_no_outs_have(generator.get_base_reward_for_next_block(get_block_hash(blk_0r)), amount_many_out_have, stub); // this amount corresponds to many outs, so no changeback will be generated
CHECK_AND_ASSERT_MES(r, false, "calculate_amounts_many_outs_have_and_no_outs_have failed");
uint64_t amount = amount_many_out_have - TX_DEFAULT_FEE;
uint64_t amount = amount_many_out_have - TESTS_DEFAULT_FEE;
std::list<account_public_address> to_addrs({ alice_acc.get_public_address(), alice_acc.get_public_address() }); // multisig to same account, mentioned twice
@ -1523,7 +1523,7 @@ bool multisig_with_same_id_in_pool::generate(std::vector<test_event_entry>& even
std::vector<tx_destination_entry> destinations;
// tx_1: normal input -> multisig output
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true);
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true);
CHECK_AND_ASSERT_MES(r && sources.size() == 1 && destinations.size() == 1, false, "fill_tx_sources_and_destinations failed"); // we selected such good amount so sources.size() and destinations.size() should be eq 1
// create tx_1 manually in order to have access to its one-time key
@ -1541,7 +1541,7 @@ bool multisig_with_same_id_in_pool::generate(std::vector<test_event_entry>& even
// prepare sources and destinations for tx_2, using the same amount
std::vector<tx_source_entry> sources2;
std::vector<tx_destination_entry> destinations2;
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TX_DEFAULT_FEE, 0, sources2, destinations2, true, true);
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TESTS_DEFAULT_FEE, 0, sources2, destinations2, true, true);
CHECK_AND_ASSERT_MES(r && sources2.size() == 1 && destinations2.size() == 1, false, "fill_tx_sources_and_destinations failed"); // we selected such good amount so sources.size() and destinations.size() should be eq 1
// tx_2 differs in inputs but should have the same outputs
@ -1582,7 +1582,7 @@ bool multisig_with_same_id_in_pool::generate(std::vector<test_event_entry>& even
se.ms_keys_count = boost::get<txout_multisig>(tx_1.vout[se.real_output_in_tx_index].target).keys.size();
se.ms_sigs_count = 1;
tx_destination_entry de(amount - TX_DEFAULT_FEE, bob_acc.get_public_address());
tx_destination_entry de(amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address());
transaction tx_3 = AUTO_VAL_INIT(tx_3);
r = construct_tx(alice_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ de }), empty_attachment, tx_3, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
@ -1625,7 +1625,7 @@ multisig_and_checkpoints::multisig_and_checkpoints()
bool multisig_and_checkpoints::set_cp(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
{
currency::checkpoints checkpoints;
checkpoints.add_checkpoint(15, "46f45b849160be33937c60fa564e820792b0aaa6cf4a080e6002b6f25d84d688");
checkpoints.add_checkpoint(15, "f7543a7ac52a864dd3782a99229840a38e82fd31b64c6b197a2f41f74bd5bacc");
c.set_checkpoints(std::move(checkpoints));
return true;
@ -1668,11 +1668,11 @@ bool multisig_and_checkpoints::generate(std::vector<test_event_entry>& events) c
DO_CALLBACK(events, "set_cp");
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 2);
uint64_t amount = TX_DEFAULT_FEE * 99;
uint64_t amount = TESTS_DEFAULT_FEE * 99;
std::list<account_public_address> to_addrs({ alice_acc.get_public_address(), alice_acc.get_public_address() }); // multisig to same account, mentioned twice
// tx_1: normal input -> multisig output
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction tx_1 = AUTO_VAL_INIT(tx_1);
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
@ -1690,7 +1690,7 @@ bool multisig_and_checkpoints::generate(std::vector<test_event_entry>& events) c
se.ms_keys_count = boost::get<txout_multisig>(tx_1.vout[se.real_output_in_tx_index].target).keys.size();
se.ms_sigs_count = 1;
tx_destination_entry de(amount - TX_DEFAULT_FEE, bob_acc.get_public_address());
tx_destination_entry de(amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address());
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>({ de }), empty_attachment, tx_2, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
@ -1706,7 +1706,7 @@ bool multisig_and_checkpoints::generate(std::vector<test_event_entry>& events) c
// tx_3: normal input -> multisig output
r = fill_tx_sources_and_destinations(events, blk_2, miner_acc.get_keys(), to_addrs, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
r = fill_tx_sources_and_destinations(events, blk_2, miner_acc.get_keys(), to_addrs, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction tx_3 = AUTO_VAL_INIT(tx_3);
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_3, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
@ -1728,7 +1728,7 @@ bool multisig_and_checkpoints::generate(std::vector<test_event_entry>& events) c
se.ms_keys_count = boost::get<txout_multisig>(tx_3.vout[se.real_output_in_tx_index].target).keys.size();
se.ms_sigs_count = 1;
de = tx_destination_entry(amount - TX_DEFAULT_FEE, bob_acc.get_public_address());
de = tx_destination_entry(amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address());
transaction tx_4 = AUTO_VAL_INIT(tx_4);
r = construct_tx(alice_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ de }), empty_attachment, tx_4, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
@ -1739,7 +1739,7 @@ bool multisig_and_checkpoints::generate(std::vector<test_event_entry>& events) c
MAKE_NEXT_BLOCK_TX1(events, blk_4, blk_3, miner_acc, tx_4);
// tx_5: normal input -> multisig output
r = fill_tx_sources_and_destinations(events, blk_4, miner_acc.get_keys(), to_addrs, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
r = fill_tx_sources_and_destinations(events, blk_4, miner_acc.get_keys(), to_addrs, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction tx_5 = AUTO_VAL_INIT(tx_5);
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_5, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
@ -1757,7 +1757,7 @@ bool multisig_and_checkpoints::generate(std::vector<test_event_entry>& events) c
se.ms_keys_count = boost::get<txout_multisig>(tx_5.vout[se.real_output_in_tx_index].target).keys.size();
se.ms_sigs_count = 1;
de = tx_destination_entry(amount - TX_DEFAULT_FEE, bob_acc.get_public_address());
de = tx_destination_entry(amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address());
transaction tx_6 = AUTO_VAL_INIT(tx_6);
r = construct_tx(alice_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ de }), empty_attachment, tx_6, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
@ -1809,11 +1809,11 @@ bool multisig_and_checkpoints_bad_txs::generate(std::vector<test_event_entry>& e
std::vector<tx_source_entry> sources;
std::vector<tx_destination_entry> destinations;
uint64_t amount = TX_DEFAULT_FEE * 99;
uint64_t amount = TESTS_DEFAULT_FEE * 99;
std::list<account_public_address> to_addrs({ alice_acc.get_public_address(), alice_acc.get_public_address() }); // multisig to same account, mentioned twice
// tx_1: normal key to multisig transaction
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction tx_1 = AUTO_VAL_INIT(tx_1);
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
@ -1849,7 +1849,7 @@ bool multisig_and_checkpoints_bad_txs::generate(std::vector<test_event_entry>& e
events.push_back(tx_3);
// tx_4: zero ms out keys (should FAIL)
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
tx_builder txb = AUTO_VAL_INIT(txb);
txb.step1_init();
@ -1887,7 +1887,7 @@ bool multisig_and_checkpoints_bad_txs::generate(std::vector<test_event_entry>& e
MAKE_NEXT_BLOCK_TX1(events, blk_4, blk_3, miner_acc, tx_7);
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TX_DEFAULT_FEE)); // Bob finally got the money
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TESTS_DEFAULT_FEE)); // Bob finally got the money
return true;
}
@ -1919,11 +1919,11 @@ bool multisig_and_altchains::generate(std::vector<test_event_entry>& events) con
std::vector<tx_source_entry> sources;
std::vector<tx_destination_entry> destinations;
uint64_t amount = TX_DEFAULT_FEE * 99;
uint64_t amount = TESTS_DEFAULT_FEE * 99;
std::list<account_public_address> to_addrs({ alice_acc.get_public_address(), alice_acc.get_public_address() }); // multisig to same account, mentioned twice
// tx_1: normal key to multisig transaction
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 1);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction tx_1 = AUTO_VAL_INIT(tx_1);
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
@ -1979,7 +1979,7 @@ bool multisig_and_altchains::generate(std::vector<test_event_entry>& events) con
// |- (1c)- (2c)- (3c)- <- becomes main chain
// tx_1 tx_2
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TX_DEFAULT_FEE));
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TESTS_DEFAULT_FEE));
DO_CALLBACK(events, "mark_invalid_tx"); // tx_3 should be rejected by the pool, as spending already spent ms output in tx_2
events.push_back(tx_3);
@ -2001,7 +2001,7 @@ bool multisig_and_altchains::generate(std::vector<test_event_entry>& events) con
// tx_1 tx_2
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(CAROL_ACC_IDX, 0)); // tx_3 was rejected, thus zero
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TX_DEFAULT_FEE));
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TESTS_DEFAULT_FEE));
DO_CALLBACK_PARAMS(events, "check_tx_pool", params_tx_pool(0));
@ -2019,12 +2019,12 @@ bool multisig_and_altchains::generate(std::vector<test_event_entry>& events) con
// | tx_1 tx_2
// \- (3d)- (4d)- (5d)-
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TX_DEFAULT_FEE, 0, 0, amount - TX_DEFAULT_FEE));
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TESTS_DEFAULT_FEE, 0, 0, amount - TESTS_DEFAULT_FEE));
MAKE_NEXT_BLOCK_TX1(events, blk_6d, blk_5d, miner_acc, tx_2);
DO_CALLBACK_PARAMS(events, "check_tx_pool", params_tx_pool(0));
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TX_DEFAULT_FEE, 0, 0, 0, 0));
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TESTS_DEFAULT_FEE, 0, 0, 0, 0));
return true;
}
@ -2080,9 +2080,9 @@ bool ref_by_id_basics::generate(std::vector<test_event_entry>& events) const
std::vector<tx_source_entry> sources;
std::vector<tx_destination_entry> destinations;
uint64_t amount = TX_DEFAULT_FEE * 90;
uint64_t amount = TESTS_DEFAULT_FEE * 90;
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc, alice_acc, amount, TX_DEFAULT_FEE, 4, sources, destinations, true, true, true);
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc, alice_acc, amount, TESTS_DEFAULT_FEE, 4, sources, destinations, true, true, true);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction tx_1 = AUTO_VAL_INIT(tx_1);
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
@ -2097,7 +2097,7 @@ bool ref_by_id_basics::generate(std::vector<test_event_entry>& events) const
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, amount, 0, 0, 0, 0));
r = fill_tx_sources_and_destinations(events, blk_1, alice_acc, bob_acc, amount - TX_DEFAULT_FEE, TX_DEFAULT_FEE, 0, sources, destinations, true, true, true);
r = fill_tx_sources_and_destinations(events, blk_1, alice_acc, bob_acc, amount - TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, true);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction tx_2 = AUTO_VAL_INIT(tx_2);
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_2, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
@ -2107,7 +2107,7 @@ bool ref_by_id_basics::generate(std::vector<test_event_entry>& events) const
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1, miner_acc, tx_2);
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, 0, 0, 0, 0, 0));
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TX_DEFAULT_FEE, 0, 0, 0, 0));
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount - TESTS_DEFAULT_FEE, 0, 0, 0, 0));
return true;
}
@ -2143,9 +2143,9 @@ bool ref_by_id_mixed_inputs_types::generate(std::vector<test_event_entry>& event
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, amount * 3, 0, 0, 0, 0));
r = fill_tx_sources_and_destinations(events, blk_1, alice_acc, bob_acc, amount * 3 - TX_DEFAULT_FEE, TX_DEFAULT_FEE, 0, sources, destinations, true, true, false); // normal inputs
r = fill_tx_sources_and_destinations(events, blk_1, alice_acc, bob_acc, amount * 3 - TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, false); // normal inputs
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
r = fill_tx_sources_and_destinations(events, blk_1, alice_acc, bob_acc, amount * 3 - TX_DEFAULT_FEE, TX_DEFAULT_FEE, 0, sources2, destinations2, true, true, true); // ref_by_id
r = fill_tx_sources_and_destinations(events, blk_1, alice_acc, bob_acc, amount * 3 - TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, 0, sources2, destinations2, true, true, true); // ref_by_id
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
// mix sources to achive mixed normal and ref_by_id inputs
@ -2177,7 +2177,7 @@ bool ref_by_id_mixed_inputs_types::generate(std::vector<test_event_entry>& event
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, 0, 0, 0, 0, 0));
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount * 3 - TX_DEFAULT_FEE, 0, 0, 0, 0));
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(BOB_ACC_IDX, amount * 3 - TESTS_DEFAULT_FEE, 0, 0, 0, 0));
return true;
@ -2212,7 +2212,7 @@ bool multisig_n_participants_seq_signing::generate(std::vector<test_event_entry>
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
// prepare ms data: amount and list of participants' adresses (belived to be publicly available)
uint64_t ms_amount = TX_DEFAULT_FEE * 17;
uint64_t ms_amount = TESTS_DEFAULT_FEE * 17;
std::list<account_public_address> ms_addr_list;
for(auto &p : m_participants)
ms_addr_list.push_back(p.get_public_address());
@ -2220,7 +2220,7 @@ bool multisig_n_participants_seq_signing::generate(std::vector<test_event_entry>
// Miner makes a tx with ms output to all the participants (with minimum_sigs == m_minimum_signs_to_spend)
std::vector<tx_source_entry> sources;
std::vector<tx_destination_entry> destinations;
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, ms_amount, TX_DEFAULT_FEE, 0, sources, destinations, true, true, m_minimum_signs_to_spend);
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, ms_amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, m_minimum_signs_to_spend);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction tx_1 = AUTO_VAL_INIT(tx_1);
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
@ -2248,7 +2248,7 @@ bool multisig_n_participants_seq_signing::generate(std::vector<test_event_entry>
se.ms_keys_count = boost::get<txout_multisig>(tx_1.vout[ms_out_index].target).keys.size();
sources.push_back(se);
tx_destination_entry de(ms_amount - TX_DEFAULT_FEE, alice_acc.get_public_address());
tx_destination_entry de(ms_amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address());
destinations.push_back(de);
// construct a transaction (no participants keys are provided, thus no signs for ms input are created)
@ -2275,7 +2275,7 @@ bool multisig_n_participants_seq_signing::generate(std::vector<test_event_entry>
r = generator.refresh_test_wallet(events, alice_wlt.get(), get_block_hash(blk_2), CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 2);
CHECK_AND_ASSERT_MES(r, false, "refresh_test_wallet failed");
r = check_balance_via_wallet(*alice_wlt.get(), "alice", ms_amount - TX_DEFAULT_FEE, 0, 0, 0, 0);
r = check_balance_via_wallet(*alice_wlt.get(), "alice", ms_amount - TESTS_DEFAULT_FEE, 0, 0, 0, 0);
CHECK_AND_ASSERT_MES(r, false, "invalid balance");
return true;
@ -2312,11 +2312,11 @@ bool multisig_out_make_and_spent_in_altchain::generate(std::vector<test_event_en
std::vector<tx_source_entry> sources;
std::vector<tx_destination_entry> destinations;
uint64_t amount = TX_DEFAULT_FEE * 33;
uint64_t amount = TESTS_DEFAULT_FEE * 33;
std::list<account_public_address> to_addrs({ alice_acc.get_public_address(), alice_acc.get_public_address() }); // multisig to same account, mentioned twice
// tx_1: normal key to multisig transaction
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TX_DEFAULT_FEE * 7, 0, sources, destinations, true, true, 2);
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TESTS_DEFAULT_FEE * 7, 0, sources, destinations, true, true, 2);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction tx_1 = AUTO_VAL_INIT(tx_1);
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
@ -2341,7 +2341,7 @@ bool multisig_out_make_and_spent_in_altchain::generate(std::vector<test_event_en
// tx_2
transaction tx_2 = AUTO_VAL_INIT(tx_2);
r = make_tx_multisig_to_key(tx_1, get_multisig_out_index(tx_1.vout), std::list<account_keys>({ alice_acc.get_keys(), alice_acc.get_keys() }), bob_acc.get_public_address(), tx_2, TX_DEFAULT_FEE * 13);
r = make_tx_multisig_to_key(tx_1, get_multisig_out_index(tx_1.vout), std::list<account_keys>({ alice_acc.get_keys(), alice_acc.get_keys() }), bob_acc.get_public_address(), tx_2, TESTS_DEFAULT_FEE * 13);
CHECK_AND_ASSERT_MES(r, false, "make_tx_multisig_to_key failed");
events.push_back(event_visitor_settings(event_visitor_settings::set_txs_kept_by_block, true)); // simulate
events.push_back(tx_2);
@ -2351,7 +2351,7 @@ bool multisig_out_make_and_spent_in_altchain::generate(std::vector<test_event_en
// tx_3 spends the same ms out
transaction tx_3 = AUTO_VAL_INIT(tx_3);
r = make_tx_multisig_to_key(tx_1, get_multisig_out_index(tx_1.vout), std::list<account_keys>({ alice_acc.get_keys(), alice_acc.get_keys() }), bob_acc.get_public_address(), tx_3, TX_DEFAULT_FEE * 13);
r = make_tx_multisig_to_key(tx_1, get_multisig_out_index(tx_1.vout), std::list<account_keys>({ alice_acc.get_keys(), alice_acc.get_keys() }), bob_acc.get_public_address(), tx_3, TESTS_DEFAULT_FEE * 13);
CHECK_AND_ASSERT_MES(r, false, "make_tx_multisig_to_key failed");
events.push_back(event_visitor_settings(event_visitor_settings::set_txs_kept_by_block, true)); // simulate
events.push_back(tx_3);
@ -2391,11 +2391,11 @@ bool multisig_out_spent_in_altchain_case_b4::generate(std::vector<test_event_ent
std::vector<tx_source_entry> sources;
std::vector<tx_destination_entry> destinations;
uint64_t amount = TX_DEFAULT_FEE * 22;
uint64_t amount = TESTS_DEFAULT_FEE * 22;
std::list<account_public_address> to_addrs({ alice_acc.get_public_address(), alice_acc.get_public_address() }); // multisig to same account, mentioned twice
// tx_1: normal key to multisig transaction
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TX_DEFAULT_FEE * 5, 0, sources, destinations, true, true, 2);
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), to_addrs, amount, TESTS_DEFAULT_FEE * 5, 0, sources, destinations, true, true, 2);
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
transaction tx_1 = AUTO_VAL_INIT(tx_1);
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
@ -2418,7 +2418,7 @@ bool multisig_out_spent_in_altchain_case_b4::generate(std::vector<test_event_ent
// tx_2
transaction tx_2 = AUTO_VAL_INIT(tx_2);
r = make_tx_multisig_to_key(tx_1, get_multisig_out_index(tx_1.vout), std::list<account_keys>({ alice_acc.get_keys(), alice_acc.get_keys() }), bob_acc.get_public_address(), tx_2, TX_DEFAULT_FEE * 13);
r = make_tx_multisig_to_key(tx_1, get_multisig_out_index(tx_1.vout), std::list<account_keys>({ alice_acc.get_keys(), alice_acc.get_keys() }), bob_acc.get_public_address(), tx_2, TESTS_DEFAULT_FEE * 13);
CHECK_AND_ASSERT_MES(r, false, "make_tx_multisig_to_key failed");
events.push_back(tx_2);
@ -2467,7 +2467,7 @@ bool multisig_unconfirmed_transfer_and_multiple_scan_pool_calls::c1(currency::co
auto& alice_acc = m_accounts[ALICE_ACC_IDX];
auto& bob_acc = m_accounts[BOB_ACC_IDX];
uint64_t ms_amount = TX_DEFAULT_FEE * 13;
uint64_t ms_amount = TESTS_DEFAULT_FEE * 13;
std::shared_ptr<tools::wallet2> miner_wlt = init_playtime_test_wallet(events, c, m_accounts[MINER_ACC_IDX]);
size_t blocks_fetched = 0;
@ -2485,10 +2485,10 @@ bool multisig_unconfirmed_transfer_and_multiple_scan_pool_calls::c1(currency::co
// to_key => multisig
dst.back().addr.push_back(miner_acc.get_public_address());
dst.back().addr.push_back(alice_acc.get_public_address());
dst.back().amount = ms_amount + TX_DEFAULT_FEE;
dst.back().amount = ms_amount + TESTS_DEFAULT_FEE;
dst.back().minimum_sigs = dst.back().addr.size();
transaction key_to_ms_tx = AUTO_VAL_INIT(key_to_ms_tx);
miner_wlt->transfer(dst, 0, 0, TX_DEFAULT_FEE, extra, attachments, tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), key_to_ms_tx);
miner_wlt->transfer(dst, 0, 0, TESTS_DEFAULT_FEE, extra, attachments, tools::detail::digit_split_strategy, tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), key_to_ms_tx);
bool r = mine_next_pow_blocks_in_playtime(miner_acc.get_public_address(), c, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
CHECK_AND_ASSERT_MES(r, false, "mine_next_pow_blocks_in_playtime failed");
@ -2525,7 +2525,7 @@ bool multisig_unconfirmed_transfer_and_multiple_scan_pool_calls::c1(currency::co
multisig_id,
dst2,
0,
TX_DEFAULT_FEE,
TESTS_DEFAULT_FEE,
extra,
attachments,
tools::detail::digit_split_strategy,

View file

@ -263,22 +263,22 @@ bool offers_expiration_test::generate(std::vector<test_event_entry>& events) con
od.expiration_time = 0;
attachment.clear();
bc_services::put_offer_into_attachment(od, attachment);
MAKE_TX_ATTACH(events, tx_0, miner_acc, alice_acc, TX_DEFAULT_FEE, blk_0r, attachment);
MAKE_TX_ATTACH(events, tx_0, miner_acc, alice_acc, TESTS_DEFAULT_FEE, blk_0r, attachment);
od.expiration_time = 1;
attachment.clear();
bc_services::put_offer_into_attachment(od, attachment);
MAKE_TX_ATTACH(events, tx_1, miner_acc, alice_acc, TX_DEFAULT_FEE, blk_0r, attachment);
MAKE_TX_ATTACH(events, tx_1, miner_acc, alice_acc, TESTS_DEFAULT_FEE, blk_0r, attachment);
od.expiration_time = 2;
attachment.clear();
bc_services::put_offer_into_attachment(od, attachment);
MAKE_TX_ATTACH(events, tx_2, miner_acc, alice_acc, TX_DEFAULT_FEE, blk_0r, attachment);
MAKE_TX_ATTACH(events, tx_2, miner_acc, alice_acc, TESTS_DEFAULT_FEE, blk_0r, attachment);
od.expiration_time = 3;
attachment.clear();
bc_services::put_offer_into_attachment(od, attachment);
MAKE_TX_ATTACH(events, tx_3, miner_acc, alice_acc, TX_DEFAULT_FEE, blk_0r, attachment);
MAKE_TX_ATTACH(events, tx_3, miner_acc, alice_acc, TESTS_DEFAULT_FEE, blk_0r, attachment);
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, std::list<transaction>({ tx_0, tx_1, tx_2, tx_3 }));
m_offers_ts = blk_1.timestamp;
@ -378,7 +378,7 @@ bool offers_filtering_1::generate(std::vector<test_event_entry>& events) const
fill_test_offer(od);
std::vector<currency::attachment_v> attachment;
bc_services::put_offer_into_attachment(od, attachment);
MAKE_TX_LIST_ATTACH(events, txs, miner_acc, miner_acc, TX_DEFAULT_FEE, blk_0r, attachment);
MAKE_TX_LIST_ATTACH(events, txs, miner_acc, miner_acc, TESTS_DEFAULT_FEE, blk_0r, attachment);
}
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, txs);
@ -389,7 +389,7 @@ bool offers_filtering_1::generate(std::vector<test_event_entry>& events) const
fill_test_offer(od);
std::vector<currency::attachment_v> attachment;
bc_services::put_offer_into_attachment(od, attachment);
MAKE_TX_LIST_ATTACH(events, txs, miner_acc, miner_acc, TX_DEFAULT_FEE, blk_1, attachment);
MAKE_TX_LIST_ATTACH(events, txs, miner_acc, miner_acc, TESTS_DEFAULT_FEE, blk_1, attachment);
}
MAKE_NEXT_BLOCK_TX_LIST(events, blk_2, blk_1, miner_acc, txs);
@ -526,7 +526,7 @@ bool offers_handling_on_chain_switching::generate(std::vector<test_event_entry>&
MAKE_GENESIS_BLOCK(events, blk_0, miner_acc, test_core_time::get_time()); // 0
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW); // 2N (N == CURRENCY_MINED_MONEY_UNLOCK_WINDOW)
MAKE_TX(events, tx_0, miner_acc, alice_acc, TX_DEFAULT_FEE * 70, blk_0r); // 2N+1
MAKE_TX(events, tx_0, miner_acc, alice_acc, TESTS_DEFAULT_FEE * 70, blk_0r); // 2N+1
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_0); // 2N+2
REWIND_BLOCKS_N_WITH_TIME(events, blk_1r, blk_1, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW); // 4N+2
@ -535,7 +535,7 @@ bool offers_handling_on_chain_switching::generate(std::vector<test_event_entry>&
fill_test_offer(od);
std::vector<currency::attachment_v> attachment;
bc_services::put_offer_into_attachment(od, attachment);
MAKE_TX_ATTACH(events, tx_1, alice_acc, alice_acc, TX_DEFAULT_FEE, blk_1r, attachment); // 4N+3
MAKE_TX_ATTACH(events, tx_1, alice_acc, alice_acc, TESTS_DEFAULT_FEE, blk_1r, attachment); // 4N+3
MAKE_NEXT_BLOCK(events, blk_2, blk_1r, miner_acc); // 4N+4
//MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1r, miner_acc, tx_1); // 4N+4
@ -1255,7 +1255,7 @@ bool offer_lifecycle_via_tx_pool::c1(currency::core& c, size_t ev_index, const s
bc_services::offer_details_ex od = AUTO_VAL_INIT(od);
fill_test_offer(od);
od.comment = "1";
od.fee = TX_DEFAULT_FEE * 3;
od.fee = TESTS_DEFAULT_FEE * 3;
// create an offer
transaction tx_1 = AUTO_VAL_INIT(tx_1);

View file

@ -383,7 +383,7 @@ void decompose_amount_into_exact_number_of_pos_entries(uint64_t amount, size_t p
{
for (auto it = pos_amounts_list.begin(); it != pos_amounts_list.end() && pos_amounts_list.size() < pos_entries_count; /* nothing */)
{
if (*it >= 2 * TX_DEFAULT_FEE)
if (*it >= 2 * TESTS_DEFAULT_FEE)
{
// each iteration pops one element 'a' and pushes two elements: c1 and c2, so that a == c1 + c2 (sum is invariant)
uint64_t a = *it;
@ -442,7 +442,7 @@ bool populate_wallet_with_stake_coins(std::shared_ptr<tools::wallet2> w, std::sh
uint64_t balance_unlocked = 0;
uint64_t balance = w->balance(balance_unlocked);
CHECK_AND_ASSERT_MES(balance == balance_unlocked, false, "WARNING: balance is " << balance << " NOT EQUAL TO unlocked balance, which is " << balance_unlocked);
if (balance_unlocked > TX_DEFAULT_FEE)
if (balance_unlocked > TESTS_DEFAULT_FEE)
WALLET_TRY_CATCH(w->transfer(balance_unlocked, money_source_w->get_account().get_public_address()));
uint64_t sum = 0;
@ -453,7 +453,7 @@ bool populate_wallet_with_stake_coins(std::shared_ptr<tools::wallet2> w, std::sh
// populate current wallet with pos entries from scratch
money_source_w->refresh();
balance = money_source_w->balance(balance_unlocked);
CHECK_AND_ASSERT_MES(balance_unlocked > amount + TX_DEFAULT_FEE * pos_entries_count, false, "source wallet has not enough money: balance_unlocked: " << balance_unlocked << ", balance: " << balance << ", required amount: " << amount + TX_DEFAULT_FEE * pos_entries_count);
CHECK_AND_ASSERT_MES(balance_unlocked > amount + TESTS_DEFAULT_FEE * pos_entries_count, false, "source wallet has not enough money: balance_unlocked: " << balance_unlocked << ", balance: " << balance << ", required amount: " << amount + TESTS_DEFAULT_FEE * pos_entries_count);
const account_public_address& wallet_address = w->get_account().get_public_address();
std::vector<tx_destination_entry> destinations;
@ -461,7 +461,7 @@ bool populate_wallet_with_stake_coins(std::shared_ptr<tools::wallet2> w, std::sh
for(auto pos_amount : pos_amounts)
destinations.push_back(tx_destination_entry(pos_amount, wallet_address));
WALLET_TRY_CATCH(money_source_w->transfer(destinations, 0, 0, TX_DEFAULT_FEE, empty_extra, empty_attachment));
WALLET_TRY_CATCH(money_source_w->transfer(destinations, 0, 0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment));
return true;
@ -885,7 +885,7 @@ bool pos_altblocks_validation::generate(std::vector<test_event_entry>& events) c
stake_tx_out_id = i;
}
MAKE_TX_FEE(events, tx_0, alice_acc, alice_acc, alice_money - TX_DEFAULT_FEE * 17, TX_DEFAULT_FEE * 17, blk_2);
MAKE_TX_FEE(events, tx_0, alice_acc, alice_acc, alice_money - TESTS_DEFAULT_FEE * 17, TESTS_DEFAULT_FEE * 17, blk_2);
// tx_0 transfers all Alice's money, so it effectevily spends all outputs in stake_ts, make sure it does
CHECK_AND_ASSERT_MES(tx_0.vin.size() == stake_tx.vout.size(), false, "probably, tx_0 doesn't spend all Alice's money as expected, tx_0.vin.size()=" << tx_0.vin.size() << ", stake_tx.vout.size()=" << stake_tx.vout.size());

View file

@ -614,7 +614,7 @@ bool gen_tx_signatures_are_invalid::generate(std::vector<test_event_entry>& even
MAKE_NEXT_BLOCK(events, blk_1, blk_0, miner_account);
REWIND_BLOCKS_N(events, blk_1r, blk_1, miner_account, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
uint64_t amount = TX_DEFAULT_FEE * 80;
uint64_t amount = TESTS_DEFAULT_FEE * 80;
// prepare needed outputs by transferring them to Carol and Dan
MAKE_TX(events, tx_a, miner_account, carol_account, amount / 2, blk_1r);
@ -698,7 +698,7 @@ bool gen_tx_signatures_are_invalid::generate(std::vector<test_event_entry>& even
MAKE_NEXT_BLOCK_TX_LIST(events, blk_3, prev_block, miner_account, std::list<transaction>({ tx_0, tx_1 }));
// spend all Alice's money to make sure she has successfully received it with 'tx'
MAKE_TX(events, tx_2, alice_account, bob_account, amount * 2 - TX_DEFAULT_FEE, blk_3);
MAKE_TX(events, tx_2, alice_account, bob_account, amount * 2 - TESTS_DEFAULT_FEE, blk_3);
MAKE_NEXT_BLOCK_TX1(events, blk_4, blk_3, miner_account, tx_2);
return true;

View file

@ -160,8 +160,8 @@ bool gen_wallet_basic_transfer::generate(std::vector<test_event_entry>& events)
REFRESH_TEST_WALLET_AT_GEN_TIME(events, bob_wlt, blk_3, CURRENCY_MINED_MONEY_UNLOCK_WINDOW * 2 + 3);
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_3, 1);
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME(alice_wlt, MK_TEST_COINS(900) - TX_DEFAULT_FEE);
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(alice_acc_idx, MK_TEST_COINS(900) - TX_DEFAULT_FEE));
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME(alice_wlt, MK_TEST_COINS(900) - TESTS_DEFAULT_FEE);
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(alice_acc_idx, MK_TEST_COINS(900) - TESTS_DEFAULT_FEE));
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME(bob_wlt, MK_TEST_COINS(2100));
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(bob_acc_idx, MK_TEST_COINS(2100)));
@ -217,7 +217,7 @@ bool gen_wallet_refreshing_on_chain_switch::generate(std::vector<test_event_entr
// alice tries to send some money
// MAKE_TEST_WALLET_TX(events, tx_1, alice_wlt, MK_TEST_COINS(1500), miner_acc); - can't use wallet because it checks money unlock
MAKE_TX_FEE(events, tx_1, alice_acc, miner_acc, MK_TEST_COINS(1500), TX_DEFAULT_FEE, blk_1);
MAKE_TX_FEE(events, tx_1, alice_acc, miner_acc, MK_TEST_COINS(1500), TESTS_DEFAULT_FEE, blk_1);
// switch the chain
MAKE_NEXT_BLOCK(events, blk_1a, blk_0r, miner_acc);
@ -237,8 +237,8 @@ bool gen_wallet_refreshing_on_chain_switch::generate(std::vector<test_event_entr
// Actually we have: total = 2000 + 500 - fee, unlocked = 0, mined = 0, awaiting_in = 2000 + (500 - fee), awaiting_out = 0
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_2a, 2);
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME(alice_wlt, MK_TEST_COINS(2500) - TX_DEFAULT_FEE);
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(alice_acc_idx, uint64_max, 0, 0, MK_TEST_COINS(2500) - TX_DEFAULT_FEE, 0));
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME(alice_wlt, MK_TEST_COINS(2500) - TESTS_DEFAULT_FEE);
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(alice_acc_idx, uint64_max, 0, 0, MK_TEST_COINS(2500) - TESTS_DEFAULT_FEE, 0));
// make sure her transaction is not valid now
DO_CALLBACK(events, "mark_invalid_block");
@ -254,8 +254,8 @@ bool gen_wallet_refreshing_on_chain_switch::generate(std::vector<test_event_entr
// refresh the wallet and make sure it's ok with correct balance
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_3, 3);
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME(alice_wlt, MK_TEST_COINS(500) - TX_DEFAULT_FEE);
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(alice_acc_idx, MK_TEST_COINS(500) - TX_DEFAULT_FEE));
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME(alice_wlt, MK_TEST_COINS(500) - TESTS_DEFAULT_FEE);
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(alice_acc_idx, MK_TEST_COINS(500) - TESTS_DEFAULT_FEE));
return true;
}
@ -284,10 +284,10 @@ bool gen_wallet_refreshing_on_chain_switch_2::generate(std::vector<test_event_en
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW); // 2N (N = CURRENCY_MINED_MONEY_UNLOCK_WINDOW == 10)
// send some money to alice
MAKE_TX_FEE(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(2000), TX_DEFAULT_FEE, blk_0r); // 2N+1
MAKE_TX_FEE(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(2000), TESTS_DEFAULT_FEE, blk_0r); // 2N+1
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_0); // 2N+1
MAKE_TX_FEE(events, tx_1, miner_acc, alice_acc, MK_TEST_COINS(500), TX_DEFAULT_FEE, blk_0r); // 2N+3
MAKE_TX_FEE(events, tx_1, miner_acc, alice_acc, MK_TEST_COINS(500), TESTS_DEFAULT_FEE, blk_0r); // 2N+3
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1, miner_acc, tx_1); // 2N+4
// 0 10 11 12 <- blockchain height
@ -367,7 +367,7 @@ bool gen_wallet_unconfirmed_tx_from_tx_pool::generate(std::vector<test_event_ent
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
// prepare a tx with money for alice
MAKE_TX_FEE(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(2000), TX_DEFAULT_FEE, blk_0r);
MAKE_TX_FEE(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(2000), TESTS_DEFAULT_FEE, blk_0r);
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_0r, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
//bool has_aliases = false;
@ -428,7 +428,7 @@ bool gen_wallet_save_load_and_balance::generate(std::vector<test_event_entry>& e
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
// prepare a tx with money for alice
MAKE_TX_FEE(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(2000), TX_DEFAULT_FEE, blk_0r);
MAKE_TX_FEE(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(2000), TESTS_DEFAULT_FEE, blk_0r);
// check balance based on gen-time data
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_0r, 10);
@ -559,7 +559,7 @@ bool gen_wallet_mine_pos_block::generate(std::vector<test_event_entry>& events)
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
MAKE_TX_FEE(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(2000), TX_DEFAULT_FEE, blk_0r);
MAKE_TX_FEE(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(2000), TESTS_DEFAULT_FEE, blk_0r);
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_0);
REWIND_BLOCKS_N_WITH_TIME(events, blk_1r, blk_1, miner_acc, WALLET_DEFAULT_TX_SPENDABLE_AGE);
@ -631,14 +631,14 @@ bool gen_wallet_unconfirmed_outdated_tx::generate(std::vector<test_event_entry>&
// create tx_0 like it's 20 sec after blk_0r
events.push_back(event_core_time(blk_0r.timestamp + 20));
MAKE_TX_FEE(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(200), TX_DEFAULT_FEE, blk_0r);
MAKE_TX_FEE(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(200), TESTS_DEFAULT_FEE, blk_0r);
// check balances and populate unconfirmed tx list in a wallet
DO_CALLBACK(events, "c1");
// create tx_1 like it's 25 sec after blk_0r
events.push_back(event_core_time(blk_0r.timestamp + 25));
MAKE_TX_FEE(events, tx_1, miner_acc, alice_acc, MK_TEST_COINS(500), TX_DEFAULT_FEE, blk_0r);
MAKE_TX_FEE(events, tx_1, miner_acc, alice_acc, MK_TEST_COINS(500), TESTS_DEFAULT_FEE, blk_0r);
// check balances and populate unconfirmed tx list in a wallet
DO_CALLBACK(events, "c2");
@ -787,8 +787,8 @@ bool gen_wallet_unlock_by_block_and_by_time::generate(std::vector<test_event_ent
// create two txs (2x 3000 test coins to Alice) both having non-zero unlock_time
uint64_t unlock_block_num = CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 2 + WALLET_DEFAULT_TX_SPENDABLE_AGE + 2;
uint64_t unlock_time = blk_0.timestamp + 10000;
miner_wlt->transfer(destinations, 0, unlock_block_num, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tx_0);
miner_wlt->transfer(destinations, 0, unlock_time, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tx_1);
miner_wlt->transfer(destinations, 0, unlock_block_num, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tx_0);
miner_wlt->transfer(destinations, 0, unlock_time, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tx_1);
events.push_back(tx_0);
events.push_back(tx_1);
@ -828,7 +828,7 @@ bool gen_wallet_unlock_by_block_and_by_time::generate(std::vector<test_event_ent
// check the balance, make sure the tx is still locked and money can't be spent
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_2, 0);
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME_FULL(alice_wlt, MK_TEST_COINS(60 - 29) - TX_DEFAULT_FEE, 0, 0, 0, MK_TEST_COINS(29));
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME_FULL(alice_wlt, MK_TEST_COINS(60 - 29) - TESTS_DEFAULT_FEE, 0, 0, 0, MK_TEST_COINS(29));
r = false;
try
@ -848,7 +848,7 @@ bool gen_wallet_unlock_by_block_and_by_time::generate(std::vector<test_event_ent
// check balance
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_2, 0);
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME_FULL(alice_wlt, MK_TEST_COINS(60 - 29) - TX_DEFAULT_FEE, 0, MK_TEST_COINS(30), 0, MK_TEST_COINS(29));
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME_FULL(alice_wlt, MK_TEST_COINS(60 - 29) - TESTS_DEFAULT_FEE, 0, MK_TEST_COINS(30), 0, MK_TEST_COINS(29));
// make sure the money can be spent now, put a transaction
MAKE_TEST_WALLET_TX(events, tx_d, alice_wlt, MK_TEST_COINS(29), miner_acc);
@ -875,7 +875,7 @@ bool gen_wallet_unlock_by_block_and_by_time::c1(currency::core& c, size_t ev_ind
bool r = false;
try
{
alice_wlt->transfer(std::vector<tx_destination_entry>({ { MK_TEST_COINS(29), m_accounts[MINER_ACC_IDX].get_public_address() } }), 0, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>());
alice_wlt->transfer(std::vector<tx_destination_entry>({ { MK_TEST_COINS(29), m_accounts[MINER_ACC_IDX].get_public_address() } }), 0, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>());
}
catch (const tools::error::not_enough_money&)
{
@ -902,7 +902,7 @@ bool gen_wallet_unlock_by_block_and_by_time::c2(currency::core& c, size_t ev_ind
CHECK_AND_ASSERT_MES(blocks_fetched == 1, false, "Incorrect numbers of blocks fetched");
alice_wlt->scan_tx_pool(has_alias);
if (!check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", MK_TEST_COINS(60 - 29) - TX_DEFAULT_FEE, 0, 0, 0, MK_TEST_COINS(29)))
if (!check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", MK_TEST_COINS(60 - 29) - TESTS_DEFAULT_FEE, 0, 0, 0, MK_TEST_COINS(29)))
return false;
alice_wlt->reset_password(g_wallet_password);
@ -924,13 +924,13 @@ bool gen_wallet_unlock_by_block_and_by_time::c3(currency::core& c, size_t ev_ind
CHECK_AND_ASSERT_MES(blocks_fetched == 0, false, "Incorrect numbers of blocks fetched");
alice_wlt->scan_tx_pool(has_alias);
if (!check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", MK_TEST_COINS(60 - 29) - TX_DEFAULT_FEE, 0, 0, 0, MK_TEST_COINS(29)))
if (!check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", MK_TEST_COINS(60 - 29) - TESTS_DEFAULT_FEE, 0, 0, 0, MK_TEST_COINS(29)))
return false;
bool r = false;
try
{
alice_wlt->transfer(std::vector<tx_destination_entry>({ { MK_TEST_COINS(29), m_accounts[MINER_ACC_IDX].get_public_address() } }), 0, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>());
alice_wlt->transfer(std::vector<tx_destination_entry>({ { MK_TEST_COINS(29), m_accounts[MINER_ACC_IDX].get_public_address() } }), 0, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>());
}
catch (const tools::error::not_enough_money&)
{
@ -957,7 +957,7 @@ bool gen_wallet_unlock_by_block_and_by_time::c4(currency::core& c, size_t ev_ind
CHECK_AND_ASSERT_MES(blocks_fetched == 0, false, "Incorrect numbers of blocks fetched");
alice_wlt->scan_tx_pool(has_alias);
if (!check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", MK_TEST_COINS(60 - 29 - 29) - TX_DEFAULT_FEE * 2, 0, 0, 0, MK_TEST_COINS(29 + 29)))
if (!check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", MK_TEST_COINS(60 - 29 - 29) - TESTS_DEFAULT_FEE * 2, 0, 0, 0, MK_TEST_COINS(29 + 29)))
return false;
alice_wlt->reset_password(g_wallet_password);
@ -1027,8 +1027,8 @@ bool gen_wallet_payment_id::generate(std::vector<test_event_entry>& events) cons
CREATE_TEST_WALLET(alice_wlt, alice_acc, blk_0);
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_3, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 3);
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME(alice_wlt, MK_TEST_COINS(40 + 5 + 7 - 10 + 13 + 1) - TX_DEFAULT_FEE);
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, MK_TEST_COINS(40 + 5 + 7 - 10 + 13 + 1) - TX_DEFAULT_FEE));
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME(alice_wlt, MK_TEST_COINS(40 + 5 + 7 - 10 + 13 + 1) - TESTS_DEFAULT_FEE);
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, MK_TEST_COINS(40 + 5 + 7 - 10 + 13 + 1) - TESTS_DEFAULT_FEE));
std::list<tools::wallet2::payment_details> payments;
alice_wlt->get_payments(m_payment_id, payments);
@ -1058,7 +1058,7 @@ bool gen_wallet_payment_id::generate(std::vector<test_event_entry>& events) cons
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_4a, 2);
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME_FULL(alice_wlt, MK_TEST_COINS(40 + 5 + 7 - 10 + 13 + 1 + 9) - TX_DEFAULT_FEE, 0, 0, MK_TEST_COINS(13 + 1), 0);
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME_FULL(alice_wlt, MK_TEST_COINS(40 + 5 + 7 - 10 + 13 + 1 + 9) - TESTS_DEFAULT_FEE, 0, 0, MK_TEST_COINS(13 + 1), 0);
payments.clear();
alice_wlt->get_payments(m_payment_id, payments);
CHECK_AND_ASSERT_MES(payments.size() == 3, false, "Invalid payments count (2)");
@ -1081,7 +1081,7 @@ bool gen_wallet_payment_id::c1(currency::core& c, size_t ev_index, const std::ve
CHECK_AND_ASSERT_MES(blocks_fetched == CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 3, false, "Incorrect numbers of blocks fetched");
alice_wlt->scan_tx_pool(has_alias);
if (!check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", MK_TEST_COINS(56) - TX_DEFAULT_FEE, 0, 0, 0, 0))
if (!check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", MK_TEST_COINS(56) - TESTS_DEFAULT_FEE, 0, 0, 0, 0))
return false;
std::list<tools::wallet2::payment_details> payments;
@ -1111,7 +1111,7 @@ bool gen_wallet_payment_id::c2(currency::core& c, size_t ev_index, const std::ve
CHECK_AND_ASSERT_MES(blocks_fetched == 2, false, "Incorrect numbers of blocks fetched");
alice_wlt->scan_tx_pool(has_alias);
if (!check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", MK_TEST_COINS(40 + 5 + 7 - 10 + 9 + 13 + 1) - TX_DEFAULT_FEE, 0, 0, MK_TEST_COINS(13 + 1), 0))
if (!check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", MK_TEST_COINS(40 + 5 + 7 - 10 + 9 + 13 + 1) - TESTS_DEFAULT_FEE, 0, 0, MK_TEST_COINS(13 + 1), 0))
return false;
@ -1255,8 +1255,8 @@ bool gen_wallet_transfers_and_outdated_unconfirmed_txs::generate(std::vector<tes
// make initial transfers to Alice and unlock the money
REWIND_BLOCKS_N(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 1);
MAKE_TX_FEE(events, tx_0a, miner_acc, alice_acc, MK_TEST_COINS(300), TX_DEFAULT_FEE, blk_0r);
MAKE_TX_FEE(events, tx_0b, miner_acc, alice_acc, MK_TEST_COINS(300), TX_DEFAULT_FEE, blk_0r);
MAKE_TX_FEE(events, tx_0a, miner_acc, alice_acc, MK_TEST_COINS(300), TESTS_DEFAULT_FEE, blk_0r);
MAKE_TX_FEE(events, tx_0b, miner_acc, alice_acc, MK_TEST_COINS(300), TESTS_DEFAULT_FEE, blk_0r);
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, std::list<transaction>({ tx_0a, tx_0b }));
REWIND_BLOCKS_N(events, blk_1r, blk_1, miner_acc, WALLET_DEFAULT_TX_SPENDABLE_AGE);
@ -1269,7 +1269,7 @@ bool gen_wallet_transfers_and_outdated_unconfirmed_txs::generate(std::vector<tes
CHECK_AND_ASSERT_MES(trs.size() == 2 && !trs[0].is_spent() && !trs[1].is_spent(), false, "Wrong transfers state");
// make a tx from outside the wallet, so wallet can't mark used indices
MAKE_TX_FEE(events, tx_3, alice_acc, miner_acc, MK_TEST_COINS(290), TX_DEFAULT_FEE, blk_1r);
MAKE_TX_FEE(events, tx_3, alice_acc, miner_acc, MK_TEST_COINS(290), TESTS_DEFAULT_FEE, blk_1r);
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_1r, 0);
alice_wlt->get_transfers(trs);
CHECK_AND_ASSERT_MES(trs.size() == 2 && (trs[0].is_spent() ^ trs[1].is_spent()), false, "Wrong transfers state");
@ -1346,7 +1346,7 @@ bool gen_wallet_transfers_and_chain_switch::generate(std::vector<test_event_entr
CHECK_AND_ASSERT_MES(trs.size() == 2 && !trs[0].is_spent() && !trs[1].is_spent(), false, "Wrong transfers state");
// make a tx from outside the wallet, so wallet can't mark used indices
MAKE_TX(events, tx_1, alice_acc, miner_acc, MK_TEST_COINS(30) - TX_DEFAULT_FEE, blk_1r);
MAKE_TX(events, tx_1, alice_acc, miner_acc, MK_TEST_COINS(30) - TESTS_DEFAULT_FEE, blk_1r);
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1r, miner_acc, tx_1);
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_2, 1);
@ -1354,7 +1354,7 @@ bool gen_wallet_transfers_and_chain_switch::generate(std::vector<test_event_entr
CHECK_AND_ASSERT_MES(trs.size() == 2 && (trs[0].is_spent() ^ trs[1].is_spent()), false, "Wrong transfers state");
// make a tx via the wallet, so used selected_indicies is populated for associated transfer
MAKE_TEST_WALLET_TX(events, tx_2, alice_wlt, MK_TEST_COINS(30) - TX_DEFAULT_FEE, miner_acc);
MAKE_TEST_WALLET_TX(events, tx_2, alice_wlt, MK_TEST_COINS(30) - TESTS_DEFAULT_FEE, miner_acc);
MAKE_NEXT_BLOCK_TX1(events, blk_3, blk_2, miner_acc, tx_2);
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_3, 1);
@ -1589,9 +1589,9 @@ bool gen_wallet_alias_and_unconfirmed_txs::generate(std::vector<test_event_entry
extra_alias_entry ai = AUTO_VAL_INIT(ai);
ai.m_alias = "alicealice";
ai.m_address = alice_acc.get_public_address();
MAKE_TX_FEE_MIX_ATTR_EXTRA(events, tx_alice_alias, miner_acc, null_account, get_alias_coast_from_fee(ai.m_alias, TX_DEFAULT_FEE), TX_DEFAULT_FEE, 0, blk_0r, 0, std::vector<currency::extra_v>({ ai }), true);
MAKE_TX_FEE_MIX_ATTR_EXTRA(events, tx_alice_alias, miner_acc, null_account, get_alias_coast_from_fee(ai.m_alias, TESTS_DEFAULT_FEE), TESTS_DEFAULT_FEE, 0, blk_0r, 0, std::vector<currency::extra_v>({ ai }), true);
uint64_t amount = get_alias_coast_from_fee(std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'a'), TX_DEFAULT_FEE);
uint64_t amount = get_alias_coast_from_fee(std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'a'), TESTS_DEFAULT_FEE);
MAKE_TX(events, tx_0, miner_acc, alice_acc, amount, blk_0r);
MAKE_TX(events, tx_1, miner_acc, alice_acc, amount, blk_0r);
MAKE_TX(events, tx_2, miner_acc, bob_acc, amount, blk_0r);
@ -1624,7 +1624,7 @@ bool gen_wallet_alias_and_unconfirmed_txs::c1(currency::core& c, size_t ev_index
ai.m_address = m_accounts[BOB_ACC_IDX].get_public_address();
ai.m_view_key.push_back(m_accounts[BOB_ACC_IDX].get_keys().m_view_secret_key);
uint64_t alias_reward = get_alias_coast_from_fee(ai.m_alias, TX_DEFAULT_FEE);
uint64_t alias_reward = get_alias_coast_from_fee(ai.m_alias, TESTS_DEFAULT_FEE);
bool r = check_balance_via_wallet(*bob_wlt.get(), "bob_wlt", alias_reward * 2);
CHECK_AND_ASSERT_MES(r, false, "Incorrect wallet balance");
@ -1661,7 +1661,7 @@ bool gen_wallet_alias_and_unconfirmed_txs::c2(currency::core& c, size_t ev_index
ai.m_address = someone.get_public_address();
ai.m_view_key.push_back(someone.get_keys().m_view_secret_key);
uint64_t alias_reward = get_alias_coast_from_fee(ai.m_alias, TX_DEFAULT_FEE);
uint64_t alias_reward = get_alias_coast_from_fee(ai.m_alias, TESTS_DEFAULT_FEE);
bool r = check_balance_via_wallet(*bob_wlt.get(), "bob_wlt", alias_reward * 2);
CHECK_AND_ASSERT_MES(r, false, "Incorrect wallet balance");
@ -1737,10 +1737,10 @@ bool gen_wallet_alias_via_special_wallet_funcs::generate(std::vector<test_event_
REWIND_BLOCKS_N(events, blk_0r, blk_00, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
uint64_t biggest_alias_reward = get_alias_coast_from_fee("a", TX_DEFAULT_FEE);
MAKE_TX(events, tx_0, miner_acc, alice_acc, biggest_alias_reward + TX_DEFAULT_FEE, blk_0r);
MAKE_TX(events, tx_1, miner_acc, alice_acc, biggest_alias_reward + TX_DEFAULT_FEE, blk_0r);
MAKE_TX(events, tx_2, miner_acc, alice_acc, biggest_alias_reward + TX_DEFAULT_FEE, blk_0r);
uint64_t biggest_alias_reward = get_alias_coast_from_fee("a", TESTS_DEFAULT_FEE);
MAKE_TX(events, tx_0, miner_acc, alice_acc, biggest_alias_reward + TESTS_DEFAULT_FEE, blk_0r);
MAKE_TX(events, tx_1, miner_acc, alice_acc, biggest_alias_reward + TESTS_DEFAULT_FEE, blk_0r);
MAKE_TX(events, tx_2, miner_acc, alice_acc, biggest_alias_reward + TESTS_DEFAULT_FEE, blk_0r);
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, std::list<transaction>({ tx_0, tx_1, tx_2 }));
@ -1763,9 +1763,9 @@ bool gen_wallet_alias_via_special_wallet_funcs::c1(currency::core& c, size_t ev_
extra_alias_entry ai = AUTO_VAL_INIT(ai);
ai.m_alias = "alicealice";
ai.m_address = m_accounts[ALICE_ACC_IDX].get_public_address();
uint64_t alias_reward = get_alias_coast_from_fee(ai.m_alias, TX_DEFAULT_FEE);
uint64_t alias_reward = get_alias_coast_from_fee(ai.m_alias, TESTS_DEFAULT_FEE);
transaction res_tx = AUTO_VAL_INIT(res_tx);
alice_wlt->request_alias_registration(ai, res_tx, TX_DEFAULT_FEE, alias_reward);
alice_wlt->request_alias_registration(ai, res_tx, TESTS_DEFAULT_FEE, alias_reward);
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
@ -1775,7 +1775,7 @@ bool gen_wallet_alias_via_special_wallet_funcs::c1(currency::core& c, size_t ev_
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
CHECK_AND_ASSERT_MES(c.get_current_blockchain_size() == 2 + CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 1 + WALLET_DEFAULT_TX_SPENDABLE_AGE + 1, false, "Incorrect blockchain size");
uint64_t biggest_alias_reward = get_alias_coast_from_fee("a", TX_DEFAULT_FEE);
uint64_t biggest_alias_reward = get_alias_coast_from_fee("a", TESTS_DEFAULT_FEE);
std::shared_ptr<wlt_lambda_on_transfer2_wrapper> l(new wlt_lambda_on_transfer2_wrapper(
[biggest_alias_reward](const tools::wallet_rpc::wallet_transfer_info& wti) -> bool {
return std::count(wti.recipients_aliases.begin(), wti.recipients_aliases.end(), "minerminer") == 1 &&
@ -1786,7 +1786,7 @@ bool gen_wallet_alias_via_special_wallet_funcs::c1(currency::core& c, size_t ev_
transaction t;
std::vector<tx_destination_entry> destinations(1, tx_destination_entry(biggest_alias_reward, m_accounts[MINER_ACC_IDX].get_public_address()));
alice_wlt->transfer(destinations, 0, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), t);
alice_wlt->transfer(destinations, 0, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), t);
CHECK_AND_ASSERT_MES(l->m_result, false, "Wrong wti received via callback");
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
@ -1800,7 +1800,7 @@ bool gen_wallet_alias_via_special_wallet_funcs::c1(currency::core& c, size_t ev_
ai.m_text_comment = "Update!";
ai.m_address = m_accounts[MINER_ACC_IDX].get_public_address();
alice_wlt->request_alias_update(ai, res_tx, TX_DEFAULT_FEE, 0);
alice_wlt->request_alias_update(ai, res_tx, TESTS_DEFAULT_FEE, 0);
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
@ -1893,9 +1893,9 @@ bool gen_wallet_fake_outputs_randomness::c1(currency::core& c, size_t ev_index,
miner_wlt->set_core_proxy(m_core_proxy);
std::vector<tx_destination_entry> dest(1, tx_destination_entry(m_amount_many_outs_have - TX_DEFAULT_FEE, m_accounts[ALICE_ACC_IDX].get_public_address()));
std::vector<tx_destination_entry> dest(1, tx_destination_entry(m_amount_many_outs_have - TESTS_DEFAULT_FEE, m_accounts[ALICE_ACC_IDX].get_public_address()));
transaction tx;
miner_wlt->transfer(dest, fake_outputs_count, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tx);
miner_wlt->transfer(dest, fake_outputs_count, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tx);
std::vector<size_t> r_ins;
bool r = determine_tx_real_inputs(c, tx, m_accounts[MINER_ACC_IDX].get_keys(), r_ins);
@ -1989,9 +1989,9 @@ bool gen_wallet_fake_outputs_not_enough::c1(currency::core& c, size_t ev_index,
size_t fake_outputs_count = 3;
std::vector<tx_destination_entry> dest(1, tx_destination_entry(m_amount_no_outs_have - TX_DEFAULT_FEE, m_accounts[BOB_ACC_IDX].get_public_address()));
std::vector<tx_destination_entry> dest(1, tx_destination_entry(m_amount_no_outs_have - TESTS_DEFAULT_FEE, m_accounts[BOB_ACC_IDX].get_public_address()));
transaction tx;
alice_wlt->transfer(dest, fake_outputs_count, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tx);
alice_wlt->transfer(dest, fake_outputs_count, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tx);
std::vector<size_t> r_ins;
r = determine_tx_real_inputs(c, tx, m_accounts[ALICE_ACC_IDX].get_keys(), r_ins);
@ -2060,11 +2060,11 @@ bool gen_wallet_offers_basic::c1(currency::core& c, size_t ev_index, const std::
bc_services::offer_details_ex od1 = AUTO_VAL_INIT(od1);
fill_test_offer(od1);
od1.deal_option = "OFFER 1";
od1.fee = TX_DEFAULT_FEE;
od1.fee = TESTS_DEFAULT_FEE;
bc_services::offer_details_ex od2 = AUTO_VAL_INIT(od2);
fill_test_offer(od2);
od2.deal_option = "OFFER 2";
od2.fee = TX_DEFAULT_FEE;
od2.fee = TESTS_DEFAULT_FEE;
transaction tx_o1, tx_o2;
miner_wlt->push_offer(od1, tx_o1);
@ -2257,12 +2257,12 @@ bool gen_wallet_offers_size_limit::c1(currency::core& c, size_t ev_index, const
bc_services::offer_details_ex od_normal = AUTO_VAL_INIT(od_normal);
bool r = generate_oversized_offer(CURRENCY_MAX_TRANSACTION_BLOB_SIZE - 2048, CURRENCY_MAX_TRANSACTION_BLOB_SIZE - 1024, od_normal); // generate biggest offer but within tx size limits
CHECK_AND_ASSERT_MES(r, false, "generate_oversized_offer failed");
od_normal.fee = TX_DEFAULT_FEE;
od_normal.fee = TESTS_DEFAULT_FEE;
bc_services::offer_details_ex od_oversized = AUTO_VAL_INIT(od_oversized);
r = generate_oversized_offer(CURRENCY_MAX_TRANSACTION_BLOB_SIZE, CURRENCY_MAX_TRANSACTION_BLOB_SIZE + 1024, od_oversized);
CHECK_AND_ASSERT_MES(r, false, "generate_oversized_offer failed");
od_oversized.fee = TX_DEFAULT_FEE;
od_oversized.fee = TESTS_DEFAULT_FEE;
// switch off logging during these calls to avoid flooding
int log_level = log_space::get_set_log_detalisation_level();
@ -2369,7 +2369,7 @@ bool gen_wallet_dust_to_account::c1(currency::core& c, size_t ev_index, const st
uint64_t amount = 123.456789 * (float)DEFAULT_DUST_THRESHOLD;
miner_wlt->transfer(std::vector<tx_destination_entry>({ tx_destination_entry(amount, m_accounts[ALICE_ACC_IDX].get_public_address()) }),
0, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tools::detail::digit_split_strategy, dust_policy);
0, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tools::detail::digit_split_strategy, dust_policy);
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
@ -2492,9 +2492,9 @@ bool gen_wallet_selecting_pos_entries::c1(currency::core& c, size_t ev_index, co
std::vector<tx_destination_entry> dst({
tx_destination_entry(m_amount - 0, m_accounts[MINER_ACC_IDX].get_public_address()),
tx_destination_entry(m_amount - TX_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address())
tx_destination_entry(m_amount - TESTS_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address())
});
alice_wlt->transfer(dst, 0, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>());
alice_wlt->transfer(dst, 0, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>());
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
@ -2566,8 +2566,8 @@ bool gen_wallet_spending_coinstake_after_minting::c1(currency::core& c, size_t e
//CHECK_AND_ASSERT_MES(blocks_fetched == 1, false, "Incorrect number of blocks fetched");
//CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
alice_wlt->transfer(std::vector<tx_destination_entry>({ tx_destination_entry(m_amount - TX_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address()) }),
0, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>());
alice_wlt->transfer(std::vector<tx_destination_entry>({ tx_destination_entry(m_amount - TESTS_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address()) }),
0, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>());
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool");
@ -2611,7 +2611,7 @@ bool gen_wallet_fake_outs_while_having_too_little_own_outs::generate(std::vector
m_amount_many_outs_have = get_outs_money_amount(blk_0r.miner_tx);
MAKE_TX(events, tx_0, miner_acc, alice_acc, m_amount_many_outs_have + TX_DEFAULT_FEE, blk_0r);
MAKE_TX(events, tx_0, miner_acc, alice_acc, m_amount_many_outs_have + TESTS_DEFAULT_FEE, blk_0r);
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_0);
REWIND_BLOCKS_N_WITH_TIME(events, blk_1r, blk_1, miner_acc, WALLET_DEFAULT_TX_SPENDABLE_AGE + 6);
@ -2649,9 +2649,9 @@ bool gen_wallet_fake_outs_while_having_too_little_own_outs::c1(currency::core& c
alice_wlt->set_core_runtime_config(c.get_blockchain_storage().get_core_runtime_config());
alice_wlt->set_core_proxy(m_core_proxy);
std::vector<tx_destination_entry> dest(1, tx_destination_entry(m_amount_many_outs_have - TX_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address()));
std::vector<tx_destination_entry> dest(1, tx_destination_entry(m_amount_many_outs_have - TESTS_DEFAULT_FEE, m_accounts[MINER_ACC_IDX].get_public_address()));
transaction tx;
alice_wlt->transfer(dest, fake_outputs_count, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tx);
alice_wlt->transfer(dest, fake_outputs_count, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>(), tx);
std::vector<size_t> r_ins;
bool r = determine_tx_real_inputs(c, tx, m_accounts[ALICE_ACC_IDX].get_keys(), r_ins);
@ -2813,7 +2813,7 @@ bool premine_wallet_test::check_wallet(currency::core& c, const wchar_t* wallet_
return false;
alice_wlt->transfer(std::vector<tx_destination_entry>({ tx_destination_entry(COIN * 1, m_accounts[MINER_ACC_IDX].get_public_address()) }),
0, 0, TX_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>());
0, 0, TESTS_DEFAULT_FEE, std::vector<extra_v>(), std::vector<attachment_v>());
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Transfer was unsuccessfull.");