1
0
Fork 0
forked from lthn/blockchain

unit_tests fixed

This commit is contained in:
sowle 2020-04-23 14:56:03 +03:00
parent 5724cd969c
commit 145dd6b024
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC
4 changed files with 17 additions and 17 deletions

View file

@ -900,10 +900,10 @@ namespace crypto {
return o <<
"account: " << std::endl <<
" addr: " << get_account_address_as_str(acc.get_public_address()) << std::endl <<
" spend secret key: " << acc.get_keys().m_spend_secret_key << std::endl <<
" spend public key: " << acc.get_public_address().m_spend_public_key << std::endl <<
" view secret key: " << acc.get_keys().m_view_secret_key << std::endl <<
" view public key: " << acc.get_public_address().m_view_public_key << std::endl <<
" spend secret key: " << acc.get_keys().spend_secret_key << std::endl <<
" spend public key: " << acc.get_public_address().spend_public_key << std::endl <<
" view secret key: " << acc.get_keys().view_secret_key << std::endl <<
" view public key: " << acc.get_public_address().view_public_key << std::endl <<
" timestamp: " << acc.get_createtime();
}
}
@ -1140,7 +1140,7 @@ void append_vector_by_another_vector(U& dst, const V& src)
#define MAKE_MINER_TX_AND_KEY_MANUALLY(TX, PREV_BLOCK, P_KEYPAIR) \
transaction TX; \
if (!construct_miner_tx_manually(get_block_height(PREV_BLOCK) + 1, generator.get_already_generated_coins(PREV_BLOCK), \
miner_account.get_keys().m_account_address, TX, 0, P_KEYPAIR)) \
miner_account.get_keys().account_address, TX, 0, P_KEYPAIR)) \
return false;
#define MAKE_MINER_TX_MANUALLY(TX, PREV_BLOCK) MAKE_MINER_TX_AND_KEY_MANUALLY(TX, PREV_BLOCK, nullptr)

View file

@ -193,9 +193,9 @@ inline bool resign_tx(const currency::account_keys& sender_keys, const std::vect
crypto::secret_key in_ephemeral_sec = AUTO_VAL_INIT(in_ephemeral_sec);
crypto::key_derivation recv_derivation = AUTO_VAL_INIT(recv_derivation);
if (!crypto::generate_key_derivation(se.real_out_tx_key, sender_keys.m_view_secret_key, recv_derivation))
if (!crypto::generate_key_derivation(se.real_out_tx_key, sender_keys.view_secret_key, recv_derivation))
return false;
crypto::derive_secret_key(recv_derivation, se.real_output_in_tx_index, sender_keys.m_spend_secret_key, in_ephemeral_sec);
crypto::derive_secret_key(recv_derivation, se.real_output_in_tx_index, sender_keys.spend_secret_key, in_ephemeral_sec);
tx.signatures.push_back(std::vector<crypto::signature>());
std::vector<crypto::signature>& sigs = tx.signatures.back();

View file

@ -518,8 +518,8 @@ TEST(integ_address, payment_id_sizes)
crypto::generate_random_bytes(pid_size, &payment_id.front());
currency::account_public_address addr;
addr.m_spend_public_key = currency::keypair::generate().pub;
addr.m_view_public_key = currency::keypair::generate().pub;
addr.spend_public_key = currency::keypair::generate().pub;
addr.view_public_key = currency::keypair::generate().pub;
std::string addr_str = currency::get_account_address_and_payment_id_as_str(addr, payment_id);
@ -538,8 +538,8 @@ TEST(integ_address, payment_id_sizes)
crypto::generate_random_bytes(pid_size, &payment_id.front());
currency::account_public_address addr;
addr.m_spend_public_key = currency::keypair::generate().pub;
addr.m_view_public_key = currency::keypair::generate().pub;
addr.spend_public_key = currency::keypair::generate().pub;
addr.view_public_key = currency::keypair::generate().pub;
// the following line is expected to handle oversized payment id well
std::string addr_str = currency::get_account_address_and_payment_id_as_str(addr, payment_id);

View file

@ -14,7 +14,7 @@ TEST(parse_and_validate_tx_extra, is_correct_parse_and_validate_tx_extra)
currency::account_base acc;
acc.generate();
currency::blobdata b = "dsdsdfsdfsf";
bool r = currency::construct_miner_tx(0, 0, 10000000000000, 1000, TESTS_DEFAULT_FEE, acc.get_keys().m_account_address, acc.get_keys().m_account_address, tx, b, 1);
bool r = currency::construct_miner_tx(0, 0, 10000000000000, 1000, TESTS_DEFAULT_FEE, acc.get_keys().account_address, acc.get_keys().account_address, tx, b, 1);
ASSERT_TRUE(r);
crypto::public_key tx_pub_key;
r = currency::parse_and_validate_tx_extra(tx, tx_pub_key);
@ -26,7 +26,7 @@ TEST(parse_and_validate_tx_extra, is_correct_extranonce_too_big)
currency::account_base acc;
acc.generate();
currency::blobdata b(260, 0);
bool r = currency::construct_miner_tx(0, 0, 10000000000000, 1000, TESTS_DEFAULT_FEE, acc.get_keys().m_account_address, acc.get_keys().m_account_address, tx, b, 1);
bool r = currency::construct_miner_tx(0, 0, 10000000000000, 1000, TESTS_DEFAULT_FEE, acc.get_keys().account_address, acc.get_keys().account_address, tx, b, 1);
ASSERT_FALSE(r);
}
@ -90,8 +90,8 @@ void force_random(forced_to_pod_t& o)
// currency::tx_extra_info ei = AUTO_VAL_INIT(ei);
// bool r = parse_and_validate_tx_extra(miner_tx, ei);
// ASSERT_TRUE(r);
// if(!(ei.m_alias.m_address.m_spend_public_key == alias.m_address.m_spend_public_key &&
// ei.m_alias.m_address.m_view_public_key == alias.m_address.m_view_public_key &&
// if(!(ei.m_alias.m_address.spend_public_key == alias.m_address.spend_public_key &&
// ei.m_alias.m_address.view_public_key == alias.m_address.view_public_key &&
// ei.m_alias.m_alias == alias.m_alias &&
// ei.m_alias.m_sign == alias.m_sign &&
// ei.m_alias.m_text_comment == alias.m_text_comment &&
@ -110,8 +110,8 @@ void force_random(forced_to_pod_t& o)
// ei = AUTO_VAL_INIT(ei);
// r = parse_and_validate_tx_extra(miner_tx, ei);
// ASSERT_TRUE(r);
// if (!(ei.m_alias.m_address.m_spend_public_key == alias.m_address.m_spend_public_key &&
// ei.m_alias.m_address.m_view_public_key == alias.m_address.m_view_public_key &&
// if (!(ei.m_alias.m_address.spend_public_key == alias.m_address.spend_public_key &&
// ei.m_alias.m_address.view_public_key == alias.m_address.view_public_key &&
// ei.m_alias.m_alias == alias.m_alias &&
// ei.m_alias.m_sign == alias.m_sign &&
// ei.m_alias.m_text_comment == alias.m_text_comment &&