forked from lthn/blockchain
Merge branch 'predevelop' into wallet_delayed_outputs_sync
This commit is contained in:
commit
1698030467
12 changed files with 318 additions and 35 deletions
|
|
@ -24,8 +24,8 @@ namespace tools
|
|||
static constexpr pre_download_entry c_pre_download_lmdb = { "http://95.217.43.225/pre-download/zano_lmdb_94_524999.pak", "ac46a4932813e28fe11ec160a2be4e48c961dce701ecace5133184cff2754d3d", 747173581, 1087696896 };
|
||||
static constexpr pre_download_entry c_pre_download_mdbx = { "http://95.217.43.225/pre-download/zano_mdbx_94_524999.pak", "b195fdc1bda7173469db0b313f2ead2dbda1788639ba0aedb7001a6cc640fc47", 561335640, 1342156800 };
|
||||
#else
|
||||
static constexpr pre_download_entry c_pre_download_lmdb = { "http://95.217.43.225/pre-download/zano_testnet_lmdb_96_99000.pak", "9e8522b287ac7637ca770970542e94702f9fbaa267633cfcaeee4383dfe15bd0", 83851119, 131493888 };
|
||||
static constexpr pre_download_entry c_pre_download_mdbx = { "http://95.217.43.225/pre-download/zano_testnet_mdbx_96_99000.pak", "de33646711f2276e5b22db5741d7b2bf6a8e4c4231d393b730f9a4fce1d7ec03", 63257747, 268431360 };
|
||||
static constexpr pre_download_entry c_pre_download_lmdb = { "http://95.217.43.225/pre-download/zano_testnet_lmdb_96_349999.pak", "300a52c4c681f3d01f9d52eaca0461397a13d5507fc56438e18c3dfcb9459ebb", 345490545, 506789888 };
|
||||
static constexpr pre_download_entry c_pre_download_mdbx = { "http://95.217.43.225/pre-download/zano_testnet_mdbx_96_349999.pak", "0a3e56e915fde6b0b656014909f91726489f9478b04d39d7f4ac30fd49732909", 253066780, 536862720 };
|
||||
#endif
|
||||
|
||||
static constexpr uint64_t pre_download_min_size_difference = 512 * 1024 * 1024; // minimum difference in size between local DB and the downloadable one to start downloading
|
||||
|
|
|
|||
|
|
@ -2365,6 +2365,7 @@ bool blockchain_storage::add_out_to_get_random_outs(COMMAND_RPC_GET_RANDOM_OUTPU
|
|||
|
||||
const transaction& tx = tx_ptr->tx;
|
||||
CHECK_AND_ASSERT_MES(tx.vout[out_ptr->out_no].target.type() == typeid(txout_to_key), false, "unknown tx out type");
|
||||
const txout_to_key& otk = boost::get<txout_to_key>(tx.vout[out_ptr->out_no].target);
|
||||
|
||||
CHECK_AND_ASSERT_MES(tx_ptr->m_spent_flags.size() == tx.vout.size(), false, "internal error");
|
||||
|
||||
|
|
@ -2372,12 +2373,16 @@ bool blockchain_storage::add_out_to_get_random_outs(COMMAND_RPC_GET_RANDOM_OUTPU
|
|||
if (tx_ptr->m_spent_flags[out_ptr->out_no])
|
||||
return false;
|
||||
|
||||
// do not use burned coins
|
||||
if (otk.key == null_pkey)
|
||||
return false;
|
||||
|
||||
//check if transaction is unlocked
|
||||
if (!is_tx_spendtime_unlocked(get_tx_unlock_time(tx, out_ptr->out_no)))
|
||||
return false;
|
||||
|
||||
//use appropriate mix_attr out
|
||||
uint8_t mix_attr = boost::get<txout_to_key>(tx.vout[out_ptr->out_no].target).mix_attr;
|
||||
uint8_t mix_attr = otk.mix_attr;
|
||||
|
||||
if(mix_attr == CURRENCY_TO_KEY_OUT_FORCED_NO_MIX)
|
||||
return false; //COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS call means that ring signature will have more than one entry.
|
||||
|
|
@ -2389,7 +2394,7 @@ bool blockchain_storage::add_out_to_get_random_outs(COMMAND_RPC_GET_RANDOM_OUTPU
|
|||
|
||||
COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::out_entry& oen = *result_outs.outs.insert(result_outs.outs.end(), COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::out_entry());
|
||||
oen.global_amount_index = i;
|
||||
oen.out_key = boost::get<txout_to_key>(tx.vout[out_ptr->out_no].target).key;
|
||||
oen.out_key = otk.key;
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
|
|
@ -5157,7 +5162,7 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
|
|||
TIME_MEASURE_START_PD(tx_append_time);
|
||||
if(!add_transaction_from_block(tx, tx_id, id, current_bc_size, actual_timestamp))
|
||||
{
|
||||
LOG_PRINT_L0("Block with id: " << id << " failed to add transaction to blockchain storage");
|
||||
LOG_PRINT_L0("Block " << id << " contains tx " << tx_id << " that can't be added to the blockchain storage");
|
||||
if (taken_from_pool)
|
||||
{
|
||||
currency::tx_verification_context tvc = AUTO_VAL_INIT(tvc);
|
||||
|
|
|
|||
|
|
@ -419,15 +419,10 @@ namespace currency
|
|||
//---------------------------------------------------------------
|
||||
crypto::hash get_sign_buff_hash_for_alias_update(const extra_alias_entry& ai)
|
||||
{
|
||||
const extra_alias_entry* pale = &ai;
|
||||
extra_alias_entry eae_local = AUTO_VAL_INIT(eae_local);
|
||||
if (ai.m_sign.size())
|
||||
{
|
||||
eae_local = ai;
|
||||
eae_local.m_sign.clear();
|
||||
pale = &eae_local;
|
||||
}
|
||||
return get_object_hash(*pale);
|
||||
extra_alias_entry_old ai_old = ai.to_old();
|
||||
if (ai_old.m_sign.size())
|
||||
ai_old.m_sign.clear();
|
||||
return get_object_hash(ai_old);
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
struct tx_extra_handler : public boost::static_visitor<bool>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@
|
|||
#define PROJECT_REVISION "6"
|
||||
#define PROJECT_VERSION PROJECT_MAJOR_VERSION "." PROJECT_MINOR_VERSION "." PROJECT_REVISION
|
||||
|
||||
#define PROJECT_VERSION_BUILD_NO 87
|
||||
#define PROJECT_VERSION_BUILD_NO 88
|
||||
#define PROJECT_VERSION_BUILD_NO_STR STRINGIFY_EXPAND(PROJECT_VERSION_BUILD_NO)
|
||||
#define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO_STR "[" BUILD_COMMIT_ID "]"
|
||||
|
|
|
|||
|
|
@ -347,8 +347,8 @@ namespace plain_wallet
|
|||
//lazy to make struct for it
|
||||
std::stringstream res;
|
||||
res << "{ \"valid\": " << (valid?"true":"false") << ", \"auditable\": "
|
||||
<< (apa.flags&ACCOUNT_PUBLIC_ADDRESS_FLAG_AUDITABLE ? "true" : "false")
|
||||
<< ",\"payment_is\": " << (pid.size() ? "true" : "false") << "}";
|
||||
<< (apa.is_auditable() ? "true" : "false")
|
||||
<< ",\"payment_id\": " << (pid.size() ? "true" : "false") << "}";
|
||||
return res.str();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -628,6 +628,12 @@ void wallet2::prepare_wti_decrypted_attachments(wallet_public::wallet_transfer_i
|
|||
{
|
||||
PROFILE_FUNC("wallet2::prepare_wti_decrypted_attachments");
|
||||
|
||||
if (!wti.payment_id.empty())
|
||||
{
|
||||
LOG_ERROR("wti.payment_id is expected to be empty. Go ahead.");
|
||||
}
|
||||
get_payment_id_from_tx(decrypted_att, wti.payment_id);
|
||||
|
||||
if (wti.is_income)
|
||||
{
|
||||
account_public_address sender_address = AUTO_VAL_INIT(sender_address);
|
||||
|
|
@ -640,7 +646,11 @@ void wallet2::prepare_wti_decrypted_attachments(wallet_public::wallet_transfer_i
|
|||
if (wti.remote_addresses.empty())
|
||||
{
|
||||
handle_2_alternative_types_in_variant_container<tx_receiver, tx_receiver_old>(decrypted_att, [&](const tx_receiver& p) {
|
||||
std::string addr_str = currency::get_account_address_as_str(p.acc_addr);
|
||||
std::string addr_str;
|
||||
if (wti.payment_id.empty())
|
||||
addr_str = currency::get_account_address_as_str(p.acc_addr);
|
||||
else
|
||||
addr_str = currency::get_account_address_and_payment_id_as_str(p.acc_addr, wti.payment_id); // show integrated address if there's a payment id provided
|
||||
wti.remote_addresses.push_back(addr_str);
|
||||
LOG_PRINT_YELLOW("prepare_wti_decrypted_attachments, income=false, wti.amount = " << print_money_brief(wti.amount) << ", rem. addr = " << addr_str, LOG_LEVEL_0);
|
||||
return true; // continue iterating through the container
|
||||
|
|
@ -4019,6 +4029,9 @@ void wallet2::add_sent_tx_detailed_info(const transaction& tx,
|
|||
const std::vector<currency::tx_destination_entry>& destinations,
|
||||
const std::vector<uint64_t>& selected_transfers)
|
||||
{
|
||||
payment_id_t payment_id;
|
||||
get_payment_id_from_tx(tx.attachment, payment_id);
|
||||
|
||||
std::vector<std::string> recipients;
|
||||
std::unordered_set<account_public_address> used_addresses;
|
||||
for (const auto& d : destinations)
|
||||
|
|
@ -4026,13 +4039,13 @@ void wallet2::add_sent_tx_detailed_info(const transaction& tx,
|
|||
for (const auto& addr : d.addr)
|
||||
{
|
||||
if (used_addresses.insert(addr).second && addr != m_account.get_public_address())
|
||||
recipients.push_back(get_account_address_as_str(addr));
|
||||
recipients.push_back(payment_id.empty() ? get_account_address_as_str(addr) : get_account_address_and_payment_id_as_str(addr, payment_id));
|
||||
}
|
||||
}
|
||||
if (!recipients.size())
|
||||
{
|
||||
//transaction send to ourself
|
||||
recipients.push_back(get_account_address_as_str(m_account.get_public_address()));
|
||||
recipients.push_back(payment_id.empty() ? get_account_address_as_str(m_account.get_public_address()) : get_account_address_and_payment_id_as_str(m_account.get_public_address(), payment_id));
|
||||
}
|
||||
|
||||
add_sent_unconfirmed_tx(tx, recipients, selected_transfers, destinations);
|
||||
|
|
|
|||
|
|
@ -914,6 +914,7 @@ int main(int argc, char* argv[])
|
|||
GENERATE_AND_PLAY(get_random_outs_test);
|
||||
GENERATE_AND_PLAY(mix_attr_tests);
|
||||
GENERATE_AND_PLAY(mix_in_spent_outs);
|
||||
GENERATE_AND_PLAY(random_outs_and_burnt_coins);
|
||||
|
||||
// Block verification tests
|
||||
GENERATE_AND_PLAY(gen_block_big_major_version);
|
||||
|
|
@ -1007,6 +1008,8 @@ int main(int argc, char* argv[])
|
|||
GENERATE_AND_PLAY(hard_fork_2_no_new_structures_before_hf);
|
||||
GENERATE_AND_PLAY(hard_fork_2_awo_wallets_basic_test<true>);
|
||||
GENERATE_AND_PLAY(hard_fork_2_awo_wallets_basic_test<false>);
|
||||
GENERATE_AND_PLAY(hard_fork_2_alias_update_using_old_tx<true>);
|
||||
GENERATE_AND_PLAY(hard_fork_2_alias_update_using_old_tx<false>);
|
||||
|
||||
|
||||
// GENERATE_AND_PLAY(gen_block_reward);
|
||||
|
|
|
|||
|
|
@ -58,5 +58,132 @@ bool get_random_outs_test::check_get_rand_outs(currency::core& c, size_t ev_inde
|
|||
c.get_blockchain_storage().get_random_outs_for_amounts(req, res);
|
||||
CHECK_AND_ASSERT_MES(res.outs[0].outs.size() == 3, false, "Incorrect number of random outs returned.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
random_outs_and_burnt_coins::random_outs_and_burnt_coins()
|
||||
{
|
||||
REGISTER_CALLBACK_METHOD(random_outs_and_burnt_coins, c1);
|
||||
}
|
||||
|
||||
bool random_outs_and_burnt_coins::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
// Test idead: make sure burned coins (that are technically will NEVER EVER been spent)
|
||||
// cannot be used for mixing in, as it reduces anonimity.
|
||||
|
||||
bool r = false;
|
||||
|
||||
m_accounts.resize(TOTAL_ACCS_COUNT);
|
||||
account_base& miner_acc = m_accounts[MINER_ACC_IDX]; miner_acc.generate();
|
||||
account_base& alice_acc = m_accounts[ALICE_ACC_IDX]; alice_acc.generate();
|
||||
account_base& bob_acc = m_accounts[BOB_ACC_IDX]; bob_acc.generate();
|
||||
|
||||
MAKE_GENESIS_BLOCK(events, blk_0, miner_acc, test_core_time::get_time());
|
||||
REWIND_BLOCKS_N(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 4);
|
||||
|
||||
// find unique amount and store it to m_amount
|
||||
uint64_t stub;
|
||||
r = calculate_amounts_many_outs_have_and_no_outs_have(get_outs_money_amount(blk_0r.miner_tx), stub, m_amount);
|
||||
CHECK_AND_ASSERT_MES(r, false, "calculate_amounts_many_outs_have_and_no_outs_have failed");
|
||||
|
||||
// prepare fake outputs and burn it
|
||||
// make m_fake_amounts_count outputs each of amount amount_no_outs_have
|
||||
std::vector<tx_destination_entry> destinations;
|
||||
for(size_t i = 0; i < m_fake_amounts_count; ++i)
|
||||
destinations.push_back(tx_destination_entry(m_amount, null_pub_addr));
|
||||
std::vector<tx_source_entry> sources;
|
||||
|
||||
r = fill_tx_sources(sources, events, blk_0r, miner_acc.get_keys(), m_amount * m_fake_amounts_count + TESTS_DEFAULT_FEE, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "fill_tx_sources failed");
|
||||
|
||||
transaction tx_0 = AUTO_VAL_INIT(tx_0);
|
||||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_0, 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
uint64_t burned_tx_amount_total = get_burned_amount(tx_0);
|
||||
CHECK_AND_ASSERT_MES(burned_tx_amount_total == m_fake_amounts_count * m_amount, false, "incorrect value of burned amount: " << burned_tx_amount_total << ", expected: " << m_fake_amounts_count * m_amount);
|
||||
|
||||
events.push_back(tx_0);
|
||||
|
||||
// send to Alice amount_no_outs_have coins
|
||||
MAKE_TX(events, tx_1, miner_acc, alice_acc, m_amount, blk_0r);
|
||||
|
||||
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, std::list<transaction>({tx_0, tx_1}));
|
||||
|
||||
MAKE_NEXT_BLOCK(events, blk_2, blk_1, miner_acc);
|
||||
|
||||
DO_CALLBACK(events, "c1");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool random_outs_and_burnt_coins::c1(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool: " << c.get_pool_transactions_count());
|
||||
|
||||
std::shared_ptr<tools::wallet2> miner_wlt = init_playtime_test_wallet(events, c, m_accounts[MINER_ACC_IDX]);
|
||||
std::shared_ptr<tools::wallet2> alice_wlt = init_playtime_test_wallet(events, c, m_accounts[ALICE_ACC_IDX]);
|
||||
std::shared_ptr<tools::wallet2> bob_wlt = init_playtime_test_wallet(events, c, m_accounts[BOB_ACC_IDX]);
|
||||
|
||||
bool r = mine_next_pow_blocks_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c, WALLET_DEFAULT_TX_SPENDABLE_AGE);
|
||||
CHECK_AND_ASSERT_MES(r, false, "mine_next_pow_blocks_in_playtime failed");
|
||||
|
||||
CHECK_AND_ASSERT_MES(refresh_wallet_and_check_balance("", "Alice", alice_wlt,
|
||||
m_amount, // expected total
|
||||
false,
|
||||
CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 6 + WALLET_DEFAULT_TX_SPENDABLE_AGE,
|
||||
m_amount // expected unlocked
|
||||
), false, "");
|
||||
|
||||
std::vector<tx_destination_entry> destinations({tx_destination_entry(m_amount - TESTS_DEFAULT_FEE, m_accounts[BOB_ACC_IDX].get_public_address())});
|
||||
|
||||
// make sure it's impossible to mixin an output with m_amount amount (because each one is burned)
|
||||
for (uint64_t fake_outs = m_fake_amounts_count + 1; fake_outs > 0; --fake_outs)
|
||||
{
|
||||
LOG_PRINT_L0("trying transfer with fake_outs = " << fake_outs);
|
||||
r = false;
|
||||
try
|
||||
{
|
||||
alice_wlt->transfer(destinations, fake_outs, 0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment);
|
||||
}
|
||||
catch (tools::error::not_enough_outs_to_mix&)
|
||||
{
|
||||
r = true;
|
||||
}
|
||||
CHECK_AND_ASSERT_MES(r, false, "exception was not cought as expected for fake_outs = " << fake_outs);
|
||||
}
|
||||
|
||||
|
||||
// make normal output with m_amount amount and try to use it as mixin
|
||||
miner_wlt->refresh();
|
||||
miner_wlt->transfer(m_amount, m_accounts[BOB_ACC_IDX].get_public_address());
|
||||
|
||||
// miner few blocks to make it mixable
|
||||
r = mine_next_pow_blocks_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c, WALLET_DEFAULT_TX_SPENDABLE_AGE);
|
||||
CHECK_AND_ASSERT_MES(r, false, "mine_next_pow_blocks_in_playtime failed");
|
||||
|
||||
alice_wlt->refresh();
|
||||
|
||||
// try with 2 fake outputs -- should not work, as we've just added to the blockchain only one
|
||||
r = false;
|
||||
try
|
||||
{
|
||||
alice_wlt->transfer(destinations, 2 /* fake outs count */, 0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment);
|
||||
}
|
||||
catch (tools::error::not_enough_outs_to_mix&)
|
||||
{
|
||||
r = true;
|
||||
}
|
||||
CHECK_AND_ASSERT_MES(r, false, "exception was not cought as expected");
|
||||
|
||||
// one mixin should perfectly work
|
||||
alice_wlt->transfer(destinations, 1 /* fake outs count */, 0, TESTS_DEFAULT_FEE, empty_extra, empty_attachment);
|
||||
|
||||
// check Bob's balance
|
||||
CHECK_AND_ASSERT_MES(refresh_wallet_and_check_balance("", "Bob", bob_wlt, m_amount * 2 - TESTS_DEFAULT_FEE, false, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 6 + WALLET_DEFAULT_TX_SPENDABLE_AGE * 2), false, "");
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#pragma once
|
||||
#include "chaingen.h"
|
||||
#include "wallet_tests_basic.h"
|
||||
|
||||
struct get_random_outs_test : public test_chain_unit_enchanced
|
||||
{
|
||||
|
|
@ -16,3 +17,13 @@ struct get_random_outs_test : public test_chain_unit_enchanced
|
|||
private:
|
||||
mutable uint64_t m_amount;
|
||||
};
|
||||
|
||||
struct random_outs_and_burnt_coins : public wallet_test
|
||||
{
|
||||
random_outs_and_burnt_coins();
|
||||
bool generate(std::vector<test_event_entry>& events) const;
|
||||
bool c1(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
|
||||
|
||||
mutable uint64_t m_amount;
|
||||
static constexpr uint64_t m_fake_amounts_count = 3;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1114,3 +1114,131 @@ template hard_fork_2_awo_wallets_basic_test<false>::hard_fork_2_awo_wallets_basi
|
|||
template bool hard_fork_2_awo_wallets_basic_test<false>::generate(std::vector<test_event_entry>& events) const;
|
||||
template hard_fork_2_awo_wallets_basic_test<true>::hard_fork_2_awo_wallets_basic_test();
|
||||
template bool hard_fork_2_awo_wallets_basic_test<true>::generate(std::vector<test_event_entry>& events) const;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
template<bool before_hf_2>
|
||||
hard_fork_2_alias_update_using_old_tx<before_hf_2>::hard_fork_2_alias_update_using_old_tx()
|
||||
: hard_fork_2_base_test(before_hf_2 ? 100 : 3)
|
||||
{
|
||||
REGISTER_CALLBACK_METHOD(hard_fork_2_alias_update_using_old_tx, c1);
|
||||
|
||||
random_state_test_restorer::reset_random(0); // deterministic test
|
||||
}
|
||||
|
||||
template<bool before_hf_2>
|
||||
bool hard_fork_2_alias_update_using_old_tx<before_hf_2>::generate(std::vector<test_event_entry>& events) const
|
||||
{
|
||||
// Test idea: make sure that if old, pre-auditable and pre-HF2 code updates an alias is it correctly handled by the most most recent code
|
||||
// TODO: difficult to support, we need to implement it another way
|
||||
|
||||
bool r = false;
|
||||
uint64_t ts = 1591713000;
|
||||
test_core_time::adjust(ts);
|
||||
|
||||
m_accounts.resize(TOTAL_ACCS_COUNT);
|
||||
account_base& miner_acc = m_accounts[MINER_ACC_IDX]; miner_acc.generate(); // miner_acc.restore_from_braindata("use use use use use use use use use use use use use use use use use use use use use use use use out");
|
||||
miner_acc.set_createtime(ts);
|
||||
account_base& alice_acc = m_accounts[ALICE_ACC_IDX]; alice_acc.generate(); // alice_acc.restore_from_braindata("any any any any any any any any any any any any any any any any any any any any any any any any out");
|
||||
alice_acc.set_createtime(ts);
|
||||
|
||||
MAKE_GENESIS_BLOCK(events, blk_0, miner_acc, ts);
|
||||
set_hard_fork_heights_to_generator(generator);
|
||||
DO_CALLBACK(events, "configure_core");
|
||||
events.push_back(event_core_time(ts));
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
REWIND_BLOCKS_N_WITH_TIME(events, blk_1r, blk_1, miner_acc, WALLET_DEFAULT_TX_SPENDABLE_AGE);
|
||||
|
||||
DO_CALLBACK(events, "c1");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template<bool before_hf_2>
|
||||
bool hard_fork_2_alias_update_using_old_tx<before_hf_2>::c1(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
|
||||
{
|
||||
bool r = false, stub_bool = false;
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool: " << c.get_pool_transactions_count());
|
||||
std::shared_ptr<tools::wallet2> miner_wlt = init_playtime_test_wallet(events, c, MINER_ACC_IDX);
|
||||
std::shared_ptr<tools::wallet2> alice_wlt = init_playtime_test_wallet(events, c, ALICE_ACC_IDX);
|
||||
|
||||
CHECK_AND_ASSERT_MES(refresh_wallet_and_check_balance("", "Alice", alice_wlt, MK_TEST_COINS(110), false, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 1 + WALLET_DEFAULT_TX_SPENDABLE_AGE), false, "");
|
||||
|
||||
extra_alias_entry ai = AUTO_VAL_INIT(ai);
|
||||
ai.m_alias = "alicealice";
|
||||
ai.m_address = m_accounts[ALICE_ACC_IDX].get_public_address();
|
||||
uint64_t alias_reward = get_alias_coast_from_fee(ai.m_alias, TESTS_DEFAULT_FEE);
|
||||
transaction res_tx = AUTO_VAL_INIT(res_tx);
|
||||
alice_wlt->request_alias_registration(ai, res_tx, TESTS_DEFAULT_FEE, alias_reward);
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool: " << c.get_pool_transactions_count());
|
||||
r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
|
||||
CHECK_AND_ASSERT_MES(r, false, "mine_next_pow_block_in_playtime failed");
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool: " << c.get_pool_transactions_count());
|
||||
|
||||
|
||||
// make sure the aliase registration is correct
|
||||
extra_alias_entry_base eaeb = AUTO_VAL_INIT(eaeb);
|
||||
r = c.get_blockchain_storage().get_alias_info("alicealice", eaeb);
|
||||
CHECK_AND_ASSERT_MES(r && eaeb.m_address == m_accounts[ALICE_ACC_IDX].get_public_address(), false, "aliase check failed: alicealice");
|
||||
|
||||
extra_alias_entry ai_upd = ai;
|
||||
|
||||
// update alias, change comment and address
|
||||
ai_upd.m_text_comment = "Hello miner!";
|
||||
ai_upd.m_address = m_accounts[MINER_ACC_IDX].get_public_address();
|
||||
|
||||
|
||||
/*
|
||||
//
|
||||
// Send tx and print it's blob
|
||||
// this code was used to generate old-style tx in develop branch, commit 36eabb916b95c7db06bdfb5d34d9820bd94b82df
|
||||
//
|
||||
transaction tx_upd = AUTO_VAL_INIT(tx_upd);
|
||||
alice_wlt->request_alias_update(ai_upd, tx_upd, TESTS_DEFAULT_FEE, 0);
|
||||
std::string tx_upd_hex = epee::string_tools::buff_to_hex_nodelimer(t_serializable_object_to_blob(tx_upd));
|
||||
LOG_PRINT_L0("tx upd: " << ENDL << tx_upd_hex);
|
||||
*/
|
||||
|
||||
|
||||
// use prepared tx blob
|
||||
std::string tx_upd_hex("01010180988be49903011a0100000000000000ff593921b61d52e818058ef881764383fe9fb0cf4512da460daf477e3a216144000180d0dbc3f402037c2e68e9c60914d369dc53fcc91522dcec284e1b7c1604ccc3d8fcf67e2da0790003140a616c696365616c696365efdcf084d7af59e0d68e8bda3ff4514a02d812ccfd6a09f69811c5a6a1b035c9b1b2395fcd84283d02e2fc4f37395ac9d8f01ff3f1ad1b94a26aaf1c76bb39d00c48656c6c6f206d696e657221000118faf7b79730fd6c1ec5c918891e264e959749a0d8eebc7997b503bd185ef100fd9e0150c175e0f048ee729137ceed035e9145d7857eae9ab786dd319fe6520b16b0cc0d6a8766cd098fe5a42875243789cc3b4bf66ee0c12ff6ef2fc179d4cef50b0288360101f3012451b07e58e742c020d68e8ff6db2905fa3aad78806ba80b16f3c861ee09f79817ea1ec36b0e30c7be5412daf59bcbc34410461a0d126de4a2dd897ecf0200");
|
||||
std::string tx_upd_blob;
|
||||
r = epee::string_tools::parse_hexstr_to_binbuff(tx_upd_hex, tx_upd_blob);
|
||||
CHECK_AND_ASSERT_MES(r, false, "parse_hexstr_to_binbuff failed");
|
||||
//r = t_unserializable_object_from_blob(tx_upd, tx_upd_blob);
|
||||
//CHECK_AND_ASSERT_MES(r, false, "t_unserializable_object_from_blob failed");
|
||||
tx_verification_context tvc = AUTO_VAL_INIT(tvc);
|
||||
r = c.handle_incoming_tx(tx_upd_blob, tvc, false);
|
||||
CHECK_AND_ASSERT_MES(r, false, "handle_incoming_tx failed");
|
||||
|
||||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Incorrect txs count in the pool: " << c.get_pool_transactions_count());
|
||||
r = mine_next_pow_block_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c);
|
||||
CHECK_AND_ASSERT_MES(r, false, "mine_next_pow_block_in_playtime failed");
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool: " << c.get_pool_transactions_count());
|
||||
|
||||
// make sure the aliase registration is correct
|
||||
eaeb = AUTO_VAL_INIT(eaeb);
|
||||
r = c.get_blockchain_storage().get_alias_info("alicealice", eaeb);
|
||||
CHECK_AND_ASSERT_MES(r && eaeb.m_address == m_accounts[MINER_ACC_IDX].get_public_address() && eaeb.m_text_comment == ai_upd.m_text_comment, false, "updated alias check failed: alicealice");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template hard_fork_2_alias_update_using_old_tx<false>::hard_fork_2_alias_update_using_old_tx();
|
||||
template bool hard_fork_2_alias_update_using_old_tx<false>::generate(std::vector<test_event_entry>& events) const;
|
||||
template hard_fork_2_alias_update_using_old_tx<true>::hard_fork_2_alias_update_using_old_tx();
|
||||
template bool hard_fork_2_alias_update_using_old_tx<true>::generate(std::vector<test_event_entry>& events) const;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "chaingen.h"
|
||||
#include "wallet_tests_basic.h"
|
||||
#include "random_helper.h"
|
||||
|
||||
struct hard_fork_2_base_test : virtual public test_chain_unit_enchanced
|
||||
{
|
||||
|
|
@ -60,9 +61,20 @@ struct hard_fork_2_no_new_structures_before_hf : public wallet_test, public hard
|
|||
template<bool before_hf_2>
|
||||
struct hard_fork_2_awo_wallets_basic_test : public wallet_test, public hard_fork_2_base_test
|
||||
{
|
||||
//using hard_fork_2_base_test::check_block_verification_context; // this is necessary for correct work of do_check_block_verification_context, consider rafactoring
|
||||
|
||||
hard_fork_2_awo_wallets_basic_test();
|
||||
bool generate(std::vector<test_event_entry>& events) const;
|
||||
bool c1(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
|
||||
};
|
||||
|
||||
template<bool before_hf_2>
|
||||
struct hard_fork_2_alias_update_using_old_tx : public wallet_test, public hard_fork_2_base_test
|
||||
{
|
||||
//using hard_fork_2_base_test::check_block_verification_context; // this is necessary for correct work of do_check_block_verification_context, consider rafactoring
|
||||
|
||||
hard_fork_2_alias_update_using_old_tx();
|
||||
bool generate(std::vector<test_event_entry>& events) const;
|
||||
bool c1(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
|
||||
|
||||
random_state_test_restorer m_random_state_restorer;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -91,11 +91,8 @@ echo '%version%'
|
|||
|
||||
set build_zip_filename=%ACHIVE_NAME_PREFIX%%version%.zip
|
||||
set build_zip_path=%BUILDS_PATH%\builds\%build_zip_filename%
|
||||
set pdbs_zip_filename=%ACHIVE_NAME_PREFIX%%version%_pdbs.zip
|
||||
set pdbs_zip_path=%BUILDS_PATH%\builds\%pdbs_zip_filename%
|
||||
|
||||
del /F /Q %build_zip_path%
|
||||
del /F /Q %pdbs_zip_path%
|
||||
|
||||
cd src\release
|
||||
|
||||
|
|
@ -109,13 +106,12 @@ mkdir bunch
|
|||
copy /Y Zano.exe bunch
|
||||
copy /Y zanod.exe bunch
|
||||
copy /Y simplewallet.exe bunch
|
||||
copy /Y *.pdb bunch
|
||||
|
||||
%QT_PREFIX_PATH%\bin\windeployqt.exe bunch\Zano.exe
|
||||
|
||||
cd bunch
|
||||
|
||||
zip -9 %pdbs_zip_path% ..\*.pdb
|
||||
|
||||
zip -r %build_zip_path% *.*
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
goto error
|
||||
|
|
@ -196,14 +192,7 @@ IF %ERRORLEVEL% NEQ 0 (
|
|||
)
|
||||
call :sha256 %build_zip_path% build_zip_checksum
|
||||
|
||||
pscp -load zano_build_server %pdbs_zip_path% build.zano.org:/var/www/html/builds
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
@echo "FAILED TO UPLOAD PDBS TO SERVER"
|
||||
goto error
|
||||
)
|
||||
call :sha256 %pdbs_zip_path% pdbs_zip_path_checksum
|
||||
|
||||
set mail_msg="New %build_prefix% %TESTNET_LABEL%build for win-x64:<br>INST: http://build.zano.org:8081/builds/%installer_file% <br>sha256: %installer_checksum%<br><br>ZIP: http://build.zano.org:8081/builds/%build_zip_filename% <br>sha256: %build_zip_checksum%<br>PDBs: http://build.zano.org:8081/builds/%pdbs_zip_filename% <br>sha256: %pdbs_zip_path_checksum%"
|
||||
set mail_msg="New %build_prefix% %TESTNET_LABEL%build for win-x64:<br>INST: http://build.zano.org:8081/builds/%installer_file% <br>sha256: %installer_checksum%<br><br>ZIP: http://build.zano.org:8081/builds/%build_zip_filename% <br>sha256: %build_zip_checksum%<br>"
|
||||
|
||||
echo %mail_msg%
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue