forked from lthn/blockchain
multiple fixes over core_tests(transition to tx_version 2)
This commit is contained in:
parent
1cf6d337d3
commit
186e1fdcf9
24 changed files with 192 additions and 157 deletions
|
|
@ -18,7 +18,8 @@ using namespace currency;
|
|||
#define FIFTH_NAME "fifth--01234567890"
|
||||
#define SIX_NAME "sixsix-double--01234567890"
|
||||
|
||||
bool put_alias_via_tx_to_list(std::vector<test_event_entry>& events,
|
||||
bool put_alias_via_tx_to_list(const currency::hard_forks_descriptor& hf,
|
||||
std::vector<test_event_entry>& events,
|
||||
std::list<currency::transaction>& tx_set,
|
||||
const block& head_block,
|
||||
const std::string& alias_name,
|
||||
|
|
@ -30,10 +31,11 @@ bool put_alias_via_tx_to_list(std::vector<test_event_entry>& events,
|
|||
ai2.m_alias = alias_name;
|
||||
ai2.m_address = alias_acc.get_keys().account_address;
|
||||
ai2.m_text_comment = "ssdss";
|
||||
return put_alias_via_tx_to_list(events, tx_set, head_block, miner_acc, ai2, generator);
|
||||
return put_alias_via_tx_to_list(hf, events, tx_set, head_block, miner_acc, ai2, generator);
|
||||
}
|
||||
|
||||
bool put_next_block_with_alias_in_tx(std::vector<test_event_entry>& events,
|
||||
bool put_next_block_with_alias_in_tx(const currency::hard_forks_descriptor& hf,
|
||||
std::vector<test_event_entry>& events,
|
||||
block& b,
|
||||
const block& head_block,
|
||||
const account_base& miner_acc,
|
||||
|
|
@ -41,7 +43,7 @@ bool put_next_block_with_alias_in_tx(std::vector<test_event_entry>& events,
|
|||
test_generator& generator)
|
||||
{
|
||||
std::list<currency::transaction> txs_0;
|
||||
if (!put_alias_via_tx_to_list(events, txs_0, head_block, miner_acc, ai, generator))
|
||||
if (!put_alias_via_tx_to_list(hf, events, txs_0, head_block, miner_acc, ai, generator))
|
||||
return false;
|
||||
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk, head_block, miner_acc, txs_0);
|
||||
|
|
@ -50,7 +52,7 @@ bool put_next_block_with_alias_in_tx(std::vector<test_event_entry>& events,
|
|||
}
|
||||
|
||||
|
||||
bool put_next_block_with_alias_in_tx(std::vector<test_event_entry>& events,
|
||||
bool put_next_block_with_alias_in_tx(const currency::hard_forks_descriptor& hf, std::vector<test_event_entry>& events,
|
||||
block& b,
|
||||
const block& head_block,
|
||||
const std::string& alias_name,
|
||||
|
|
@ -63,16 +65,16 @@ bool put_next_block_with_alias_in_tx(std::vector<test_event_entry>& events,
|
|||
ai2.m_address = alias_acc.get_keys().account_address;
|
||||
ai2.m_text_comment = "ssdss";
|
||||
|
||||
return put_next_block_with_alias_in_tx(events, b, head_block, miner_acc, ai2, generator);
|
||||
return put_next_block_with_alias_in_tx(hf, events, b, head_block, miner_acc, ai2, generator);
|
||||
}
|
||||
|
||||
#define MAKE_BLOCK_WITH_ALIAS_IN_TX(EVENTS, NAME, HEAD, ALIAS_NAME) \
|
||||
block NAME; \
|
||||
put_next_block_with_alias_in_tx(EVENTS, NAME, HEAD, ALIAS_NAME, miner_account, second_acc, generator)
|
||||
put_next_block_with_alias_in_tx(m_hardforks, EVENTS, NAME, HEAD, ALIAS_NAME, miner_account, second_acc, generator)
|
||||
|
||||
#define MAKE_BLOCK_WITH_ALIAS_INFO_IN_TX(EVENTS, NAME, HEAD, MINER_ACCOUNT, ALIAS_INFO) \
|
||||
block NAME; \
|
||||
put_next_block_with_alias_in_tx(EVENTS, NAME, HEAD, MINER_ACCOUNT, ALIAS_INFO, generator)
|
||||
put_next_block_with_alias_in_tx(m_hardforks, EVENTS, NAME, HEAD, MINER_ACCOUNT, ALIAS_INFO, generator)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -113,7 +115,7 @@ bool gen_alias_tests::generate(std::vector<test_event_entry>& events) const
|
|||
|
||||
size_t small_outs_to_transfer = MAX_ALIAS_PER_BLOCK + 10;
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0, preminer_account.get_keys(), miner_account.get_public_address(), small_outs_to_transfer * TESTS_DEFAULT_FEE * 11, small_outs_to_transfer, TESTS_DEFAULT_FEE, tx_1);
|
||||
bool r = construct_tx_with_many_outputs(m_hardforks, events, blk_0, preminer_account.get_keys(), miner_account.get_public_address(), small_outs_to_transfer * TESTS_DEFAULT_FEE * 11, small_outs_to_transfer, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1); // 2N+5
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_a, blk_0r, miner_account, tx_1); // 2N+6
|
||||
|
|
@ -164,7 +166,7 @@ bool gen_alias_tests::generate(std::vector<test_event_entry>& events) const
|
|||
CHECK_AND_ASSERT_MES(r, false, "failed to sign update_alias");
|
||||
ai_upd_fake.m_text_comment = "changed alias haha - fake"; // changed text, signature became wrong
|
||||
std::list<currency::transaction> tx_list;
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_6, miner_account, ai_upd_fake, generator); // 4N+24
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_6, miner_account, ai_upd_fake, generator); // 4N+24
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list");
|
||||
DO_CALLBACK(events, "mark_invalid_block"); // 4N+25
|
||||
// EXPECTED: blk_7 is rejected as containing incorrect tx (wrong alias sig)
|
||||
|
|
@ -174,7 +176,7 @@ bool gen_alias_tests::generate(std::vector<test_event_entry>& events) const
|
|||
account_base someone;
|
||||
someone.generate();
|
||||
block blk_8;
|
||||
r = put_next_block_with_alias_in_tx(events, blk_8, blk_6, THIRD_ALIAS_NAME, miner_account, someone, generator); // 4N+28,4N+29
|
||||
r = put_next_block_with_alias_in_tx(m_hardforks, events, blk_8, blk_6, THIRD_ALIAS_NAME, miner_account, someone, generator); // 4N+28,4N+29
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_next_block_with_alias_in_tx failed");
|
||||
|
||||
MAKE_NEXT_BLOCK(events, blk_9, blk_8, miner_account); // 4N+30
|
||||
|
|
@ -187,7 +189,7 @@ bool gen_alias_tests::generate(std::vector<test_event_entry>& events) const
|
|||
tx_list.clear();
|
||||
DO_CALLBACK(events, "mark_invalid_tx"); // 4N+32
|
||||
// EXPECTED: tx is rejected, because alias is already registered
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_9, miner_account, ai, generator); // 4N+33
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_9, miner_account, ai, generator); // 4N+33
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list");
|
||||
DO_CALLBACK(events, "check_alias_not_changed"); // 4N+34
|
||||
|
||||
|
|
@ -196,11 +198,11 @@ bool gen_alias_tests::generate(std::vector<test_event_entry>& events) const
|
|||
//check notmal tx in tx pool
|
||||
MAKE_TX_LIST_START(events, txs_0, miner_account, miner_account, MK_TEST_COINS(1), blk_9); // 4N+36
|
||||
|
||||
if (!put_alias_via_tx_to_list(events, txs_0, blk_9, FOURTH_NAME, miner_account, miner_account, generator)) // 4N+37
|
||||
if (!put_alias_via_tx_to_list(m_hardforks, events, txs_0, blk_9, FOURTH_NAME, miner_account, miner_account, generator)) // 4N+37
|
||||
return false;
|
||||
|
||||
someone.generate();
|
||||
if (!put_alias_via_tx_to_list(events, txs_0, blk_9, FIFTH_NAME, miner_account, someone, generator)) // 4N+38
|
||||
if (!put_alias_via_tx_to_list(m_hardforks, events, txs_0, blk_9, FIFTH_NAME, miner_account, someone, generator)) // 4N+38
|
||||
return false;
|
||||
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_13, blk_9, miner_account, txs_0); // 4N+39
|
||||
|
|
@ -210,11 +212,11 @@ bool gen_alias_tests::generate(std::vector<test_event_entry>& events) const
|
|||
MAKE_TX_LIST_START(events, txs_2, miner_account, miner_account, MK_TEST_COINS(1), blk_13); // 4N+41
|
||||
|
||||
someone.generate();
|
||||
if (!put_alias_via_tx_to_list(events, txs_2, blk_13, SIX_NAME, miner_account, someone, generator)) // 4N+42
|
||||
if (!put_alias_via_tx_to_list(m_hardforks, events, txs_2, blk_13, SIX_NAME, miner_account, someone, generator)) // 4N+42
|
||||
return false;
|
||||
DO_CALLBACK(events, "mark_invalid_tx"); // 4N+43
|
||||
// EXPECTED: the next tx is rejected, because alias is already registered
|
||||
if (!put_alias_via_tx_to_list(events, txs_2, blk_13, SIX_NAME, miner_account, miner_account, generator)) // 4N+44
|
||||
if (!put_alias_via_tx_to_list(m_hardforks, events, txs_2, blk_13, SIX_NAME, miner_account, miner_account, generator)) // 4N+44
|
||||
return false;
|
||||
|
||||
DO_CALLBACK(events, "mark_invalid_block"); // 4N+45
|
||||
|
|
@ -400,7 +402,7 @@ bool gen_alias_strange_data::generate(std::vector<test_event_entry>& events) con
|
|||
ai.m_alias = std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'a');
|
||||
ai.m_text_comment = "";
|
||||
ai.m_address = m_alice.get_public_address();
|
||||
bool r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
bool r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, tx_list);
|
||||
|
||||
|
|
@ -424,7 +426,7 @@ bool gen_alias_strange_data::generate(std::vector<test_event_entry>& events) con
|
|||
ai.m_text_comment = std::string(255, 'c');
|
||||
ai.m_address = m_alice.get_public_address();
|
||||
ai.m_view_key.push_back(m_alice.get_keys().view_secret_key);
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_3, blk_2, miner_acc, tx_list);
|
||||
|
||||
|
|
@ -432,7 +434,7 @@ bool gen_alias_strange_data::generate(std::vector<test_event_entry>& events) con
|
|||
ai.m_text_comment = std::string(255, '\0');
|
||||
r = sign_extra_alias_entry(ai, m_alice.get_public_address().spend_public_key, m_alice.get_keys().spend_secret_key);
|
||||
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_4, blk_3, miner_acc, tx_list);
|
||||
|
||||
|
|
@ -477,14 +479,14 @@ bool gen_alias_concurrency_with_switch::generate(std::vector<test_event_entry>&
|
|||
ai.m_address = miner_acc.get_public_address();
|
||||
//ai.m_address = *reinterpret_cast<currency::account_public_address*>(invalid_addr);
|
||||
ai.m_view_key.push_back(miner_acc.get_keys().view_secret_key);
|
||||
bool r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
bool r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
// 2nd
|
||||
std::list<currency::transaction> tx_list2;
|
||||
ai.m_address.spend_public_key = null_pkey, ai.m_address.view_public_key = null_pkey;
|
||||
DO_CALLBACK(events, "mark_invalid_tx"); // because tx with a duplicate alias request (?)
|
||||
r = put_alias_via_tx_to_list(events, tx_list2, blk_0r, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list2, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
// 0 .. 10 11 12 <- height
|
||||
|
|
@ -539,14 +541,14 @@ bool gen_alias_same_alias_in_tx_pool::generate(std::vector<test_event_entry>& ev
|
|||
ai.m_alias = std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'a');
|
||||
ai.m_address = miner_acc.get_public_address();
|
||||
ai.m_view_key.push_back(miner_acc.get_keys().view_secret_key);
|
||||
bool r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
bool r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
ai.m_address.spend_public_key = null_pkey, ai.m_address.view_public_key = null_pkey;
|
||||
r = sign_extra_alias_entry(ai, miner_acc.get_public_address().spend_public_key, miner_acc.get_keys().spend_secret_key);
|
||||
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
|
||||
DO_CALLBACK(events, "mark_invalid_tx"); // because tx with a duplicate alias request
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
tx_list.pop_back(); // 'cause it's invalid
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
|
|
@ -559,14 +561,14 @@ bool gen_alias_same_alias_in_tx_pool::generate(std::vector<test_event_entry>& ev
|
|||
ai.m_address.spend_public_key = miner_acc.get_public_address().spend_public_key;
|
||||
r = sign_extra_alias_entry(ai, miner_acc.get_public_address().spend_public_key, miner_acc.get_keys().spend_secret_key);
|
||||
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
ai.m_text_comment = "Oops, I forgot a comment!";
|
||||
r = sign_extra_alias_entry(ai, miner_acc.get_public_address().spend_public_key, miner_acc.get_keys().spend_secret_key);
|
||||
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
|
||||
DO_CALLBACK(events, "mark_invalid_tx"); // because tx with a duplicate alias request
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
tx_list.pop_back(); // 'cause it's invalid
|
||||
|
||||
|
|
@ -615,7 +617,7 @@ bool gen_alias_switch_and_tx_pool::generate(std::vector<test_event_entry>& event
|
|||
ai.m_alias = std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'a');
|
||||
ai.m_address = miner_acc.get_public_address();
|
||||
ai.m_view_key.push_back(miner_acc.get_keys().view_secret_key);
|
||||
bool r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
bool r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
// add a block to clear the tx pool
|
||||
|
|
@ -627,7 +629,7 @@ bool gen_alias_switch_and_tx_pool::generate(std::vector<test_event_entry>& event
|
|||
ai.m_address.spend_public_key = null_pkey, ai.m_address.view_public_key = null_pkey;
|
||||
r = sign_extra_alias_entry(ai, miner_acc.get_public_address().spend_public_key, miner_acc.get_keys().spend_secret_key);
|
||||
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
// add one more block to bring the tx to life (i.e. blockchain)
|
||||
|
|
@ -645,7 +647,7 @@ bool gen_alias_switch_and_tx_pool::generate(std::vector<test_event_entry>& event
|
|||
ai.m_address = alice.get_public_address();
|
||||
ai.m_view_key.push_back(alice.get_keys().view_secret_key);
|
||||
DO_CALLBACK(events, "mark_invalid_tx"); // tx is rejected, because tx pool already has tx with reg/upd this alias
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_4, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_4, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
|
||||
|
|
@ -692,7 +694,7 @@ bool gen_alias_update_after_addr_changed::generate(std::vector<test_event_entry>
|
|||
currency::extra_alias_entry ai = AUTO_VAL_INIT(ai);
|
||||
ai.m_alias = std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'a');
|
||||
ai.m_address = miner_acc.get_public_address();
|
||||
bool r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
bool r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, tx_list);
|
||||
|
|
@ -703,7 +705,7 @@ bool gen_alias_update_after_addr_changed::generate(std::vector<test_event_entry>
|
|||
ai.m_address = alice.get_public_address();
|
||||
r = sign_extra_alias_entry(ai, miner_acc.get_public_address().spend_public_key, miner_acc.get_keys().spend_secret_key);
|
||||
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_1, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_1, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_2, blk_1, miner_acc, tx_list);
|
||||
|
|
@ -713,7 +715,7 @@ bool gen_alias_update_after_addr_changed::generate(std::vector<test_event_entry>
|
|||
ai.m_text_comment = "upd2";
|
||||
r = sign_extra_alias_entry(ai, miner_acc.get_public_address().spend_public_key, miner_acc.get_keys().spend_secret_key);
|
||||
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_2, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_2, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
// the next block will be rejected as invalid, as cantaining tx with invalid alias sign
|
||||
DO_CALLBACK(events, "mark_invalid_block");
|
||||
|
|
@ -728,7 +730,7 @@ bool gen_alias_update_after_addr_changed::generate(std::vector<test_event_entry>
|
|||
ai.m_address = miner_acc.get_public_address();
|
||||
r = sign_extra_alias_entry(ai, alice.get_public_address().spend_public_key, alice.get_keys().spend_secret_key);
|
||||
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_2, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_2, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_3, blk_2, miner_acc, tx_list);
|
||||
|
|
@ -738,7 +740,7 @@ bool gen_alias_update_after_addr_changed::generate(std::vector<test_event_entry>
|
|||
ai.m_text_comment = "upd3";
|
||||
r = sign_extra_alias_entry(ai, alice.get_public_address().spend_public_key, alice.get_keys().spend_secret_key);
|
||||
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_3, miner_acc, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_3, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
// the next block will be rejected as invalid, as cantaining tx with invalid alias sign
|
||||
DO_CALLBACK(events, "mark_invalid_block");
|
||||
|
|
@ -786,7 +788,7 @@ bool gen_alias_blocking_reg_by_invalid_tx::generate(std::vector<test_event_entry
|
|||
ai = AUTO_VAL_INIT(ai);
|
||||
ai.m_alias = "sweet.name";
|
||||
ai.m_address = alice.get_public_address();
|
||||
bool r = put_alias_via_tx_to_list(events, tx_list, blk_1, alice, ai, generator);
|
||||
bool r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_1, alice, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_2, blk_1, miner_acc, tx_list);
|
||||
tx_list.clear();
|
||||
|
|
@ -824,7 +826,7 @@ bool gen_alias_blocking_update_by_invalid_tx::generate(std::vector<test_event_en
|
|||
extra_alias_entry ai = AUTO_VAL_INIT(ai);
|
||||
ai.m_alias = "sweet.name";
|
||||
ai.m_address = alice.get_public_address();
|
||||
bool r = put_alias_via_tx_to_list(events, tx_list, blk_1, alice, ai, generator);
|
||||
bool r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_1, alice, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_2, blk_1, miner_acc, tx_list);
|
||||
tx_list.clear();
|
||||
|
|
@ -834,7 +836,7 @@ bool gen_alias_blocking_update_by_invalid_tx::generate(std::vector<test_event_en
|
|||
ai.m_alias = "sweet.name";
|
||||
ai.m_address = attacker.get_public_address();
|
||||
ai.m_sign.push_back(invalid_signature);
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_2, attacker, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_2, attacker, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
|
||||
// Obviously, miner can't add it to his next block, because it turns out to be invalid.
|
||||
|
|
@ -850,7 +852,7 @@ bool gen_alias_blocking_update_by_invalid_tx::generate(std::vector<test_event_en
|
|||
ai.m_text_comment = "alice@mail.com";
|
||||
r = sign_extra_alias_entry(ai, alice.get_public_address().spend_public_key, alice.get_keys().spend_secret_key);
|
||||
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
|
||||
r = put_alias_via_tx_to_list(events, tx_list, blk_2, alice, ai, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_2, alice, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_3, blk_2, miner_acc, tx_list);
|
||||
tx_list.clear();
|
||||
|
|
@ -1026,7 +1028,7 @@ bool gen_alias_too_small_reward::generate(std::vector<test_event_entry>& events)
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), miner_acc.get_public_address(), 3 * aliases_count * TESTS_DEFAULT_FEE * 100, 3 * aliases_count, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), miner_acc.get_public_address(), 3 * aliases_count * TESTS_DEFAULT_FEE * 100, 3 * aliases_count, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_1);
|
||||
|
|
@ -1111,9 +1113,9 @@ bool gen_alias_too_small_reward::make_tx_reg_alias(std::vector<test_event_entry>
|
|||
if (sources_amount > alias_reward + TESTS_DEFAULT_FEE)
|
||||
destinations.push_back(tx_destination_entry(sources_amount - (alias_reward + TESTS_DEFAULT_FEE), miner_acc.get_public_address())); // change
|
||||
|
||||
crypto::secret_key stub;
|
||||
crypto::secret_key stub = AUTO_VAL_INIT(stub);
|
||||
uint64_t tx_version = get_tx_version(get_block_height(prev_block), m_hardforks);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx, tx_version, stub, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx, tx_version, stub, uint64_t(0));
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx);
|
||||
|
||||
|
|
@ -1222,7 +1224,7 @@ bool gen_alias_switch_and_check_block_template::generate(std::vector<test_event_
|
|||
extra_alias_entry ai = AUTO_VAL_INIT(ai);
|
||||
ai.m_alias = std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'x');
|
||||
ai.m_address = alice.get_public_address();
|
||||
bool r = put_alias_via_tx_to_list(events, tx_list, blk_1, alice, ai, generator); // 2N+5
|
||||
bool r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_1, alice, ai, generator); // 2N+5
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_2, blk_1, miner_acc, tx_list); // 2N+6
|
||||
tx_list.clear();
|
||||
|
|
@ -1407,7 +1409,7 @@ bool gen_alias_update_for_free::generate(std::vector<test_event_entry>& events)
|
|||
extra_alias_entry ai = AUTO_VAL_INIT(ai);
|
||||
ai.m_alias = std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'a');
|
||||
ai.m_address = miner_acc.get_public_address();
|
||||
bool r = put_alias_via_tx_to_list(events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
bool r = put_alias_via_tx_to_list(m_hardforks, events, tx_list, blk_0r, miner_acc, ai, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, tx_list);
|
||||
tx_list.clear();
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ class gen_block_verification_base : public test_chain_unit_base
|
|||
public:
|
||||
gen_block_verification_base()
|
||||
{
|
||||
m_hardforks.hard_fork_01_starts_after_height = 0;
|
||||
m_hardforks.hard_fork_02_starts_after_height = 0;
|
||||
m_hardforks.hard_fork_03_starts_after_height = 0;
|
||||
m_hardforks.hard_fork_04_starts_after_height = 0;
|
||||
|
||||
REGISTER_CALLBACK("check_block_purged", gen_block_verification_base<invalid_block_idx>::check_block_purged);
|
||||
}
|
||||
|
||||
|
|
@ -33,6 +38,7 @@ public:
|
|||
|
||||
return true;
|
||||
}
|
||||
currency::hard_forks_descriptor m_hardforks;
|
||||
};
|
||||
|
||||
template<size_t expected_blockchain_height>
|
||||
|
|
|
|||
|
|
@ -646,7 +646,7 @@ bool chain_switching_when_out_spent_in_alt_chain_mixin::generate(std::vector<tes
|
|||
|
||||
// send batch of 10 x 5 test coins to Alice for easier tx_1 construction (and to generate free decoys)
|
||||
transaction tx_0;
|
||||
r = construct_tx_with_many_outputs(events, blk_1r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(50), 10,
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_1r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(50), 10,
|
||||
TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
|
@ -713,7 +713,7 @@ bool chain_switching_when_out_spent_in_alt_chain_ref_id::generate(std::vector<te
|
|||
|
||||
// send batch of 10 x 5 test coins to Alice for easier tx_0 construction
|
||||
transaction tx_0;
|
||||
r = construct_tx_with_many_outputs(events, blk_1r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(50), 10,
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_1r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(50), 10,
|
||||
TESTS_DEFAULT_FEE, tx_0, true);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
|
||||
|
|
@ -739,7 +739,7 @@ bool chain_switching_when_out_spent_in_alt_chain_ref_id::generate(std::vector<te
|
|||
std::vector<tx_destination_entry> destinations;
|
||||
destinations.push_back(tx_destination_entry(MK_TEST_COINS(4), bob_acc.get_public_address()));
|
||||
size_t nmix = 3;
|
||||
r = construct_tx_to_key(events, tx_1, blk_2a, alice_acc, destinations, TESTS_DEFAULT_FEE, nmix, 0, empty_extra, empty_attachment, true, true, true);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_1, blk_2a, alice_acc, destinations, TESTS_DEFAULT_FEE, nmix, 0, empty_extra, empty_attachment, true, true, true);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_to_key failed");
|
||||
|
||||
// make sure tx_1 really use ref_by_id
|
||||
|
|
|
|||
|
|
@ -1469,7 +1469,8 @@ bool construct_miner_tx_manually(size_t height, uint64_t already_generated_coins
|
|||
}
|
||||
|
||||
|
||||
bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
||||
bool construct_tx_to_key(const currency::hard_forks_descriptor& hf,
|
||||
const std::vector<test_event_entry>& events,
|
||||
currency::transaction& tx,
|
||||
const block& blk_head,
|
||||
const currency::account_base& from,
|
||||
|
|
@ -1484,8 +1485,9 @@ bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
|||
bool check_for_unlocktime)
|
||||
{
|
||||
crypto::secret_key sk = AUTO_VAL_INIT(sk);
|
||||
return construct_tx_to_key(events,
|
||||
tx,
|
||||
return construct_tx_to_key(hf,
|
||||
events,
|
||||
tx,
|
||||
blk_head,
|
||||
from,
|
||||
to,
|
||||
|
|
@ -1500,7 +1502,8 @@ bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
|||
check_for_unlocktime);
|
||||
}
|
||||
|
||||
bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
||||
bool construct_tx_to_key(const currency::hard_forks_descriptor& hf,
|
||||
const std::vector<test_event_entry>& events,
|
||||
currency::transaction& tx,
|
||||
const block& blk_head,
|
||||
const currency::account_base& from,
|
||||
|
|
@ -1519,11 +1522,12 @@ bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
|||
std::vector<tx_destination_entry> destinations;
|
||||
if (!fill_tx_sources_and_destinations(events, blk_head, from.get_keys(), to.get_public_address(), amount, fee, nmix, sources, destinations, check_for_spends, check_for_unlocktime))
|
||||
return false;
|
||||
uint64_t tx_version = currency::get_tx_version(get_block_height(blk_head), m_hardforks);
|
||||
return construct_tx(from.get_keys(), sources, destinations, extr, att, tx, sk, 0, mix_attr);
|
||||
uint64_t tx_version = currency::get_tx_version(get_block_height(blk_head), hf);
|
||||
return construct_tx(from.get_keys(), sources, destinations, extr, att, tx, tx_version, sk, 0, mix_attr);
|
||||
}
|
||||
|
||||
bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
||||
bool construct_tx_to_key(const currency::hard_forks_descriptor& hf,
|
||||
const std::vector<test_event_entry>& events,
|
||||
currency::transaction& tx,
|
||||
const currency::block& blk_head,
|
||||
const currency::account_base& from,
|
||||
|
|
@ -1546,28 +1550,29 @@ bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
|||
if (!fill_tx_sources(sources, events, blk_head, from.get_keys(), spending_amount, nmix, check_for_spends, check_for_unlocktime, use_ref_by_id))
|
||||
return false;
|
||||
|
||||
uint64_t tx_version = currency::get_tx_version(get_block_height(blk_head), hf);
|
||||
boost::multiprecision::int128_t change = get_sources_total_amount(sources);
|
||||
change -= spending_amount;
|
||||
if (change < 0)
|
||||
return false; // should never happen if fill_tx_sources succeded
|
||||
if (change == 0)
|
||||
return construct_tx(from.get_keys(), sources, destinations, extr, att, tx, sk, 0, mix_attr);
|
||||
return construct_tx(from.get_keys(), sources, destinations, extr, att, tx, tx_version, sk, 0, mix_attr);
|
||||
std::vector<tx_destination_entry> local_dst = destinations;
|
||||
local_dst.push_back(tx_destination_entry(change.convert_to<uint64_t>(), from.get_public_address()));
|
||||
return construct_tx(from.get_keys(), sources, local_dst, extr, att, tx, sk, 0, mix_attr);
|
||||
return construct_tx(from.get_keys(), sources, local_dst, extr, att, tx, tx_version, sk, 0, mix_attr);
|
||||
}
|
||||
|
||||
|
||||
transaction construct_tx_with_fee(std::vector<test_event_entry>& events, const block& blk_head,
|
||||
transaction construct_tx_with_fee(const currency::hard_forks_descriptor& hf, std::vector<test_event_entry>& events, const block& blk_head,
|
||||
const account_base& acc_from, const account_base& acc_to, uint64_t amount, uint64_t fee)
|
||||
{
|
||||
transaction tx;
|
||||
construct_tx_to_key(events, tx, blk_head, acc_from, acc_to, amount, fee, 0);
|
||||
construct_tx_to_key(hf, events, tx, blk_head, acc_from, acc_to, amount, fee, 0);
|
||||
events.push_back(tx);
|
||||
return tx;
|
||||
}
|
||||
|
||||
bool construct_tx_with_many_outputs(std::vector<test_event_entry>& events, const currency::block& blk_head,
|
||||
bool construct_tx_with_many_outputs(const currency::hard_forks_descriptor& hf, std::vector<test_event_entry>& events, const currency::block& blk_head,
|
||||
const currency::account_keys& keys_from, const currency::account_public_address& addr_to,
|
||||
uint64_t total_amount, size_t outputs_count, uint64_t fee, currency::transaction& tx, bool use_ref_by_id /* = false */)
|
||||
{
|
||||
|
|
@ -1583,8 +1588,8 @@ bool construct_tx_with_many_outputs(std::vector<test_event_entry>& events, const
|
|||
uint64_t sources_amount = get_sources_total_amount(sources);
|
||||
if (sources_amount > total_amount + fee)
|
||||
destinations.push_back(tx_destination_entry(sources_amount - (total_amount + fee), keys_from.account_address)); // change
|
||||
|
||||
return construct_tx(keys_from, sources, destinations, empty_attachment, tx, 0);
|
||||
uint64_t tx_version = currency::get_tx_version(currency::get_block_height(blk_head), hf);
|
||||
return construct_tx(keys_from, sources, destinations, empty_attachment, tx, tx_version, 0);
|
||||
}
|
||||
|
||||
uint64_t get_balance(const currency::account_keys& addr, const std::vector<currency::block>& blockchain, const map_hash2tx_t& mtx, bool dbg_log) {
|
||||
|
|
@ -2087,6 +2092,19 @@ void test_chain_unit_base::register_callback(const std::string& cb_name, verify_
|
|||
m_callbacks[cb_name] = cb;
|
||||
}
|
||||
|
||||
uint64_t test_chain_unit_base::get_tx_version_from_events(const std::vector<test_event_entry> &events)const
|
||||
{
|
||||
for (auto it = events.rbegin(); it!= events.rend(); it++)
|
||||
{
|
||||
if(it->type() == typeid(currency::block))
|
||||
{
|
||||
const currency::block& b = boost::get<currency::block>(*it);
|
||||
return currency::get_tx_version(get_block_height(b), m_hardforks);
|
||||
}
|
||||
}
|
||||
return currency::get_tx_version(0, m_hardforks);
|
||||
}
|
||||
|
||||
bool test_chain_unit_base::verify(const std::string& cb_name, currency::core& c, size_t ev_index, const std::vector<test_event_entry> &events)
|
||||
{
|
||||
auto cb_it = m_callbacks.find(cb_name);
|
||||
|
|
|
|||
|
|
@ -234,9 +234,11 @@ public:
|
|||
|
||||
bool need_core_proxy() const { return false; } // tests can override this in order to obtain core proxy (e.g. for wallet)
|
||||
void set_core_proxy(std::shared_ptr<tools::i_core_proxy>) { /* do nothing */ }
|
||||
|
||||
uint64_t get_tx_version_from_events(const std::vector<test_event_entry> &events) const;
|
||||
private:
|
||||
callbacks_map m_callbacks;
|
||||
protected:
|
||||
currency::hard_forks_descriptor m_hardforks;
|
||||
};
|
||||
|
||||
struct offers_count_param
|
||||
|
|
@ -310,6 +312,8 @@ public:
|
|||
bool check_offers_count(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
|
||||
bool check_hardfork_active(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
struct params_top_block
|
||||
{
|
||||
|
|
@ -324,7 +328,7 @@ protected:
|
|||
size_t m_orphan_block_index;
|
||||
|
||||
// the following members is intended to be set by coretests with specific HF-related needs
|
||||
currency::hard_forks_descriptor m_hardforks;
|
||||
//currency::hard_forks_descriptor m_hardforks;
|
||||
};
|
||||
|
||||
struct wallet_test_core_proxy;
|
||||
|
|
@ -553,7 +557,8 @@ bool construct_miner_tx_manually(size_t height, uint64_t already_generated_coins
|
|||
const currency::account_public_address& miner_address, currency::transaction& tx,
|
||||
uint64_t fee, currency::keypair* p_txkey = 0);
|
||||
|
||||
bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
||||
bool construct_tx_to_key(const currency::hard_forks_descriptor& hf,
|
||||
const std::vector<test_event_entry>& events,
|
||||
currency::transaction& tx,
|
||||
const currency::block& blk_head,
|
||||
const currency::account_base& from,
|
||||
|
|
@ -568,7 +573,8 @@ bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
|||
bool check_for_unlocktime = true);
|
||||
|
||||
|
||||
bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
||||
bool construct_tx_to_key(const currency::hard_forks_descriptor& hf,
|
||||
const std::vector<test_event_entry>& events,
|
||||
currency::transaction& tx,
|
||||
const currency::block& blk_head,
|
||||
const currency::account_base& from,
|
||||
|
|
@ -583,7 +589,8 @@ bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
|||
bool check_for_spends = true,
|
||||
bool check_for_unlocktime = true);
|
||||
|
||||
bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
||||
bool construct_tx_to_key(const currency::hard_forks_descriptor& hf,
|
||||
const std::vector<test_event_entry>& events,
|
||||
currency::transaction& tx,
|
||||
const currency::block& blk_head,
|
||||
const currency::account_base& from,
|
||||
|
|
@ -597,11 +604,11 @@ bool construct_tx_to_key(const std::vector<test_event_entry>& events,
|
|||
bool check_for_unlocktime = true,
|
||||
bool use_ref_by_id = false);
|
||||
|
||||
currency::transaction construct_tx_with_fee(std::vector<test_event_entry>& events, const currency::block& blk_head,
|
||||
currency::transaction construct_tx_with_fee(const currency::hard_forks_descriptor& hf, std::vector<test_event_entry>& events, const currency::block& blk_head,
|
||||
const currency::account_base& acc_from, const currency::account_base& acc_to,
|
||||
uint64_t amount, uint64_t fee);
|
||||
|
||||
bool construct_tx_with_many_outputs(std::vector<test_event_entry>& events, const currency::block& blk_head,
|
||||
bool construct_tx_with_many_outputs(const currency::hard_forks_descriptor& hf, std::vector<test_event_entry>& events, const currency::block& blk_head,
|
||||
const currency::account_keys& keys_from, const currency::account_public_address& addr_to,
|
||||
uint64_t total_amount, size_t outputs_count, uint64_t fee, currency::transaction& tx, bool use_ref_by_id = false);
|
||||
|
||||
|
|
@ -1093,7 +1100,7 @@ void append_vector_by_another_vector(U& dst, const V& src)
|
|||
#define MAKE_TX_MIX_ATTR_EXTRA(VEC_EVENTS, TX_NAME, FROM, TO, AMOUNT, NMIX, HEAD, MIX_ATTR, EXTRA, CHECK_SPENDS) \
|
||||
currency::transaction TX_NAME; \
|
||||
{ \
|
||||
bool txr = construct_tx_to_key(VEC_EVENTS, TX_NAME, HEAD, FROM, TO, AMOUNT, TESTS_DEFAULT_FEE, NMIX, generator.last_tx_generated_secret_key, MIX_ATTR, EXTRA, std::vector<currency::attachment_v>(), CHECK_SPENDS); \
|
||||
bool txr = construct_tx_to_key(m_hardforks, VEC_EVENTS, TX_NAME, HEAD, FROM, TO, AMOUNT, TESTS_DEFAULT_FEE, NMIX, generator.last_tx_generated_secret_key, MIX_ATTR, EXTRA, std::vector<currency::attachment_v>(), CHECK_SPENDS); \
|
||||
CHECK_AND_ASSERT_THROW_MES(txr, "failed to construct transaction"); \
|
||||
} \
|
||||
VEC_EVENTS.push_back(TX_NAME); \
|
||||
|
|
@ -1102,7 +1109,7 @@ void append_vector_by_another_vector(U& dst, const V& src)
|
|||
#define MAKE_TX_FEE_MIX_ATTR_EXTRA(VEC_EVENTS, TX_NAME, FROM, TO, AMOUNT, FEE, NMIX, HEAD, MIX_ATTR, EXTRA, CHECK_SPENDS) \
|
||||
currency::transaction TX_NAME; \
|
||||
{ \
|
||||
bool txr = construct_tx_to_key(VEC_EVENTS, TX_NAME, HEAD, FROM, TO, AMOUNT, FEE, NMIX, generator.last_tx_generated_secret_key, MIX_ATTR, EXTRA, std::vector<currency::attachment_v>(), CHECK_SPENDS); \
|
||||
bool txr = construct_tx_to_key(m_hardforks, VEC_EVENTS, TX_NAME, HEAD, FROM, TO, AMOUNT, FEE, NMIX, generator.last_tx_generated_secret_key, MIX_ATTR, EXTRA, std::vector<currency::attachment_v>(), CHECK_SPENDS); \
|
||||
CHECK_AND_ASSERT_THROW_MES(txr, "failed to construct transaction"); \
|
||||
} \
|
||||
VEC_EVENTS.push_back(TX_NAME); \
|
||||
|
|
@ -1126,7 +1133,7 @@ void append_vector_by_another_vector(U& dst, const V& src)
|
|||
#define MAKE_TX_MIX_LIST_EXTRA_MIX_ATTR(VEC_EVENTS, SET_NAME, FROM, TO, AMOUNT, NMIX, HEAD, MIX_ATTR, EXTRA, ATTACH) \
|
||||
{ \
|
||||
currency::transaction t; \
|
||||
bool r = construct_tx_to_key(VEC_EVENTS, t, HEAD, FROM, TO, AMOUNT, TESTS_DEFAULT_FEE, NMIX, generator.last_tx_generated_secret_key, MIX_ATTR, EXTRA, ATTACH); \
|
||||
bool r = construct_tx_to_key(m_hardforks, VEC_EVENTS, t, HEAD, FROM, TO, AMOUNT, TESTS_DEFAULT_FEE, NMIX, generator.last_tx_generated_secret_key, MIX_ATTR, EXTRA, ATTACH); \
|
||||
if (!r) { LOG_PRINT_YELLOW("ERROR in tx @ EVENT #" << VEC_EVENTS.size(), LOG_LEVEL_0); } \
|
||||
CHECK_AND_ASSERT_THROW_MES(r, "failed to construct transaction"); \
|
||||
SET_NAME.push_back(t); \
|
||||
|
|
@ -1157,7 +1164,7 @@ void append_vector_by_another_vector(U& dst, const V& src)
|
|||
|
||||
#define MAKE_TX_ATTACH_FEE(EVENTS, TX_VAR, FROM, TO, AMOUNT, FEE, HEAD, ATTACH) \
|
||||
currency::transaction TX_VAR = AUTO_VAL_INIT(TX_VAR); \
|
||||
CHECK_AND_ASSERT_MES(construct_tx_to_key(EVENTS, TX_VAR, HEAD, FROM, TO, AMOUNT, FEE, 0, generator.last_tx_generated_secret_key, CURRENCY_TO_KEY_OUT_RELAXED, empty_extra, ATTACH), false, "construct_tx_to_key failed"); \
|
||||
CHECK_AND_ASSERT_MES(construct_tx_to_key(m_hardforks, EVENTS, TX_VAR, HEAD, FROM, TO, AMOUNT, FEE, 0, generator.last_tx_generated_secret_key, CURRENCY_TO_KEY_OUT_RELAXED, empty_extra, ATTACH), false, "construct_tx_to_key failed"); \
|
||||
EVENTS.push_back(TX_VAR)
|
||||
|
||||
#define MAKE_TX_ATTACH(EVENTS, TX_VAR, FROM, TO, AMOUNT, HEAD, ATTACH) MAKE_TX_ATTACH_FEE(EVENTS, TX_VAR, FROM, TO, AMOUNT, TESTS_DEFAULT_FEE, HEAD, ATTACH)
|
||||
|
|
|
|||
|
|
@ -281,13 +281,15 @@ inline std::string gen_random_alias(size_t len)
|
|||
}
|
||||
|
||||
template<typename alias_entry_t>
|
||||
inline bool put_alias_via_tx_to_list(std::vector<test_event_entry>& events,
|
||||
inline bool put_alias_via_tx_to_list(const currency::hard_forks_descriptor& hf,
|
||||
std::vector<test_event_entry>& events,
|
||||
std::list<currency::transaction>& tx_set,
|
||||
const currency::block& head_block,
|
||||
const currency::account_base& miner_acc,
|
||||
const alias_entry_t& ae,
|
||||
test_generator& generator)
|
||||
{
|
||||
const currency::hard_forks_descriptor& m_hardforks = hf; //a name to feed macro MAKE_TX_MIX_LIST_EXTRA_MIX_ATTR
|
||||
std::vector<currency::extra_v> ex;
|
||||
ex.push_back(ae);
|
||||
currency::account_base reward_acc;
|
||||
|
|
|
|||
|
|
@ -871,7 +871,7 @@ bool gen_checkpoints_and_invalid_tx_to_pool::generate(std::vector<test_event_ent
|
|||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
// invalidate tx_0 signature
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ bool gen_double_spend_in_tx<txs_kept_by_block>::generate(std::vector<test_event_
|
|||
|
||||
currency::transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
std::vector<currency::attachment_v> attachments;
|
||||
if (!construct_tx(bob_account.get_keys(), sources, destinations, attachments, tx_1, 0))
|
||||
if (!construct_tx(bob_account.get_keys(), sources, destinations, attachments, tx_1, get_tx_version_from_events(events), uint64_t(0)))
|
||||
return false;
|
||||
|
||||
SET_EVENT_VISITOR_SETT(events, event_visitor_settings::set_txs_kept_by_block, txs_kept_by_block);
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ bool pos_emission_test::generate(std::vector<test_event_entry> &events)
|
|||
destinations.push_back(tx_destination_entry(pos_entry_amount, alice_acc.get_public_address()));
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(preminer_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
|
||||
r = construct_tx(preminer_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_1);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_1);
|
||||
|
|
|
|||
|
|
@ -64,13 +64,13 @@ bool escrow_altchain_meta_impl::generate(std::vector<test_event_entry>& events)
|
|||
|
||||
// give Alice and Bob 'm_etd.alice_bob_start_amoun' coins for pocket money
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), m_etd.alice_bob_start_amount, m_etd.start_amount_outs_count, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), m_etd.alice_bob_start_amount, m_etd.start_amount_outs_count, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_1);
|
||||
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
r = construct_tx_with_many_outputs(events, blk_1, miner_acc.get_keys(), bob_acc.get_public_address(), m_etd.alice_bob_start_amount, m_etd.start_amount_outs_count, TESTS_DEFAULT_FEE, tx_2);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_1, miner_acc.get_keys(), bob_acc.get_public_address(), m_etd.alice_bob_start_amount, m_etd.start_amount_outs_count, TESTS_DEFAULT_FEE, tx_2);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_2);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_2, blk_1, miner_acc, tx_2);
|
||||
|
|
|
|||
|
|
@ -733,7 +733,7 @@ bool escrow_proposal_expiration::generate(std::vector<test_event_entry>& events)
|
|||
destinations.push_back(tx_destination_entry(amount, bob_acc.get_public_address()));
|
||||
destinations.push_back(tx_destination_entry(amount, bob_acc.get_public_address()));
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_to_key(events, tx_1, blk_0r, miner_acc, destinations);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_1, blk_0r, miner_acc, destinations);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_to_key failed");
|
||||
events.push_back(tx_1);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_1);
|
||||
|
|
@ -951,11 +951,11 @@ bool escrow_proposal_and_accept_expiration::generate(std::vector<test_event_entr
|
|||
|
||||
// send few coins to Alice and Bob
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), TESTS_DEFAULT_FEE * 50, 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), TESTS_DEFAULT_FEE * 50, 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), TESTS_DEFAULT_FEE * 50, 10, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), TESTS_DEFAULT_FEE * 50, 10, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, std::list<transaction>({ tx_0, tx_1 }));
|
||||
|
|
@ -1126,7 +1126,7 @@ bool escrow_incorrect_proposal_acceptance::generate(std::vector<test_event_entry
|
|||
destinations.push_back(tx_destination_entry(big_chunk_amount, bob_acc.get_public_address()));
|
||||
destinations.push_back(tx_destination_entry(big_chunk_amount, bob_acc.get_public_address()));
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_to_key(events, tx_1, blk_0r, miner_acc, destinations);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_1, blk_0r, miner_acc, destinations);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_to_key failed");
|
||||
events.push_back(tx_1);
|
||||
m_alice_bob_start_amount = big_chunk_amount * 2;
|
||||
|
|
@ -1207,7 +1207,7 @@ bool escrow_incorrect_proposal_acceptance::generate(std::vector<test_event_entry
|
|||
for(size_t i = 0; i < 15; ++i)
|
||||
destinations.push_back(tx_destination_entry(m_cpd.amount_b_pledge + m_bob_fee_release + bob_fee_acceptance, bob_acc.get_public_address()));
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
r = construct_tx_to_key(events, tx_2, blk_7c, miner_acc, destinations);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_2, blk_7c, miner_acc, destinations);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_to_key failed");
|
||||
events.push_back(tx_2);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_8c, blk_7c, miner_acc, tx_2);
|
||||
|
|
@ -1495,7 +1495,7 @@ bool escrow_custom_test::generate(std::vector<test_event_entry>& events) const
|
|||
}
|
||||
// no change back to the miner - it will become a fee
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
events.push_back(tx_1);
|
||||
|
|
@ -1948,7 +1948,7 @@ bool escrow_incorrect_cancel_proposal::generate(std::vector<test_event_entry>& e
|
|||
}
|
||||
// no change back to the miner - it will become a fee
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
events.push_back(tx_1);
|
||||
|
|
@ -2346,12 +2346,12 @@ bool escrow_cancellation_and_tx_order::generate(std::vector<test_event_entry>& e
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
bool r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -2546,12 +2546,12 @@ bool escrow_cancellation_proposal_expiration::generate(std::vector<test_event_en
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
bool r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -2793,12 +2793,12 @@ bool escrow_cancellation_acceptance_expiration::generate(std::vector<test_event_
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(100), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
bool r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(100), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(100), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(100), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -2960,12 +2960,12 @@ bool escrow_proposal_acceptance_in_alt_chain::generate(std::vector<test_event_en
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
bool r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -3037,12 +3037,12 @@ bool escrow_zero_amounts::generate(std::vector<test_event_entry>& events) const
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
bool r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), MK_TEST_COINS(200), 20, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -3139,12 +3139,12 @@ bool escrow_balance::generate(std::vector<test_event_entry>& events) const
|
|||
m_alice_bob_start_chunk_amount = m_alice_bob_start_amount / 10;
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), m_alice_bob_start_amount, 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
bool r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), m_alice_bob_start_amount, 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), m_alice_bob_start_amount, 10, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), m_alice_bob_start_amount, 10, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ bool random_outs_and_burnt_coins::generate(std::vector<test_event_entry>& events
|
|||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
uint64_t burned_tx_amount_total = get_burned_amount(tx_0);
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ bool hard_fork_1_unlock_time_2_in_normal_tx::generate(std::vector<test_event_ent
|
|||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
crypto::secret_key tx_sec_key;
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_0, tx_sec_key, 0 /* unlock time 1 is zero and thus will not be set */);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_0, get_tx_version_from_events(events), tx_sec_key, 0 /* unlock time 1 is zero and thus will not be set */);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
// tx_0 shouldn't be accepted
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
|
|
@ -92,7 +92,7 @@ bool hard_fork_1_unlock_time_2_in_normal_tx::generate(std::vector<test_event_ent
|
|||
|
||||
// make another tx with the same inputs and extra (tx_0 was rejected so inputs can be reused)
|
||||
transaction tx_0a = AUTO_VAL_INIT(tx_0a);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_0a, tx_sec_key, 0 /* unlock time 1 is zero and thus will not be set */);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_0a, get_tx_version_from_events(events), tx_sec_key, 0 /* unlock time 1 is zero and thus will not be set */);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
// tx_0a shouldn't be accepted as well
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
|
|
@ -132,7 +132,7 @@ bool hard_fork_1_unlock_time_2_in_normal_tx::generate(std::vector<test_event_ent
|
|||
extra.push_back(ut2);
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_1, tx_sec_key, 0 /* unlock time 1 is zero and not set */);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_1, get_tx_version_from_events(events), tx_sec_key, 0 /* unlock time 1 is zero and not set */);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ bool hard_fork_1_unlock_time_2_in_normal_tx::generate(std::vector<test_event_ent
|
|||
extra.push_back(ut2);
|
||||
|
||||
transaction tx_1a = AUTO_VAL_INIT(tx_1a);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_1a, tx_sec_key, 0 /* unlock time 1 is zero and not set */);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_1a, get_tx_version_from_events(events), tx_sec_key, 0 /* unlock time 1 is zero and not set */);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_1a);
|
||||
DO_CALLBACK_PARAMS(events, "check_tx_pool_count", static_cast<size_t>(1));
|
||||
|
|
@ -339,7 +339,7 @@ bool hard_fork_1_checkpoint_basic_test::generate(std::vector<test_event_entry>&
|
|||
extra.push_back(ut2);
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
crypto::secret_key tx_sec_key;
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_0, tx_sec_key, 0 /* unlock time 1 is zero and thus will not be set */);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, extra, empty_attachment, tx_0, get_tx_version_from_events(events), tx_sec_key, 0 /* unlock time 1 is zero and thus will not be set */);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
// tx_0 should be accepted
|
||||
events.push_back(event_visitor_settings(event_visitor_settings::set_txs_kept_by_block, true)); // tx_0 goes with blk_1_bad
|
||||
|
|
@ -433,7 +433,7 @@ bool hard_fork_1_checkpoint_basic_test::generate(std::vector<test_event_entry>&
|
|||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, std::vector<tx_destination_entry>{ tx_destination_entry(MK_TEST_COINS(90) - TESTS_DEFAULT_FEE, miner_acc.get_public_address()) },
|
||||
empty_attachment, tx_1, stake_lock_time /* try to use stake unlock time -- should not work as it is not a coinbase */);
|
||||
empty_attachment, tx_1, get_tx_version_from_events(events), stake_lock_time /* try to use stake unlock time -- should not work as it is not a coinbase */);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
|
|
@ -506,7 +506,7 @@ bool hard_fork_1_pos_and_locked_coins::generate(std::vector<test_event_entry>& e
|
|||
destinations.push_back(tx_destination_entry(unique_amount_alice, alice_acc.get_public_address()));
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx_to_key(events, tx_0, blk_0r, miner_acc, destinations, TESTS_DEFAULT_FEE, 0, 0, extra);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_0, blk_0r, miner_acc, destinations, TESTS_DEFAULT_FEE, 0, 0, extra);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
|
|
@ -523,7 +523,7 @@ bool hard_fork_1_pos_and_locked_coins::generate(std::vector<test_event_entry>& e
|
|||
ut2.unlock_time_array.push_back(ut2_unlock_time);
|
||||
extra.push_back(ut2);
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_to_key(events, tx_1, blk_0r, miner_acc, destinations, TESTS_DEFAULT_FEE, 0, 0, extra);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_1, blk_0r, miner_acc, destinations, TESTS_DEFAULT_FEE, 0, 0, extra);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
events.push_back(tx_1);
|
||||
|
|
@ -725,7 +725,7 @@ bool hard_fork_1_pos_locked_height_vs_time::generate(std::vector<test_event_entr
|
|||
destinations.push_back(tx_destination_entry(stake_amount, bob_acc.get_public_address()));
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx_to_key(events, tx_0, blk_0r, miner_acc, destinations, TESTS_DEFAULT_FEE, 0, 0, extra);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_0, blk_0r, miner_acc, destinations, TESTS_DEFAULT_FEE, 0, 0, extra);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
|
|
@ -877,7 +877,7 @@ bool hard_fork_1_pos_locked_height_vs_time::generate(std::vector<test_event_entr
|
|||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, std::vector<tx_destination_entry>{ tx_destination_entry(stake_amount / 2, miner_acc.get_public_address()) },
|
||||
empty_attachment, tx_1, stake_unlock_time /* try to use stake unlock time -- should not work as it is not a coinbase */);
|
||||
empty_attachment, tx_1, get_tx_version_from_events(events), stake_unlock_time /* try to use stake unlock time -- should not work as it is not a coinbase */);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ bool hard_fork_1_locked_mining_test::generate(std::vector<test_event_entry>& eve
|
|||
crypto::secret_key stub;
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
uint64_t unlock_time = get_block_height(blk_0r) + 2000;
|
||||
r = construct_tx(miner_acc.get_keys(), sources_1, destinations, extra, empty_attachment, tx_1, stub, unlock_time);
|
||||
r = construct_tx(miner_acc.get_keys(), sources_1, destinations, extra, empty_attachment, tx_1, get_tx_version_from_events(events), stub, unlock_time);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_1); // push it to the pool
|
||||
|
||||
|
|
|
|||
|
|
@ -803,7 +803,7 @@ bool hard_fork_2_no_new_structures_before_hf::generate(std::vector<test_event_en
|
|||
|
||||
std::list<transaction> tx_set;
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
r = put_alias_via_tx_to_list(events, tx_set, blk_2, miner_acc, alias_entry, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_set, blk_2, miner_acc, alias_entry, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
transaction tx_2 = tx_set.front();
|
||||
|
||||
|
|
@ -818,7 +818,7 @@ bool hard_fork_2_no_new_structures_before_hf::generate(std::vector<test_event_en
|
|||
alias_entry_old.m_alias = "alicealice";
|
||||
|
||||
tx_set.clear();
|
||||
r = put_alias_via_tx_to_list(events, tx_set, blk_2, miner_acc, alias_entry_old, generator);
|
||||
r = put_alias_via_tx_to_list(m_hardforks, events, tx_set, blk_2, miner_acc, alias_entry_old, generator);
|
||||
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
|
||||
transaction tx_2_old = tx_set.front();
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_3, blk_2, miner_acc, tx_2_old);
|
||||
|
|
@ -889,7 +889,7 @@ bool hard_fork_2_awo_wallets_basic_test<before_hf_2>::generate(std::vector<test_
|
|||
REWIND_BLOCKS_N(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(110), 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(110), 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
|
|
@ -1165,7 +1165,7 @@ bool hard_fork_2_alias_update_using_old_tx<before_hf_2>::generate(std::vector<te
|
|||
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(110), 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(110), 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
|
|
@ -1281,7 +1281,7 @@ bool hard_fork_2_incorrect_alias_update<before_hf_2>::generate(std::vector<test_
|
|||
REWIND_BLOCKS_N(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(110), 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(110), 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
|
|
|
|||
|
|
@ -110,8 +110,8 @@ bool gen_uint_overflow_1::generate(std::vector<test_event_entry>& events) const
|
|||
// Problem 2. total_fee overflow, block_reward overflow
|
||||
std::list<currency::transaction> txs_1;
|
||||
// Create txs with huge fee
|
||||
txs_1.push_back(construct_tx_with_fee(events, blk_3, bob_account, alice_account, MK_TEST_COINS(1), TX_MAX_TRANSFER_AMOUNT - MK_TEST_COINS(1)));
|
||||
txs_1.push_back(construct_tx_with_fee(events, blk_3, bob_account, alice_account, MK_TEST_COINS(1), TX_MAX_TRANSFER_AMOUNT - MK_TEST_COINS(1)));
|
||||
txs_1.push_back(construct_tx_with_fee(m_hardforks, events, blk_3, bob_account, alice_account, MK_TEST_COINS(1), TX_MAX_TRANSFER_AMOUNT - MK_TEST_COINS(1)));
|
||||
txs_1.push_back(construct_tx_with_fee(m_hardforks, events, blk_3, bob_account, alice_account, MK_TEST_COINS(1), TX_MAX_TRANSFER_AMOUNT - MK_TEST_COINS(1)));
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_4, blk_3r, miner_account, txs_1);
|
||||
|
||||
return true;
|
||||
|
|
@ -154,7 +154,7 @@ bool gen_uint_overflow_2::generate(std::vector<test_event_entry>& events) const
|
|||
|
||||
currency::transaction tx_1;
|
||||
std::vector<currency::attachment_v> attachments;
|
||||
if (!construct_tx(miner_account.get_keys(), sources, destinations, attachments, tx_1, 0))
|
||||
if (!construct_tx(miner_account.get_keys(), sources, destinations, attachments, tx_1, get_tx_version_from_events(events), 0))
|
||||
return false;
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -181,7 +181,7 @@ bool gen_uint_overflow_2::generate(std::vector<test_event_entry>& events) const
|
|||
|
||||
currency::transaction tx_2;
|
||||
std::vector<currency::attachment_v> attachments2;
|
||||
if (!construct_tx(bob_account.get_keys(), sources, destinations, attachments2, tx_2, 0))
|
||||
if (!construct_tx(bob_account.get_keys(), sources, destinations, attachments2, tx_2, get_tx_version_from_events(events), 0))
|
||||
return false;
|
||||
events.push_back(tx_2);
|
||||
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ bool block_template_vs_invalid_txs_from_pool::generate(std::vector<test_event_en
|
|||
r = fill_tx_sources(sources, events, blk_0r, miner_acc.get_keys(), de.amount + TESTS_DEFAULT_FEE, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
|
||||
transaction tx_1m = AUTO_VAL_INIT(tx_1m);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, std::vector<tx_destination_entry>({ de }), empty_attachment, tx_1m, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, std::vector<tx_destination_entry>({ de }), empty_attachment, tx_1m, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_1m);
|
||||
|
||||
|
|
@ -271,7 +271,7 @@ bool block_template_vs_invalid_txs_from_pool::generate(std::vector<test_event_en
|
|||
se.ms_sigs_count = 1;
|
||||
transaction tx_2m = AUTO_VAL_INIT(tx_2m);
|
||||
r = construct_tx(bob_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, miner_acc.get_public_address()) }),
|
||||
empty_attachment, tx_2m, 0);
|
||||
empty_attachment, tx_2m, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
bool input_fully_signed = false;
|
||||
r = sign_multisig_input_in_tx(tx_2m, 0, bob_acc.get_keys(), tx_1m, &input_fully_signed);
|
||||
|
|
@ -280,7 +280,7 @@ bool block_template_vs_invalid_txs_from_pool::generate(std::vector<test_event_en
|
|||
|
||||
transaction tx_2ma = AUTO_VAL_INIT(tx_2ma);
|
||||
r = construct_tx(bob_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, miner_acc.get_public_address()) }),
|
||||
empty_attachment, tx_2ma, 0);
|
||||
empty_attachment, tx_2ma, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
input_fully_signed = false;
|
||||
r = sign_multisig_input_in_tx(tx_2ma, 0, bob_acc.get_keys(), tx_1m, &input_fully_signed);
|
||||
|
|
@ -437,7 +437,7 @@ bool test_blockchain_vs_spent_multisig_outs::generate(std::vector<test_event_ent
|
|||
sources, destinations, true, true, 1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_0);
|
||||
|
||||
|
|
@ -458,7 +458,7 @@ bool test_blockchain_vs_spent_multisig_outs::generate(std::vector<test_event_ent
|
|||
destinations.clear();
|
||||
destinations.push_back(tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, miner_acc.get_public_address()));
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
bool is_fully_signed = false;
|
||||
r = sign_multisig_input_in_tx(tx_1, 0, miner_acc.get_keys(), tx_0, &is_fully_signed);
|
||||
|
|
|
|||
|
|
@ -876,7 +876,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, 4);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r == false, false, "construct_tx was expected to fail, but successed");
|
||||
|
||||
|
||||
|
|
@ -889,7 +889,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_1);
|
||||
|
||||
|
|
@ -913,7 +913,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
|
||||
// Transaction should be successfully created, but rejected by the core
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ de }), empty_attachment, tx_2, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ de }), empty_attachment, tx_2, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
bool tx_fully_signed = false;
|
||||
r = sign_multisig_input_in_tx(tx_2, 0, bob_acc.get_keys(), tx_1, &tx_fully_signed);
|
||||
|
|
@ -943,7 +943,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
se.ms_sigs_count = 2;
|
||||
|
||||
transaction tx_3 = AUTO_VAL_INIT(tx_3);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address()) }), empty_attachment, tx_3, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address()) }), empty_attachment, tx_3, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
r = sign_multisig_input_in_tx(tx_3, 0, bob_acc.get_keys(), tx_1, &tx_fully_signed);
|
||||
CHECK_AND_ASSERT_MES(r && !tx_fully_signed, false, "sign_multisig_input_in_tx failed, tx_fully_signed : " << tx_fully_signed);
|
||||
|
|
@ -962,7 +962,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
|
||||
transaction tx_4 = AUTO_VAL_INIT(tx_4);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_4, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_4, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_4);
|
||||
|
||||
|
|
@ -980,7 +980,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
se.ms_sigs_count = 3;
|
||||
|
||||
transaction tx_5 = AUTO_VAL_INIT(tx_5);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_5, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_5, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
// use sign_multisig_input_in_tx_custom to create tx with more signatures (3) than minimum_sigs (1)
|
||||
|
|
@ -1005,7 +1005,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
|
||||
transaction tx_6 = AUTO_VAL_INIT(tx_6);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_6, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_6, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_6);
|
||||
|
||||
|
|
@ -1024,7 +1024,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
se.ms_sigs_count = 4;
|
||||
|
||||
transaction tx_7 = AUTO_VAL_INIT(tx_7);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_7, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_7, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
// use sign_multisig_input_in_tx_custom to create tx with more signatures (4) than minimum_sigs (1)
|
||||
|
|
@ -1047,7 +1047,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
|
||||
transaction tx_8 = AUTO_VAL_INIT(tx_8);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_8, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_8, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_8);
|
||||
|
||||
|
|
@ -1067,7 +1067,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
se.ms_sigs_count = redundant_keys_count;
|
||||
|
||||
transaction tx_9 = AUTO_VAL_INIT(tx_9);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_9, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_9, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
tx_9.signatures[0].resize(redundant_keys_count, invalid_signature);
|
||||
|
|
@ -1270,7 +1270,7 @@ bool multisig_and_unlock_time::generate(std::vector<test_event_entry>& events) c
|
|||
crypto::secret_key stub_key = AUTO_VAL_INIT(stub_key);
|
||||
etc_tx_details_expiration_time extra_expiration_time = AUTO_VAL_INIT(extra_expiration_time);
|
||||
extra_expiration_time.v = expiration_time;
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, std::vector<extra_v>({ extra_expiration_time }), empty_attachment, tx_4, stub_key, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, std::vector<extra_v>({ extra_expiration_time }), empty_attachment, tx_4, get_tx_version_from_events(events), stub_key, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
CHECK_AND_ASSERT_MES(get_tx_expiration_time(tx_4) == expiration_time, false, "Expiration time was not correctly set");
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
|
|
@ -1278,7 +1278,7 @@ bool multisig_and_unlock_time::generate(std::vector<test_event_entry>& events) c
|
|||
|
||||
// add similar tx (same sources and destinations) with no expiration_time - should be accepted by the core
|
||||
transaction tx_5 = AUTO_VAL_INIT(tx_5);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_extra, empty_attachment, tx_5, stub_key, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_extra, empty_attachment, tx_5, get_tx_version_from_events(events), stub_key, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_5);
|
||||
|
||||
|
|
@ -1305,7 +1305,7 @@ bool multisig_and_unlock_time::generate(std::vector<test_event_entry>& events) c
|
|||
extra_expiration_time = AUTO_VAL_INIT(extra_expiration_time);
|
||||
extra_expiration_time.v = expiration_time;
|
||||
transaction tx_6 = AUTO_VAL_INIT(tx_6);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, std::vector<extra_v>({ extra_expiration_time }), empty_attachment, tx_6, stub_key, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, std::vector<extra_v>({ extra_expiration_time }), empty_attachment, tx_6, get_tx_version_from_events(events), stub_key, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
CHECK_AND_ASSERT_MES(get_tx_expiration_time(tx_6) == expiration_time, false, "Expiration time was not correctly set");
|
||||
r = sign_multisig_input_in_tx(tx_6, tx_5_ms_out_idx, miner_acc.get_keys(), tx_5, &tx_fully_signed);
|
||||
|
|
@ -1418,7 +1418,7 @@ bool multisig_and_coinbase::generate(std::vector<test_event_entry>& events) cons
|
|||
destinations.assign({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address()) });
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
bool fully_signed_tx = false;
|
||||
r = sign_multisig_input_in_tx(tx_1, 0, alice_acc.get_keys(), blk_1.miner_tx, &fully_signed_tx);
|
||||
|
|
@ -1482,7 +1482,7 @@ bool multisig_and_coinbase::generate(std::vector<test_event_entry>& events) cons
|
|||
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
r = construct_tx(alice_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }),
|
||||
empty_attachment, tx_2, 0);
|
||||
empty_attachment, tx_2, get_tx_version_from_events(events), 0);
|
||||
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
r = sign_multisig_input_in_tx(tx_2, 0, alice_acc.get_keys(), blk_3.miner_tx, &fully_signed_tx);
|
||||
|
|
@ -2248,7 +2248,7 @@ bool multisig_n_participants_seq_signing::generate(std::vector<test_event_entry>
|
|||
r = fill_tx_sources_and_destinations(events, blk_0r, miner_acc.get_keys(), ms_addr_list, ms_amount, TESTS_DEFAULT_FEE, 0, sources, destinations, true, true, m_minimum_signs_to_spend);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources_and_destinations failed");
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, get_tx_version_from_events(events), 0);
|
||||
events.push_back(tx_1);
|
||||
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_1);
|
||||
|
|
@ -2278,7 +2278,7 @@ bool multisig_n_participants_seq_signing::generate(std::vector<test_event_entry>
|
|||
|
||||
// construct a transaction (no participants keys are provided, thus no signs for ms input are created)
|
||||
transaction tx = AUTO_VAL_INIT(tx);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx, 0);
|
||||
r = construct_tx(alice_acc.get_keys(), sources, destinations, empty_attachment, tx, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
// sign the transaction by (m_minimum_signs_to_spend) participants in random order
|
||||
|
|
|
|||
|
|
@ -633,7 +633,7 @@ bool offer_removing_and_selected_output::generate(std::vector<test_event_entry>&
|
|||
std::vector<tx_source_entry> sources;
|
||||
r = fill_tx_sources(sources, events, blk_0r, miner_acc.get_keys(), destinations_amount + TESTS_DEFAULT_FEE, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
events.push_back(tx_0);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_0);
|
||||
|
|
@ -751,7 +751,7 @@ bool offers_and_stuck_txs::generate(std::vector<test_event_entry>& events) const
|
|||
bc_services::put_offer_into_attachment(co, attachments);
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
uint64_t fee = 7 * TESTS_DEFAULT_FEE;
|
||||
r = construct_tx_to_key(events, tx_2, blk_1, miner_acc, miner_acc, TESTS_DEFAULT_FEE, fee, 0, 0, empty_extra, attachments);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_2, blk_1, miner_acc, miner_acc, TESTS_DEFAULT_FEE, fee, 0, 0, empty_extra, attachments);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_to_key failed");
|
||||
events.push_back(tx_2);
|
||||
|
||||
|
|
@ -776,7 +776,7 @@ bool offers_and_stuck_txs::generate(std::vector<test_event_entry>& events) const
|
|||
bc_services::put_offer_into_attachment(uo, attachments);
|
||||
transaction tx_3 = AUTO_VAL_INIT(tx_3);
|
||||
fee = 90 * TESTS_DEFAULT_FEE;
|
||||
r = construct_tx_to_key(events, tx_3, blk_2, miner_acc, miner_acc, TESTS_DEFAULT_FEE, fee, 0, 0, empty_extra, attachments);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_3, blk_2, miner_acc, miner_acc, TESTS_DEFAULT_FEE, fee, 0, 0, empty_extra, attachments);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_to_key failed");
|
||||
events.push_back(tx_3);
|
||||
|
||||
|
|
@ -821,11 +821,11 @@ bool offers_updating_hack::generate(std::vector<test_event_entry>& events) const
|
|||
REWIND_BLOCKS_N(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 2);
|
||||
|
||||
transaction tx_a = AUTO_VAL_INIT(tx_a);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), TESTS_DEFAULT_FEE * 1000, 10, TESTS_DEFAULT_FEE, tx_a);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), TESTS_DEFAULT_FEE * 1000, 10, TESTS_DEFAULT_FEE, tx_a);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_a);
|
||||
transaction tx_b = AUTO_VAL_INIT(tx_b);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), TESTS_DEFAULT_FEE * 1000, 10, TESTS_DEFAULT_FEE, tx_b);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), TESTS_DEFAULT_FEE * 1000, 10, TESTS_DEFAULT_FEE, tx_b);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_b);
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, std::list<transaction>({ tx_a, tx_b }));
|
||||
|
|
@ -854,7 +854,7 @@ bool offers_updating_hack::generate(std::vector<test_event_entry>& events) const
|
|||
bc_services::put_offer_into_attachment(uo, attachments);
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
uint64_t fee = 90 * TESTS_DEFAULT_FEE;
|
||||
r = construct_tx_to_key(events, tx_2, blk_2, alice_acc, alice_acc, TESTS_DEFAULT_FEE, fee, 0, 0, empty_extra, attachments);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_2, blk_2, alice_acc, alice_acc, TESTS_DEFAULT_FEE, fee, 0, 0, empty_extra, attachments);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_to_key failed");
|
||||
events.push_back(tx_2);
|
||||
CHECK_AND_ASSERT_MES(get_tx_fee(tx_2) == fee, false, "Incorrect fee: " << print_money_brief(get_tx_fee(tx_2)) << ", expected: " << print_money_brief(fee));
|
||||
|
|
@ -1058,7 +1058,7 @@ bool offers_multiple_update::generate(std::vector<test_event_entry>& events) con
|
|||
bc_services::put_offer_into_attachment(uo, attachments);
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
uint64_t fee = 14 * TESTS_DEFAULT_FEE;
|
||||
r = construct_tx_to_key(events, tx_2, blk_2, miner_acc, miner_acc, TESTS_DEFAULT_FEE, fee, 0, 0, empty_extra, attachments);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_2, blk_2, miner_acc, miner_acc, TESTS_DEFAULT_FEE, fee, 0, 0, empty_extra, attachments);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_to_key failed");
|
||||
events.push_back(tx_2);
|
||||
|
||||
|
|
@ -1070,7 +1070,7 @@ bool offers_multiple_update::generate(std::vector<test_event_entry>& events) con
|
|||
bc_services::put_offer_into_attachment(uo, attachments);
|
||||
transaction tx_3 = AUTO_VAL_INIT(tx_3);
|
||||
fee = 19 * TESTS_DEFAULT_FEE;
|
||||
r = construct_tx_to_key(events, tx_3, blk_2, miner_acc, miner_acc, TESTS_DEFAULT_FEE, fee, 0, 0, empty_extra, attachments);
|
||||
r = construct_tx_to_key(m_hardforks, events, tx_3, blk_2, miner_acc, miner_acc, TESTS_DEFAULT_FEE, fee, 0, 0, empty_extra, attachments);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_to_key failed");
|
||||
events.push_back(tx_3);
|
||||
|
||||
|
|
|
|||
|
|
@ -771,14 +771,14 @@ bool pos_wallet_big_block_test::generate(std::vector<test_event_entry>& events)
|
|||
|
||||
crypto::secret_key stub;
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx(miner_acc.get_keys(), sources_1, destinations, extra, empty_attachment, tx_1, stub, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources_1, destinations, extra, empty_attachment, tx_1, get_tx_version_from_events(events), stub, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
size_t tx_size = get_object_blobsize(tx_1);
|
||||
CHECK_AND_ASSERT_MES(tx_size > padding_size, false, "Tx size is: " << tx_size << ", expected to be bigger than: " << padding_size);
|
||||
events.push_back(tx_1); // push it to the pool
|
||||
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
r = construct_tx(miner_acc.get_keys(), sources_2, destinations, extra, empty_attachment, tx_2, stub, 0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources_2, destinations, extra, empty_attachment, tx_2, get_tx_version_from_events(events), stub, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
tx_size = get_object_blobsize(tx_2);
|
||||
CHECK_AND_ASSERT_MES(tx_size > padding_size, false, "Tx size is: " << tx_size << ", expected to be bigger than: " << padding_size);
|
||||
|
|
@ -1044,7 +1044,7 @@ bool pos_minting_tx_packing::pos_minting_tx_packing::generate(std::vector<test_e
|
|||
// 10 outputs each of (CURRENCY_BLOCK_REWARD * m_pos_mint_packing_size) coins
|
||||
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), m_alice_start_amount, 10, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), m_alice_start_amount, 10, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
|
||||
events.push_back(tx_1);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ struct ev_visitor : public boost::static_visitor<bool>
|
|||
};
|
||||
|
||||
|
||||
bool generate_blockchain_with_pruned_rs(std::vector<test_event_entry>& events)
|
||||
bool prun_ring_signatures::generate_blockchain_with_pruned_rs(std::vector<test_event_entry>& events)
|
||||
{
|
||||
uint64_t ts_start = 1338224400;
|
||||
GENERATE_ACCOUNT(miner_account);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public:
|
|||
|
||||
bool set_check_points(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
|
||||
bool check_blockchain(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
|
||||
|
||||
bool generate_blockchain_with_pruned_rs(std::vector<test_event_entry>& events);
|
||||
private:
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -818,7 +818,7 @@ bool gen_crypted_attachments::generate(std::vector<test_event_entry>& events) co
|
|||
fill_test_offer_(od);
|
||||
bc_services::put_offer_into_attachment(od, attachments2);
|
||||
bc_services::put_offer_into_attachment(od, attachments2);
|
||||
construct_tx_to_key(events, tx, blk_6, miner_account, miner_account, MK_TEST_COINS(1), TESTS_DEFAULT_FEE, 0, CURRENCY_TO_KEY_OUT_RELAXED, std::vector<currency::extra_v>(), attachments2);
|
||||
construct_tx_to_key(m_hardforks, events, tx, blk_6, miner_account, miner_account, MK_TEST_COINS(1), TESTS_DEFAULT_FEE, 0, CURRENCY_TO_KEY_OUT_RELAXED, std::vector<currency::extra_v>(), attachments2);
|
||||
txs_list2.push_back(tx);
|
||||
events.push_back(tx);
|
||||
|
||||
|
|
@ -868,7 +868,7 @@ bool gen_crypted_attachments::generate(std::vector<test_event_entry>& events) co
|
|||
// currency::get_tx_pub_key_from_extra(tx),
|
||||
// off_key_pair.sec, co.sig);
|
||||
bc_services::put_offer_into_attachment(co, attachments3);
|
||||
construct_tx_to_key(events, tx, blk_7, miner_account, miner_account, MK_TEST_COINS(1), TESTS_DEFAULT_FEE, 0, CURRENCY_TO_KEY_OUT_RELAXED, std::vector<currency::extra_v>(), attachments3);
|
||||
construct_tx_to_key(m_hardforks, events, tx, blk_7, miner_account, miner_account, MK_TEST_COINS(1), TESTS_DEFAULT_FEE, 0, CURRENCY_TO_KEY_OUT_RELAXED, std::vector<currency::extra_v>(), attachments3);
|
||||
txs_list3.push_back(tx);
|
||||
events.push_back(tx);
|
||||
|
||||
|
|
@ -1193,7 +1193,7 @@ bool tx_expiration_time::generate(std::vector<test_event_entry>& events) const
|
|||
// transfer to Alice some coins in chunks
|
||||
uint64_t alice_amount = MK_TEST_COINS(10);
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), alice_amount, 10, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), alice_amount, 10, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_1);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_1);
|
||||
|
|
|
|||
|
|
@ -1319,7 +1319,7 @@ bool gen_wallet_transfers_and_chain_switch::generate(std::vector<test_event_entr
|
|||
REWIND_BLOCKS_N(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
bool r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(30) * 2, 2, TESTS_DEFAULT_FEE, tx_0);
|
||||
bool r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), MK_TEST_COINS(30) * 2, 2, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs failed");
|
||||
events.push_back(tx_0);
|
||||
MAKE_NEXT_BLOCK_TX1(events, blk_1, blk_0r, miner_acc, tx_0);
|
||||
|
|
@ -3051,11 +3051,11 @@ bool wallet_unconfirmed_tx_expiration::generate(std::vector<test_event_entry>& e
|
|||
|
||||
bool r = false;
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), TESTS_DEFAULT_FEE * 20, 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), alice_acc.get_public_address(), TESTS_DEFAULT_FEE * 20, 10, TESTS_DEFAULT_FEE, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs");
|
||||
events.push_back(tx_0);
|
||||
transaction tx_1 = AUTO_VAL_INIT(tx_1);
|
||||
r = construct_tx_with_many_outputs(events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), TESTS_DEFAULT_FEE * 20, 10, TESTS_DEFAULT_FEE, tx_1);
|
||||
r = construct_tx_with_many_outputs(m_hardforks, events, blk_0r, miner_acc.get_keys(), bob_acc.get_public_address(), TESTS_DEFAULT_FEE * 20, 10, TESTS_DEFAULT_FEE, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx_with_many_outputs");
|
||||
events.push_back(tx_1);
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, std::list<transaction>({ tx_0, tx_1 }));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue