1
0
Fork 0
forked from lthn/blockchain

coretests: zarcanum_basic_tests improved to check post-HF4 transfers via wallet2 with mixins (exposes a bug atm) + overloaded wallet2::transfer()

This commit is contained in:
sowle 2022-11-23 15:10:06 +01:00
parent 3ff4a69945
commit 068d606557
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC
3 changed files with 19 additions and 2 deletions

View file

@ -1890,6 +1890,21 @@ void wallet2::transfer(uint64_t amount, const currency::account_public_address&
this->transfer(dst, 0, 0, TX_DEFAULT_FEE, extra, attachments, get_current_split_strategy(), tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), result_tx);
}
//----------------------------------------------------------------------------------------------------
void wallet2::transfer(uint64_t amount, size_t fake_outs_count, const currency::account_public_address& acc, uint64_t fee /* = TX_DEFAULT_FEE*/,
const crypto::hash& asset_id /* = currency::null_hash */)
{
std::vector<currency::extra_v> extra;
std::vector<currency::attachment_v> attachments;
transaction result_tx = AUTO_VAL_INIT(result_tx);
std::vector<tx_destination_entry> dst;
dst.resize(1);
dst.back().addr.push_back(acc);
dst.back().amount = amount;
dst.back().asset_id = asset_id;
this->transfer(dst, fake_outs_count, 0, fee, extra, attachments, get_current_split_strategy(), tools::tx_dust_policy(DEFAULT_DUST_THRESHOLD), result_tx);
}
//----------------------------------------------------------------------------------------------------
void wallet2::transfer(uint64_t amount, const currency::account_public_address& acc, const crypto::hash& asset_id)
{
transaction result_tx = AUTO_VAL_INIT(result_tx);

View file

@ -571,6 +571,7 @@ namespace tools
uint64_t unlocked_balance() const;
void transfer(uint64_t amount, const currency::account_public_address& acc, const crypto::hash& asset_id = currency::null_hash);
void transfer(uint64_t amount, size_t fake_outs_count, const currency::account_public_address& acc, uint64_t fee = TX_DEFAULT_FEE, const crypto::hash& asset_id = currency::null_hash);
void transfer(uint64_t amount, const currency::account_public_address& acc, currency::transaction& result_tx, const crypto::hash& asset_id = currency::null_hash);
void transfer(const std::vector<currency::tx_destination_entry>& dsts,

View file

@ -131,9 +131,10 @@ bool zarcanum_basic_test::c1(currency::core& c, size_t ev_index, const std::vect
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt, "Alice", transfer_amount * batches_to_Alice_count, UINT64_MAX, transfer_amount * batches_to_Alice_count), false, "");
//create transfer from post-zarcanum inputs to post-zarcanum inputs
//create transfer from post-zarcanum inputs to post-zarcanum inputs with mixins
uint64_t transfer_amount2 = AMOUNT_TO_TRANSFER_ZARCANUM_BASIC;
alice_wlt->transfer(transfer_amount2, m_accounts[BOB_ACC_IDX].get_public_address());
size_t nmix = 10;
alice_wlt->transfer(transfer_amount2, nmix, m_accounts[BOB_ACC_IDX].get_public_address());
LOG_PRINT_MAGENTA("Zarcanum-2-zarcanum transaction sent from Alice to Bob " << print_money_brief(transfer_amount2), LOG_LEVEL_0);