1
0
Fork 0
forked from lthn/blockchain

coretests fixed

This commit is contained in:
sowle 2020-04-23 15:41:40 +03:00
parent 145dd6b024
commit f532e4637e
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC
18 changed files with 133 additions and 125 deletions

View file

@ -44,7 +44,7 @@ bool put_alias_via_tx_to_list(std::vector<test_event_entry>& events,
ex.push_back(ai2);
account_base reward_acc;
account_keys& ak = const_cast<account_keys&>(reward_acc.get_keys());
currency::get_aliases_reward_account(ak.m_account_address, ak.m_view_secret_key);
currency::get_aliases_reward_account(ak.account_address, ak.view_secret_key);
uint64_t fee_median = generator.get_last_n_blocks_fee_median(get_block_hash(head_block));
uint64_t reward = currency::get_alias_coast_from_fee(ai2.m_alias, fee_median);
@ -80,7 +80,7 @@ bool put_alias_via_tx_to_list(std::vector<test_event_entry>& events,
{
currency::extra_alias_entry ai2 = AUTO_VAL_INIT(ai2);
ai2.m_alias = alias_name;
ai2.m_address = alias_acc.get_keys().m_account_address;
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);
}
@ -112,7 +112,7 @@ bool put_next_block_with_alias_in_tx(std::vector<test_event_entry>& events,
{
currency::extra_alias_entry ai2 = AUTO_VAL_INIT(ai2);
ai2.m_alias = alias_name;
ai2.m_address = alias_acc.get_keys().m_account_address;
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);
@ -171,13 +171,13 @@ bool gen_alias_tests::generate(std::vector<test_event_entry>& events) const
currency::extra_alias_entry ai = AUTO_VAL_INIT(ai);
ai.m_alias = FIRST_ALIAS_NAME;
ai.m_text_comment = "first@first.com blablabla";
ai.m_address = first_acc.get_keys().m_account_address;
ai.m_address = first_acc.get_keys().account_address;
MAKE_BLOCK_WITH_ALIAS_INFO_IN_TX(events, blk_2, blk_1, miner_account, ai); // 4N+7,4N+8
DO_CALLBACK(events, "check_first_alias_added"); // 4N+9
ai.m_alias = SECOND_ALIAS_NAME;
ai.m_text_comment = "second@second.com blablabla";
ai.m_address = second_acc.get_keys().m_account_address;
ai.m_address = second_acc.get_keys().account_address;
MAKE_BLOCK_WITH_ALIAS_INFO_IN_TX(events, blk_3, blk_2, miner_account, ai); // 4N+10,4N+11
DO_CALLBACK(events, "check_second_alias_added"); // 4N+12
@ -195,9 +195,9 @@ bool gen_alias_tests::generate(std::vector<test_event_entry>& events) const
currency::extra_alias_entry ai_upd = AUTO_VAL_INIT(ai_upd);
ai_upd.m_alias = FIRST_ALIAS_NAME;
ai_upd.m_address =third_acc.get_keys().m_account_address;
ai_upd.m_address =third_acc.get_keys().account_address;
ai_upd.m_text_comment = "changed alias haha";
r = sign_extra_alias_entry(ai_upd, first_acc.get_keys().m_account_address.m_spend_public_key, first_acc.get_keys().m_spend_secret_key);
r = sign_extra_alias_entry(ai_upd, first_acc.get_keys().account_address.spend_public_key, first_acc.get_keys().spend_secret_key);
CHECK_AND_ASSERT_MES(r, false, "failed to sign update_alias");
MAKE_BLOCK_WITH_ALIAS_INFO_IN_TX(events, blk_6, blk_5, miner_account, ai_upd); // 4N+20,N+21
DO_CALLBACK(events, "check_alias_changed"); // 4N+22
@ -205,9 +205,9 @@ bool gen_alias_tests::generate(std::vector<test_event_entry>& events) const
//try to make fake alias change
currency::extra_alias_entry ai_upd_fake = AUTO_VAL_INIT(ai_upd_fake);
ai_upd_fake.m_alias = SECOND_ALIAS_NAME;
ai_upd_fake.m_address =third_acc.get_keys().m_account_address;
ai_upd_fake.m_address =third_acc.get_keys().account_address;
ai_upd_fake.m_text_comment = "changed alias haha";
r = sign_extra_alias_entry(ai_upd_fake, second_acc.get_keys().m_account_address.m_spend_public_key, second_acc.get_keys().m_spend_secret_key);
r = sign_extra_alias_entry(ai_upd_fake, second_acc.get_keys().account_address.spend_public_key, second_acc.get_keys().spend_secret_key);
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;
@ -283,8 +283,8 @@ bool gen_alias_tests::check_first_alias_added(currency::core& c, size_t ev_index
currency::extra_alias_entry_base ai = AUTO_VAL_INIT(ai);
bool r = c.get_blockchain_storage().get_alias_info(FIRST_ALIAS_NAME, ai);
CHECK_AND_ASSERT_MES(r, false, "first alias name check failed");
CHECK_AND_ASSERT_MES(ai.m_address.m_spend_public_key == first_acc.get_keys().m_account_address.m_spend_public_key
&& ai.m_address.m_view_public_key == first_acc.get_keys().m_account_address.m_view_public_key, false, "first alias name check failed");
CHECK_AND_ASSERT_MES(ai.m_address.spend_public_key == first_acc.get_keys().account_address.spend_public_key
&& ai.m_address.view_public_key == first_acc.get_keys().account_address.view_public_key, false, "first alias name check failed");
return true;
}
bool gen_alias_tests::check_second_alias_added(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
@ -294,8 +294,8 @@ bool gen_alias_tests::check_second_alias_added(currency::core& c, size_t ev_inde
currency::extra_alias_entry_base ai = AUTO_VAL_INIT(ai);
bool r = c.get_blockchain_storage().get_alias_info(SECOND_ALIAS_NAME, ai);
CHECK_AND_ASSERT_MES(r, false, "first alias name check failed");
CHECK_AND_ASSERT_MES(ai.m_address.m_spend_public_key == second_acc.get_keys().m_account_address.m_spend_public_key
&& ai.m_address.m_view_public_key == second_acc.get_keys().m_account_address.m_view_public_key, false, "second alias name check failed");
CHECK_AND_ASSERT_MES(ai.m_address.spend_public_key == second_acc.get_keys().account_address.spend_public_key
&& ai.m_address.view_public_key == second_acc.get_keys().account_address.view_public_key, false, "second alias name check failed");
return true;
}
@ -352,8 +352,8 @@ bool gen_alias_tests::check_alias_changed(currency::core& c, size_t ev_index, co
currency::extra_alias_entry_base ai = AUTO_VAL_INIT(ai);
bool r = c.get_blockchain_storage().get_alias_info(FIRST_ALIAS_NAME, ai);
CHECK_AND_ASSERT_MES(r, false, "first alias name check failed");
CHECK_AND_ASSERT_MES(ai.m_address.m_spend_public_key == third_acc.get_keys().m_account_address.m_spend_public_key
&& ai.m_address.m_view_public_key == third_acc.get_keys().m_account_address.m_view_public_key, false, "first alias update name check failed");
CHECK_AND_ASSERT_MES(ai.m_address.spend_public_key == third_acc.get_keys().account_address.spend_public_key
&& ai.m_address.view_public_key == third_acc.get_keys().account_address.view_public_key, false, "first alias update name check failed");
return true;
}
@ -452,10 +452,10 @@ bool gen_alias_strange_data::generate(std::vector<test_event_entry>& events) con
// empty comment
currency::extra_alias_entry ai_upd = AUTO_VAL_INIT(ai_upd);
ai_upd.m_alias = ai.m_alias;
ai_upd.m_address.m_spend_public_key = null_pkey;
ai_upd.m_address.m_view_public_key = null_pkey;
ai_upd.m_address.spend_public_key = null_pkey;
ai_upd.m_address.view_public_key = null_pkey;
ai_upd.m_text_comment = "";
r = sign_extra_alias_entry(ai_upd, m_alice.get_public_address().m_spend_public_key, m_alice.get_keys().m_spend_secret_key);
r = sign_extra_alias_entry(ai_upd, m_alice.get_public_address().spend_public_key, m_alice.get_keys().spend_secret_key);
CHECK_AND_ASSERT_MES(r, false, "failed to sign update_alias");
MAKE_BLOCK_WITH_ALIAS_INFO_IN_TX(events, blk_2, blk_1, miner_acc, ai_upd);
@ -468,14 +468,14 @@ bool gen_alias_strange_data::generate(std::vector<test_event_entry>& events) con
ai.m_alias = std::string(255, 'x');
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().m_view_secret_key);
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);
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();
ai.m_text_comment = std::string(255, '\0');
r = sign_extra_alias_entry(ai, m_alice.get_public_address().m_spend_public_key, m_alice.get_keys().m_spend_secret_key);
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);
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
@ -489,7 +489,7 @@ bool gen_alias_strange_data::check_alias_changed(currency::core& c, size_t ev_in
currency::extra_alias_entry ai;
bool r = c.get_blockchain_storage().get_alias_info(std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'a'), ai);
CHECK_AND_ASSERT_MES(r, false, "get_alias_info failed");
CHECK_AND_ASSERT_MES(ai.m_address.m_spend_public_key == null_pkey && ai.m_address.m_view_public_key == null_pkey, false, "alias didn't change");
CHECK_AND_ASSERT_MES(ai.m_address.spend_public_key == null_pkey && ai.m_address.view_public_key == null_pkey, false, "alias didn't change");
return true;
}
@ -519,13 +519,13 @@ bool gen_alias_concurrency_with_switch::generate(std::vector<test_event_entry>&
ai.m_text_comment = "";
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().m_view_secret_key);
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);
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
// 2nd
std::list<currency::transaction> tx_list2;
ai.m_address.m_spend_public_key = null_pkey, ai.m_address.m_view_public_key = null_pkey;
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);
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
@ -557,7 +557,7 @@ bool gen_alias_concurrency_with_switch::check_alias(currency::core& c, size_t ev
currency::extra_alias_entry ai = AUTO_VAL_INIT(ai);
bool r = c.get_blockchain_storage().get_alias_info(std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'a'), ai);
CHECK_AND_ASSERT_MES(r, false, "get_alias_info failed");
CHECK_AND_ASSERT_MES(ai.m_address.m_spend_public_key == null_pkey && ai.m_address.m_view_public_key == null_pkey, false, "wrong alias");
CHECK_AND_ASSERT_MES(ai.m_address.spend_public_key == null_pkey && ai.m_address.view_public_key == null_pkey, false, "wrong alias");
return true;
}
@ -579,12 +579,12 @@ bool gen_alias_same_alias_in_tx_pool::generate(std::vector<test_event_entry>& ev
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();
ai.m_view_key.push_back(miner_acc.get_keys().m_view_secret_key);
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);
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
ai.m_address.m_spend_public_key = null_pkey, ai.m_address.m_view_public_key = null_pkey;
r = sign_extra_alias_entry(ai, miner_acc.get_public_address().m_spend_public_key, miner_acc.get_keys().m_spend_secret_key);
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);
@ -597,14 +597,14 @@ bool gen_alias_same_alias_in_tx_pool::generate(std::vector<test_event_entry>& ev
// 2. add to the pool two txs: 1) update previously registered alias 2) update it once again
tx_list.clear();
ai.m_address.m_spend_public_key = miner_acc.get_public_address().m_spend_public_key;
r = sign_extra_alias_entry(ai, miner_acc.get_public_address().m_spend_public_key, miner_acc.get_keys().m_spend_secret_key);
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);
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().m_spend_public_key, miner_acc.get_keys().m_spend_secret_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");
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);
@ -653,7 +653,7 @@ bool gen_alias_switch_and_tx_pool::generate(std::vector<test_event_entry>& event
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();
ai.m_view_key.push_back(miner_acc.get_keys().m_view_secret_key);
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);
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
@ -663,8 +663,8 @@ bool gen_alias_switch_and_tx_pool::generate(std::vector<test_event_entry>& event
// 2. update the alias
tx_list.clear();
ai.m_address.m_spend_public_key = null_pkey, ai.m_address.m_view_public_key = null_pkey;
r = sign_extra_alias_entry(ai, miner_acc.get_public_address().m_spend_public_key, miner_acc.get_keys().m_spend_secret_key);
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);
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
@ -682,7 +682,7 @@ bool gen_alias_switch_and_tx_pool::generate(std::vector<test_event_entry>& event
ai = AUTO_VAL_INIT(ai);
ai.m_alias = std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'a');
ai.m_address = alice.get_public_address();
ai.m_view_key.push_back(alice.get_keys().m_view_secret_key);
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);
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
@ -708,7 +708,7 @@ bool gen_alias_switch_and_tx_pool::check_alias(currency::core& c, size_t ev_inde
currency::extra_alias_entry_base ai;
bool r = c.get_blockchain_storage().get_alias_info(alias_name, ai);
CHECK_AND_ASSERT_MES(r, false, "get_alias_info failed");
CHECK_AND_ASSERT_MES(ai.m_address == alice.get_public_address() && !ai.m_view_key.empty() && ai.m_view_key.front() == alice.get_keys().m_view_secret_key, false, "wrong alias");
CHECK_AND_ASSERT_MES(ai.m_address == alice.get_public_address() && !ai.m_view_key.empty() && ai.m_view_key.front() == alice.get_keys().view_secret_key, false, "wrong alias");
return true;
}
@ -740,7 +740,7 @@ bool gen_alias_update_after_addr_changed::generate(std::vector<test_event_entry>
tx_list.clear();
ai.m_text_comment = "upd1";
ai.m_address = alice.get_public_address();
r = sign_extra_alias_entry(ai, miner_acc.get_public_address().m_spend_public_key, miner_acc.get_keys().m_spend_secret_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_1, miner_acc, ai, generator);
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
@ -750,7 +750,7 @@ bool gen_alias_update_after_addr_changed::generate(std::vector<test_event_entry>
// try to update the alias on behalf of miner (should fail because it must be alice who can sign it)
tx_list.clear();
ai.m_text_comment = "upd2";
r = sign_extra_alias_entry(ai, miner_acc.get_public_address().m_spend_public_key, miner_acc.get_keys().m_spend_secret_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_2, miner_acc, ai, generator);
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
@ -765,7 +765,7 @@ bool gen_alias_update_after_addr_changed::generate(std::vector<test_event_entry>
// try to update the alias on behalf of alice (should be ok)
tx_list.clear();
ai.m_address = miner_acc.get_public_address();
r = sign_extra_alias_entry(ai, alice.get_public_address().m_spend_public_key, alice.get_keys().m_spend_secret_key);
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);
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
@ -775,7 +775,7 @@ bool gen_alias_update_after_addr_changed::generate(std::vector<test_event_entry>
// try to change the alias on behalf on alice again (should fail)
tx_list.clear();
ai.m_text_comment = "upd3";
r = sign_extra_alias_entry(ai, alice.get_public_address().m_spend_public_key, alice.get_keys().m_spend_secret_key);
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);
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
@ -887,7 +887,7 @@ bool gen_alias_blocking_update_by_invalid_tx::generate(std::vector<test_event_en
ai.m_alias = "sweet.name";
ai.m_address = alice.get_public_address();
ai.m_text_comment = "alice@mail.com";
r = sign_extra_alias_entry(ai, alice.get_public_address().m_spend_public_key, alice.get_keys().m_spend_secret_key);
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);
CHECK_AND_ASSERT_MES(r, false, "put_alias_via_tx_to_list failed");
@ -973,7 +973,7 @@ bool gen_alias_too_much_reward::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();
ai.m_view_key.push_back(miner_acc.get_keys().m_view_secret_key);
ai.m_view_key.push_back(miner_acc.get_keys().view_secret_key);
std::vector<currency::extra_v> extra;
extra.push_back(ai);
@ -994,7 +994,7 @@ bool gen_alias_too_much_reward::check_alias(currency::core& c, size_t ev_index,
currency::extra_alias_entry_base ai;
bool r = c.get_blockchain_storage().get_alias_info(std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'a'), ai);
CHECK_AND_ASSERT_MES(r, false, "get_alias_info failed");
CHECK_AND_ASSERT_MES(ai.m_address == miner_acc.get_public_address() && ai.m_view_key.size() == 1 && ai.m_view_key.front() == miner_acc.get_keys().m_view_secret_key, false, "wrong alias");
CHECK_AND_ASSERT_MES(ai.m_address == miner_acc.get_public_address() && ai.m_view_key.size() == 1 && ai.m_view_key.front() == miner_acc.get_keys().view_secret_key, false, "wrong alias");
return true;
}
@ -1111,7 +1111,7 @@ bool gen_alias_too_small_reward::make_tx_reg_alias(std::vector<test_event_entry>
extra_alias_entry ai = AUTO_VAL_INIT(ai);
ai.m_alias = alias;
ai.m_address = alias_addr;
ai.m_view_key.push_back(miner_acc.get_keys().m_view_secret_key);
ai.m_view_key.push_back(miner_acc.get_keys().view_secret_key);
if (alias.size() < ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED)
@ -1168,7 +1168,7 @@ bool gen_alias_too_small_reward::check_alias(currency::core& c, size_t ev_index,
r = c.get_blockchain_storage().get_alias_info(ae.name, ai);
CHECK_AND_ASSERT_MES(r, false, "get_alias_info failed");
CHECK_AND_ASSERT_MES(ai.m_address == ae.addr && ai.m_view_key.size() == 1 && ai.m_view_key.front() == miner_acc.get_keys().m_view_secret_key, false, "wrong alias registration: " << ae.name);
CHECK_AND_ASSERT_MES(ai.m_address == ae.addr && ai.m_view_key.size() == 1 && ai.m_view_key.front() == miner_acc.get_keys().view_secret_key, false, "wrong alias registration: " << ae.name);
return true;
}
@ -1261,7 +1261,7 @@ bool gen_alias_switch_and_check_block_template::generate(std::vector<test_event_
// Alice updates her alias (paid by miner in order not to confuse and mix the inputs)
ai.m_text_comment = "alice@mail.com";
r = sign_extra_alias_entry(ai, alice.get_public_address().m_spend_public_key, alice.get_keys().m_spend_secret_key);
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");
std::vector<currency::extra_v> extra(1, ai);
@ -1443,7 +1443,7 @@ bool gen_alias_update_for_free::generate(std::vector<test_event_entry>& events)
// update the alias - pay nothing
ai.m_text_comment = "miner@mail.com";
r = sign_extra_alias_entry(ai, miner_acc.get_public_address().m_spend_public_key, miner_acc.get_keys().m_spend_secret_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");
std::vector<currency::extra_v> extra(1, ai);
@ -1505,8 +1505,8 @@ bool gen_alias_in_coinbase::generate(std::vector<test_event_entry>& events) cons
// update an alias using coinbase
ai.m_text_comment = "A Party member is expected to have no private emotions and no respites from enthusiasm.";
ai.m_view_key.push_back(miner_acc.get_keys().m_view_secret_key);
r = sign_extra_alias_entry(ai, miner_acc.get_public_address().m_spend_public_key, miner_acc.get_keys().m_spend_secret_key);
ai.m_view_key.push_back(miner_acc.get_keys().view_secret_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");
block blk_2 = AUTO_VAL_INIT(blk_2);

View file

@ -320,7 +320,7 @@ bool gen_block_miner_tx_has_2_in::generate(std::vector<test_event_entry>& events
sources.push_back(se);
tx_destination_entry de = AUTO_VAL_INIT(de);
de.addr.push_back(miner_account.get_keys().m_account_address);
de.addr.push_back(miner_account.get_keys().account_address);
de.amount = se.amount;
std::vector<tx_destination_entry> destinations;
destinations.push_back(de);
@ -363,7 +363,7 @@ bool gen_block_miner_tx_with_txin_to_key::generate(std::vector<test_event_entry>
sources.push_back(se);
tx_destination_entry de = AUTO_VAL_INIT(de);
de.addr.push_back(miner_account.get_keys().m_account_address);
de.addr.push_back(miner_account.get_keys().account_address);
de.amount = se.amount;
std::vector<tx_destination_entry> destinations;
destinations.push_back(de);
@ -444,8 +444,8 @@ bool gen_block_miner_tx_has_out_to_alice::generate(std::vector<test_event_entry>
crypto::key_derivation derivation;
crypto::public_key out_eph_public_key;
crypto::generate_key_derivation(alice.get_keys().m_account_address.m_view_public_key, txkey.sec, derivation);
crypto::derive_public_key(derivation, 1, alice.get_keys().m_account_address.m_spend_public_key, out_eph_public_key);
crypto::generate_key_derivation(alice.get_keys().account_address.view_public_key, txkey.sec, derivation);
crypto::derive_public_key(derivation, 1, alice.get_keys().account_address.spend_public_key, out_eph_public_key);
tx_out out_to_alice;
out_to_alice.amount = miner_tx.vout[0].amount / 2;

View file

@ -48,17 +48,23 @@ crypto::signature create_invalid_signature()
const crypto::signature invalid_signature = create_invalid_signature();
test_generator::test_generator()
: m_wallet_test_core_proxy(new wallet_test_core_proxy()),
m_do_pos_to_low_timestamp(false),
m_ignore_last_pow_in_wallets(false),
m_last_found_timestamp(0),
m_hardfork_after_heigh(CURRENCY_MAX_BLOCK_NUMBER)
: m_wallet_test_core_proxy(new wallet_test_core_proxy())
, m_do_pos_to_low_timestamp(false)
, m_ignore_last_pow_in_wallets(false)
, m_last_found_timestamp(0)
, m_hardfork_01_after_heigh(CURRENCY_MAX_BLOCK_NUMBER)
, m_hardfork_02_after_heigh(CURRENCY_MAX_BLOCK_NUMBER)
{
}
void test_generator::set_hardfork_height(uint64_t h)
void test_generator::set_hardfork_height(size_t hardfork_id, uint64_t h)
{
m_hardfork_after_heigh = h;
switch (hardfork_id)
{
case 1: m_hardfork_01_after_heigh = h; break;
case 2: m_hardfork_02_after_heigh = h; break;
default: CHECK_AND_ASSERT_THROW_MES(false, "invalid hardfork id: " << hardfork_id)
}
}
void test_generator::get_block_chain(std::vector<const block_info*>& blockchain, const crypto::hash& head, size_t n) const
@ -203,7 +209,7 @@ bool test_generator::construct_block(currency::block& blk,
const std::list<currency::transaction>& tx_list,
const std::list<currency::account_base>& coin_stake_sources)//in case of PoS block
{
if (height > m_hardfork_after_heigh)
if (height > m_hardfork_01_after_heigh)
blk.major_version = CURRENT_BLOCK_MAJOR_VERSION;
else
blk.major_version = BLOCK_MAJOR_VERSION_INITAL;
@ -270,8 +276,8 @@ bool test_generator::construct_block(currency::block& blk,
already_generated_coins,
target_block_size,
total_fee,
miner_acc.get_keys().m_account_address,
miner_acc.get_keys().m_account_address,
miner_acc.get_keys().account_address,
miner_acc.get_keys().account_address,
blk.miner_tx,
blobdata(),
test_generator::get_test_gentime_settings().miner_tx_max_outs,
@ -400,7 +406,8 @@ bool test_generator::build_wallets(const blockchain_vector& blocks,
currency::core_runtime_config pc = cc;
pc.min_coinstake_age = TESTS_POS_CONFIG_MIN_COINSTAKE_AGE;
pc.pos_minimum_heigh = TESTS_POS_CONFIG_POS_MINIMUM_HEIGH;
pc.hard_fork1_starts_after_height = m_hardfork_after_heigh;
pc.hard_fork_01_starts_after_height = m_hardfork_01_after_heigh;
pc.hard_fork_02_starts_after_height = m_hardfork_02_after_heigh;
wallets.back()->set_core_runtime_config(pc);
}
@ -485,7 +492,7 @@ bool test_generator::find_kernel(const std::list<currency::account_base>& accs,
uint64_t& found_timestamp,
crypto::hash& found_kh)
{
bool is_after_hardfork = blck_chain.size() > m_hardfork_after_heigh ? true : false;
bool is_after_hardfork_01 = blck_chain.size() > m_hardfork_01_after_heigh ? true : false;
uint64_t median_timestamp = get_timestamps_median(blck_chain);
wide_difficulty_type basic_diff = 0;
@ -1050,7 +1057,7 @@ bool init_output_indices(map_output_idx_t& outs, map_output_t& outs_mine, const
{
const transaction &tx = *vtx[i];
crypto::key_derivation derivation;
bool r = generate_key_derivation(get_tx_pub_key_from_extra(tx), acc_keys.m_view_secret_key, derivation);
bool r = generate_key_derivation(get_tx_pub_key_from_extra(tx), acc_keys.view_secret_key, derivation);
CHECK_AND_ASSERT_MES(r, false, "generate_key_derivation failed");
for (size_t j = 0; j < tx.vout.size(); ++j)
@ -1329,13 +1336,13 @@ bool fill_tx_sources_and_destinations(const std::vector<test_event_entry>& event
if (minimum_sigs != SIZE_MAX)
destinations.back().minimum_sigs = minimum_sigs; // set custom minimum_sigs only if != SIZE_MAX, use default in tx_destination_entry::ctor() otherwise
if (cache_back > 0)
destinations.push_back(tx_destination_entry(cache_back, from.m_account_address));
destinations.push_back(tx_destination_entry(cache_back, from.account_address));
}
else
{
tx_destination_entry change_dst = AUTO_VAL_INIT(change_dst);
if (cache_back > 0)
change_dst = tx_destination_entry(cache_back, from.m_account_address);
change_dst = tx_destination_entry(cache_back, from.account_address);
std::vector<tx_destination_entry> dsts(1, tx_destination_entry(amount, to.back()));
uint64_t dust = 0;
const test_gentime_settings& tgs = test_generator::get_test_gentime_settings();
@ -1417,8 +1424,8 @@ bool construct_miner_tx_manually(size_t height, uint64_t already_generated_coins
crypto::key_derivation derivation;
crypto::public_key out_eph_public_key;
crypto::generate_key_derivation(miner_address.m_view_public_key, txkey.sec, derivation);
crypto::derive_public_key(derivation, 0, miner_address.m_spend_public_key, out_eph_public_key);
crypto::generate_key_derivation(miner_address.view_public_key, txkey.sec, derivation);
crypto::derive_public_key(derivation, 0, miner_address.spend_public_key, out_eph_public_key);
tx_out out;
out.amount = block_reward;
@ -1544,7 +1551,7 @@ 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.m_account_address)); // change
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);
}

View file

@ -524,14 +524,15 @@ public:
static void set_test_gentime_settings_default() { m_test_gentime_settings = m_test_gentime_settings_default; }
void set_pos_to_low_timestamp(bool do_pos_to_low_timestamp) { m_do_pos_to_low_timestamp = do_pos_to_low_timestamp; }
void set_ignore_last_pow_in_wallets(bool ignore_last_pow_in_wallets) { m_ignore_last_pow_in_wallets = ignore_last_pow_in_wallets; }
void set_hardfork_height(uint64_t h);
void set_hardfork_height(size_t hardfork_id, uint64_t h);
private:
bool m_do_pos_to_low_timestamp;
bool m_ignore_last_pow_in_wallets;
uint64_t m_last_found_timestamp;
uint64_t m_hardfork_after_heigh;
uint64_t m_hardfork_01_after_heigh;
uint64_t m_hardfork_02_after_heigh;
std::unordered_map<crypto::hash, block_info> m_blocks_info;
static test_gentime_settings m_test_gentime_settings;

View file

@ -88,7 +88,7 @@ bool gen_double_spend_in_tx<txs_kept_by_block>::generate(std::vector<test_event_
sources.push_back(se);
currency::tx_destination_entry de = AUTO_VAL_INIT(de);
de.addr.push_back(alice_account.get_keys().m_account_address);
de.addr.push_back(alice_account.get_keys().account_address);
de.amount = 2 * se.amount - TESTS_DEFAULT_FEE;
std::vector<currency::tx_destination_entry> destinations;
destinations.push_back(de);

View file

@ -186,29 +186,29 @@ inline bool build_custom_escrow_template(const std::vector<test_event_entry>& ev
int64_t change = get_sources_total_amount(sources) - a_inputs_amount;
CHECK_AND_ASSERT_MES(change >= 0, false, "fill_tx_sources failed (2)");
if (change > 0)
destinations.push_back(tx_destination_entry(change, a_keys.m_account_address));
destinations.push_back(tx_destination_entry(change, a_keys.account_address));
if (custom_config_mask & eccf_template_no_multisig)
destinations.push_back(tx_destination_entry(ms_amount, a_keys.m_account_address)); // incorrect
destinations.push_back(tx_destination_entry(ms_amount, a_keys.account_address)); // incorrect
else if (custom_config_mask & eccf_template_inv_multisig)
destinations.push_back(tx_destination_entry(ms_amount, std::list<account_public_address>({ a_keys.m_account_address, a_keys.m_account_address }))); // incorrect
destinations.push_back(tx_destination_entry(ms_amount, std::list<account_public_address>({ a_keys.account_address, a_keys.account_address }))); // incorrect
else if (custom_config_mask & eccf_template_inv_multisig_2)
{
destinations.push_back(tx_destination_entry(ms_amount, std::list<account_public_address>({ a_keys.m_account_address, a_keys.m_account_address, a_keys.m_account_address }))); // incorrect
destinations.push_back(tx_destination_entry(ms_amount, std::list<account_public_address>({ a_keys.account_address, a_keys.account_address, a_keys.account_address }))); // incorrect
destinations.back().minimum_sigs = 2; // pretend to be correct
}
else if (custom_config_mask & eccf_template_inv_multisig_low_min_sig)
{
destinations.push_back(tx_destination_entry(ms_amount, std::list<account_public_address>({ a_keys.m_account_address, cpd.b_addr }))); // seems to be correct
destinations.push_back(tx_destination_entry(ms_amount, std::list<account_public_address>({ a_keys.account_address, cpd.b_addr }))); // seems to be correct
destinations.back().minimum_sigs = 1; // incorrect
}
else if (custom_config_mask & eccf_template_more_than_1_multisig)
{
destinations.push_back(tx_destination_entry(ms_amount, std::list<account_public_address>({ a_keys.m_account_address, cpd.b_addr }))); // seems to be correct
destinations.push_back(tx_destination_entry(TESTS_DEFAULT_FEE, std::list<account_public_address>({ a_keys.m_account_address, cpd.b_addr }))); // double multisig - incorrect
destinations.push_back(tx_destination_entry(ms_amount, std::list<account_public_address>({ a_keys.account_address, cpd.b_addr }))); // seems to be correct
destinations.push_back(tx_destination_entry(TESTS_DEFAULT_FEE, std::list<account_public_address>({ a_keys.account_address, cpd.b_addr }))); // double multisig - incorrect
}
else
destinations.push_back(tx_destination_entry(ms_amount, std::list<account_public_address>({ a_keys.m_account_address, cpd.b_addr }))); // truly correct
destinations.push_back(tx_destination_entry(ms_amount, std::list<account_public_address>({ a_keys.account_address, cpd.b_addr }))); // truly correct
tx_service_attachment sa = AUTO_VAL_INIT(sa);
sa.service_id = BC_ESCROW_SERVICE_ID;
@ -302,7 +302,7 @@ inline bool build_custom_escrow_proposal(const std::vector<test_event_entry>& ev
int64_t change = get_sources_total_amount(sources) - a_fee_proposal;
CHECK_AND_ASSERT_MES(change >= 0, false, "fill_tx_sources failed (2)");
if (change > 0)
destinations.push_back(tx_destination_entry(change, a_keys.m_account_address));
destinations.push_back(tx_destination_entry(change, a_keys.account_address));
account_public_address crypt_addr = cpd.b_addr;

View file

@ -35,7 +35,7 @@ bool hard_fork_1_base_test::configure_core(currency::core& c, size_t ev_index, c
currency::core_runtime_config pc = c.get_blockchain_storage().get_core_runtime_config();
pc.min_coinstake_age = TESTS_POS_CONFIG_MIN_COINSTAKE_AGE;
pc.pos_minimum_heigh = TESTS_POS_CONFIG_POS_MINIMUM_HEIGH;
pc.hard_fork1_starts_after_height = m_hardfork_height;
pc.hard_fork_01_starts_after_height = m_hardfork_height;
c.get_blockchain_storage().set_core_runtime_config(pc);
return true;
}
@ -57,7 +57,7 @@ bool hard_fork_1_unlock_time_2_in_normal_tx::generate(std::vector<test_event_ent
GENERATE_ACCOUNT(miner_acc);
GENERATE_ACCOUNT(alice_acc);
MAKE_GENESIS_BLOCK(events, blk_0, miner_acc, test_core_time::get_time());
generator.set_hardfork_height(m_hardfork_height);
generator.set_hardfork_height(1, m_hardfork_height);
DO_CALLBACK(events, "configure_core");
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
@ -187,7 +187,7 @@ bool hard_fork_1_unlock_time_2_in_coinbase::generate(std::vector<test_event_entr
bool r = false;
GENERATE_ACCOUNT(miner_acc);
MAKE_GENESIS_BLOCK(events, blk_0, miner_acc, test_core_time::get_time());
generator.set_hardfork_height(m_hardfork_height);
generator.set_hardfork_height(1, m_hardfork_height);
DO_CALLBACK(events, "configure_core");
@ -259,7 +259,7 @@ bool hard_fork_1_chain_switch_pow_only::generate(std::vector<test_event_entry>&
GENERATE_ACCOUNT(miner_acc);
GENERATE_ACCOUNT(alice_acc);
MAKE_GENESIS_BLOCK(events, blk_0, miner_acc, test_core_time::get_time());
generator.set_hardfork_height(m_hardfork_height);
generator.set_hardfork_height(1, m_hardfork_height);
DO_CALLBACK(events, "configure_core");
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
@ -310,7 +310,7 @@ bool hard_fork_1_checkpoint_basic_test::generate(std::vector<test_event_entry>&
GENERATE_ACCOUNT(miner_acc);
GENERATE_ACCOUNT(alice_acc);
MAKE_GENESIS_BLOCK(events, blk_0, miner_acc, test_core_time::get_time());
generator.set_hardfork_height(m_hardfork_height);
generator.set_hardfork_height(1, m_hardfork_height);
DO_CALLBACK(events, "configure_core");
DO_CALLBACK_PARAMS(events, "set_checkpoint", params_checkpoint(2 * CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 7));
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
@ -477,7 +477,7 @@ bool hard_fork_1_pos_and_locked_coins::generate(std::vector<test_event_entry>& e
GENERATE_ACCOUNT(alice_acc);
GENERATE_ACCOUNT(bob_acc);
MAKE_GENESIS_BLOCK(events, blk_0, miner_acc, test_core_time::get_time());
generator.set_hardfork_height(m_hardfork_height);
generator.set_hardfork_height(1, m_hardfork_height);
DO_CALLBACK(events, "configure_core");
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 3);
@ -699,7 +699,7 @@ bool hard_fork_1_pos_locked_height_vs_time::generate(std::vector<test_event_entr
GENERATE_ACCOUNT(alice_acc);
GENERATE_ACCOUNT(bob_acc);
MAKE_GENESIS_BLOCK(events, blk_0, miner_acc, test_core_time::get_time());
generator.set_hardfork_height(m_hardfork_height);
generator.set_hardfork_height(1, m_hardfork_height);
DO_CALLBACK(events, "configure_core");
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 1);

View file

@ -33,7 +33,7 @@ bool hard_fork_1_bad_pos_source::generate(std::vector<test_event_entry>& events)
std::list<account_base> miner_acc_lst(1, miner_acc);
MAKE_GENESIS_BLOCK(events, blk_0, preminer_acc, 1564434616);
generator.set_hardfork_height(get_hardfork_height());
generator.set_hardfork_height(1, get_hardfork_height());
DO_CALLBACK(events, "configure_core");
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 5);
@ -72,7 +72,7 @@ bool hard_fork_1_bad_pos_source::configure_core(currency::core& c, size_t ev_ind
currency::core_runtime_config pc = c.get_blockchain_storage().get_core_runtime_config();
pc.min_coinstake_age = TESTS_POS_CONFIG_MIN_COINSTAKE_AGE; //four blocks
pc.pos_minimum_heigh = TESTS_POS_CONFIG_POS_MINIMUM_HEIGH; //four blocks
pc.hard_fork1_starts_after_height = get_hardfork_height();
pc.hard_fork_01_starts_after_height = get_hardfork_height();
c.get_blockchain_storage().set_core_runtime_config(pc);
return true;

View file

@ -29,7 +29,7 @@ bool hard_fork_1_cumulative_difficulty_base::generate(std::vector<test_event_ent
std::list<account_base> miner_acc_lst(1, miner_acc);
MAKE_GENESIS_BLOCK(events, blk_0, preminer_acc, 1564434616);
generator.set_hardfork_height(get_hardfork_height());
generator.set_hardfork_height(1, get_hardfork_height());
DO_CALLBACK(events, "configure_core");
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 3);
@ -62,7 +62,7 @@ bool hard_fork_1_cumulative_difficulty_base::configure_core(currency::core& c, s
currency::core_runtime_config pc = c.get_blockchain_storage().get_core_runtime_config();
pc.min_coinstake_age = TESTS_POS_CONFIG_MIN_COINSTAKE_AGE; //four blocks
pc.pos_minimum_heigh = TESTS_POS_CONFIG_POS_MINIMUM_HEIGH; //four blocks
pc.hard_fork1_starts_after_height = get_hardfork_height();
pc.hard_fork_01_starts_after_height = get_hardfork_height();
c.get_blockchain_storage().set_core_runtime_config(pc);
return true;

View file

@ -31,7 +31,7 @@ bool hard_fork_1_locked_mining_test::generate(std::vector<test_event_entry>& eve
std::list<account_base> miner_acc_lst(1, miner_acc);
MAKE_GENESIS_BLOCK(events, blk_0, preminer_acc, 1564434616);
generator.set_hardfork_height(get_hardfork_height());
generator.set_hardfork_height(1, get_hardfork_height());
DO_CALLBACK(events, "configure_core");
REWIND_BLOCKS_N_WITH_TIME(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 3);
@ -103,7 +103,7 @@ bool hard_fork_1_locked_mining_test::configure_core(currency::core& c, size_t ev
currency::core_runtime_config pc = c.get_blockchain_storage().get_core_runtime_config();
pc.min_coinstake_age = TESTS_POS_CONFIG_MIN_COINSTAKE_AGE; //four blocks
pc.pos_minimum_heigh = TESTS_POS_CONFIG_POS_MINIMUM_HEIGH; //four blocks
pc.hard_fork1_starts_after_height = get_hardfork_height();
pc.hard_fork_01_starts_after_height = get_hardfork_height();
c.get_blockchain_storage().set_core_runtime_config(pc);
return true;

View file

@ -146,7 +146,7 @@ bool gen_uint_overflow_2::generate(std::vector<test_event_entry>& events) const
}
std::vector<currency::tx_destination_entry> destinations;
const account_public_address& bob_addr = bob_account.get_keys().m_account_address;
const account_public_address& bob_addr = bob_account.get_keys().account_address;
destinations.push_back(tx_destination_entry(TX_MAX_TRANSFER_AMOUNT, bob_addr));
destinations.push_back(tx_destination_entry(TX_MAX_TRANSFER_AMOUNT - 1, bob_addr));
// sources.front().amount = destinations[0].amount + destinations[2].amount + destinations[3].amount + TESTS_DEFAULT_FEE
@ -174,7 +174,7 @@ bool gen_uint_overflow_2::generate(std::vector<test_event_entry>& events) const
destinations.clear();
currency::tx_destination_entry de;
de.addr.push_back(alice_account.get_keys().m_account_address);
de.addr.push_back(alice_account.get_keys().account_address);
de.amount = TX_MAX_TRANSFER_AMOUNT - TESTS_DEFAULT_FEE;
destinations.push_back(de);
destinations.push_back(de);

View file

@ -1370,10 +1370,10 @@ bool multisig_and_coinbase::generate(std::vector<test_event_entry>& events) cons
for (auto& p : participants)
{
crypto::key_derivation der = AUTO_VAL_INIT(der);
r = crypto::generate_key_derivation(p.m_view_public_key, tx_key.sec, der);
r = crypto::generate_key_derivation(p.view_public_key, tx_key.sec, der);
CHECK_AND_ASSERT_MES(r, false, "generate_key_derivation failed");
crypto::public_key key = AUTO_VAL_INIT(key);
r = crypto::derive_public_key(der, multisig_out_idx, p.m_spend_public_key, key);
r = crypto::derive_public_key(der, multisig_out_idx, p.spend_public_key, key);
CHECK_AND_ASSERT_MES(r, false, "derive_public_key failed");
ms_out_target.keys.push_back(key);
}

View file

@ -163,11 +163,11 @@ void pos_block_builder::step5_sign(const crypto::public_key& stake_tx_pub_key, s
CHECK_AND_ASSERT_THROW_MES(m_step == 4, "pos_block_builder: incorrect step sequence");
crypto::key_derivation pos_coin_derivation = AUTO_VAL_INIT(pos_coin_derivation);
bool r = crypto::generate_key_derivation(stake_tx_pub_key, stakeholder_account.get_keys().m_view_secret_key, pos_coin_derivation); // derivation(tx_pub; view_sec)
bool r = crypto::generate_key_derivation(stake_tx_pub_key, stakeholder_account.get_keys().view_secret_key, pos_coin_derivation); // derivation(tx_pub; view_sec)
CHECK_AND_ASSERT_THROW_MES(r, "generate_key_derivation failed");
crypto::secret_key derived_secret_ephemeral_key = AUTO_VAL_INIT(derived_secret_ephemeral_key);
crypto::derive_secret_key(pos_coin_derivation, stake_tx_out_index, stakeholder_account.get_keys().m_spend_secret_key, derived_secret_ephemeral_key); // derivation.derive(spend_sec, out_idx) => input ephemeral secret key
crypto::derive_secret_key(pos_coin_derivation, stake_tx_out_index, stakeholder_account.get_keys().spend_secret_key, derived_secret_ephemeral_key); // derivation.derive(spend_sec, out_idx) => input ephemeral secret key
// sign block actually in coinbase transaction
crypto::hash block_hash = currency::get_block_hash(m_block);
@ -216,7 +216,7 @@ bool construct_homemade_pos_miner_tx(size_t height, size_t median_size, const bo
}
// reward
bool burn_money = reward_receiving_address.m_spend_public_key == null_pkey && reward_receiving_address.m_view_public_key == null_pkey; // if true, burn reward, so no one on Earth can spend them
bool burn_money = reward_receiving_address.spend_public_key == null_pkey && reward_receiving_address.view_public_key == null_pkey; // if true, burn reward, so no one on Earth can spend them
for (size_t output_index = 0; output_index < out_amounts.size(); ++output_index)
{
txout_to_key tk;
@ -236,7 +236,7 @@ bool construct_homemade_pos_miner_tx(size_t height, size_t median_size, const bo
}
// stake
burn_money = stakeholder_address.m_spend_public_key == null_pkey && stakeholder_address.m_view_public_key == null_pkey; // if true, burn stake
burn_money = stakeholder_address.spend_public_key == null_pkey && stakeholder_address.view_public_key == null_pkey; // if true, burn stake
{
txout_to_key tk;
tk.key = null_pkey; // null means burn money

View file

@ -254,7 +254,7 @@ bool gen_pos_extra_nonce::generate(std::vector<test_event_entry>& events) const
currency::blobdata extra_none(255, 'x');
currency::extra_alias_entry alias = AUTO_VAL_INIT(alias);
alias.m_alias = std::string(255, 'a');
alias.m_address = miner.get_keys().m_account_address;
alias.m_address = miner.get_keys().account_address;
alias.m_text_comment = std::string(255, 'y');
pb.step4_generate_coinbase_tx(generator.get_timestamps_median(prev_id), generator.get_already_generated_coins(blk_0r), alice.get_public_address(), extra_none, CURRENCY_MINER_TX_MAX_OUTS, alias);
pb.step5_sign(stake_tx_pub_key, stake_output_idx, stake_output_pubkey, miner);

View file

@ -39,17 +39,17 @@ bool test_transaction_generation_and_ring_signature()
account_base rv_acc2;
rv_acc2.generate();
transaction tx_mine_1;
construct_miner_tx(0, 0, 0, 10, 0, miner_acc1.get_keys().m_account_address, miner_acc1.get_keys().m_account_address, tx_mine_1);
construct_miner_tx(0, 0, 0, 10, 0, miner_acc1.get_keys().account_address, miner_acc1.get_keys().account_address, tx_mine_1);
transaction tx_mine_2;
construct_miner_tx(0, 0, 0, 0, 0, miner_acc2.get_keys().m_account_address, miner_acc2.get_keys().m_account_address, tx_mine_2);
construct_miner_tx(0, 0, 0, 0, 0, miner_acc2.get_keys().account_address, miner_acc2.get_keys().account_address, tx_mine_2);
transaction tx_mine_3;
construct_miner_tx(0, 0, 0, 0, 0, miner_acc3.get_keys().m_account_address, miner_acc3.get_keys().m_account_address, tx_mine_3);
construct_miner_tx(0, 0, 0, 0, 0, miner_acc3.get_keys().account_address, miner_acc3.get_keys().account_address, tx_mine_3);
transaction tx_mine_4;
construct_miner_tx(0, 0, 0, 0, 0, miner_acc4.get_keys().m_account_address, miner_acc4.get_keys().m_account_address, tx_mine_4);
construct_miner_tx(0, 0, 0, 0, 0, miner_acc4.get_keys().account_address, miner_acc4.get_keys().account_address, tx_mine_4);
transaction tx_mine_5;
construct_miner_tx(0, 0, 0, 0, 0, miner_acc5.get_keys().m_account_address, miner_acc5.get_keys().m_account_address, tx_mine_5);
construct_miner_tx(0, 0, 0, 0, 0, miner_acc5.get_keys().account_address, miner_acc5.get_keys().account_address, tx_mine_5);
transaction tx_mine_6;
construct_miner_tx(0, 0, 0, 0, 0, miner_acc6.get_keys().m_account_address, miner_acc6.get_keys().m_account_address, tx_mine_6);
construct_miner_tx(0, 0, 0, 0, 0, miner_acc6.get_keys().account_address, miner_acc6.get_keys().account_address, tx_mine_6);
//fill inputs entry
typedef tx_source_entry::output_entry tx_output_entry;
@ -91,7 +91,7 @@ bool test_transaction_generation_and_ring_signature()
}
//fill outputs entry
tx_destination_entry td;
td.addr.push_back(rv_acc.get_keys().m_account_address);
td.addr.push_back(rv_acc.get_keys().account_address);
td.amount = 69368744177663;
std::vector<tx_destination_entry> destinations;
destinations.push_back(td);

View file

@ -57,11 +57,11 @@ struct tx_builder
// one destination address - create txout_to_key
crypto::public_key out_eph_public_key = currency::null_pkey; // null_pkey means "burn" money
currency::account_public_address addr = dst_entr.addr.front();
if (addr.m_view_public_key != currency::null_pkey && addr.m_spend_public_key != currency::null_pkey)
if (addr.view_public_key != currency::null_pkey && addr.spend_public_key != currency::null_pkey)
{
crypto::key_derivation derivation = AUTO_VAL_INIT(derivation);
crypto::generate_key_derivation(addr.m_view_public_key, m_tx_key.sec, derivation);
crypto::derive_public_key(derivation, output_index, addr.m_spend_public_key, out_eph_public_key);
crypto::generate_key_derivation(addr.view_public_key, m_tx_key.sec, derivation);
crypto::derive_public_key(derivation, output_index, addr.spend_public_key, out_eph_public_key);
}
currency::txout_to_key tk = AUTO_VAL_INIT(tk);
tk.mix_attr = mix_attr;
@ -76,10 +76,10 @@ struct tx_builder
for (auto& addr : dst_entr.addr)
{
crypto::key_derivation derivation = AUTO_VAL_INIT(derivation);
bool r = crypto::generate_key_derivation(addr.m_view_public_key, m_tx_key.sec, derivation);
bool r = crypto::generate_key_derivation(addr.view_public_key, m_tx_key.sec, derivation);
CHECK_AND_ASSERT_MES(r, void(0), "generate_key_derivation failed for ms output #" << output_index);
crypto::public_key out_eph_public_key = AUTO_VAL_INIT(out_eph_public_key);
r = crypto::derive_public_key(derivation, output_index, addr.m_spend_public_key, out_eph_public_key);
r = crypto::derive_public_key(derivation, output_index, addr.spend_public_key, out_eph_public_key);
CHECK_AND_ASSERT_MES(r, void(0), "derive_public_key failed for ms output #" << output_index);
ms.keys.push_back(out_eph_public_key);
}

View file

@ -789,7 +789,7 @@ bool gen_crypted_attachments::generate(std::vector<test_event_entry>& events) co
REWIND_BLOCKS_N_WITH_TIME(events, blk_5, blk_4, miner_account, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
DO_CALLBACK(events, "set_blockchain_height");
pr.acc_addr = miner_account.get_keys().m_account_address;
pr.acc_addr = miner_account.get_keys().account_address;
cm.comment = "Comandante Che Guevara";
//ms.msg = "Hasta Siempre, Comandante";

View file

@ -58,15 +58,15 @@ bool determine_tx_real_inputs(currency::core& c, const currency::transaction& tx
crypto::public_key tx_pub_key = get_tx_pub_key_from_extra(validated_tx);
crypto::key_derivation derivation;
bool r = generate_key_derivation(tx_pub_key, m_keys.m_view_secret_key, derivation);
bool r = generate_key_derivation(tx_pub_key, m_keys.view_secret_key, derivation);
CHECK_AND_ASSERT_MES(r, false, "generate_key_derivation failed");
crypto::secret_key ephemeral_secret_key;
derive_secret_key(derivation, output_tx_index, m_keys.m_spend_secret_key, ephemeral_secret_key);
derive_secret_key(derivation, output_tx_index, m_keys.spend_secret_key, ephemeral_secret_key);
crypto::public_key output_public_key = boost::get<txout_to_key>(out.target).key;
/*crypto::public_key ephemeral_public_key;
derive_public_key(derivation, output_tx_index, m_keys.m_account_address.m_spend_public_key, ephemeral_public_key);*/
derive_public_key(derivation, output_tx_index, m_keys.account_address.spend_public_key, ephemeral_public_key);*/
crypto::key_image ki;
generate_key_image(output_public_key, ephemeral_secret_key, ki);
@ -1436,7 +1436,7 @@ bool gen_wallet_decrypted_attachments::generate(std::vector<test_event_entry>& e
// these attachments will be use across all the transactions in this test
currency::tx_payer a_tx_payer = AUTO_VAL_INIT(a_tx_payer);
a_tx_payer.acc_addr = miner_acc.get_keys().m_account_address;
a_tx_payer.acc_addr = miner_acc.get_keys().account_address;
currency::tx_comment a_tx_comment = AUTO_VAL_INIT(a_tx_comment);
a_tx_comment.comment = "Comandante Che Guevara";
std::string a_tx_message = AUTO_VAL_INIT(a_tx_message);
@ -1622,7 +1622,7 @@ bool gen_wallet_alias_and_unconfirmed_txs::c1(currency::core& c, size_t ev_index
currency::extra_alias_entry ai = AUTO_VAL_INIT(ai);
ai.m_alias = std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'a');
ai.m_address = m_accounts[BOB_ACC_IDX].get_public_address();
ai.m_view_key.push_back(m_accounts[BOB_ACC_IDX].get_keys().m_view_secret_key);
ai.m_view_key.push_back(m_accounts[BOB_ACC_IDX].get_keys().view_secret_key);
uint64_t alias_reward = get_alias_coast_from_fee(ai.m_alias, TESTS_DEFAULT_FEE);
bool r = check_balance_via_wallet(*bob_wlt.get(), "bob_wlt", alias_reward * 2);
@ -1659,7 +1659,7 @@ bool gen_wallet_alias_and_unconfirmed_txs::c2(currency::core& c, size_t ev_index
currency::extra_alias_entry ai = AUTO_VAL_INIT(ai);
ai.m_alias = std::string(ALIAS_MINIMUM_PUBLIC_SHORT_NAME_ALLOWED, 'b');
ai.m_address = someone.get_public_address();
ai.m_view_key.push_back(someone.get_keys().m_view_secret_key);
ai.m_view_key.push_back(someone.get_keys().view_secret_key);
uint64_t alias_reward = get_alias_coast_from_fee(ai.m_alias, TESTS_DEFAULT_FEE);
bool r = check_balance_via_wallet(*bob_wlt.get(), "bob_wlt", alias_reward * 2);
@ -1694,9 +1694,9 @@ bool gen_wallet_alias_and_unconfirmed_txs::c3(currency::core& c, size_t ev_index
currency::extra_alias_entry ai = AUTO_VAL_INIT(ai);
ai.m_alias = "alicealice";
ai.m_address = m_accounts[MINER_ACC_IDX].get_public_address();
ai.m_view_key.push_back(m_accounts[MINER_ACC_IDX].get_keys().m_view_secret_key);
ai.m_view_key.push_back(m_accounts[MINER_ACC_IDX].get_keys().view_secret_key);
bool r = sign_extra_alias_entry(ai, m_accounts[ALICE_ACC_IDX].get_keys().m_account_address.m_spend_public_key, m_accounts[ALICE_ACC_IDX].get_keys().m_spend_secret_key);
bool r = sign_extra_alias_entry(ai, m_accounts[ALICE_ACC_IDX].get_keys().account_address.spend_public_key, m_accounts[ALICE_ACC_IDX].get_keys().spend_secret_key);
CHECK_AND_ASSERT_MES(r, false, "sign_extra_alias_entry failed");
std::vector<test_event_entry> stub_events_vec;