forked from lthn/blockchain
wallet sync state moved to separate base structure
This commit is contained in:
parent
b7a145e56f
commit
ebb8f7b6ff
18 changed files with 203 additions and 653 deletions
|
|
@ -18,6 +18,7 @@ template<size_t A, size_t B> struct TAssertEquality {
|
|||
|
||||
|
||||
#define BOOST_SERIALIZE(x) _arch & x;
|
||||
#define BOOST_SERIALIZE_BASE_CLASS(class_type) _arch & static_cast<class_type&>(*this);
|
||||
|
||||
#define BOOST_END_VERSION_UNDER(x) \
|
||||
if(ver < x ) {return;}
|
||||
|
|
|
|||
|
|
@ -246,8 +246,8 @@
|
|||
#define WALLET_FILE_SERIALIZATION_VERSION 160
|
||||
#define WALLET_FILE_LAST_SUPPORTED_VERSION 160
|
||||
#else
|
||||
#define WALLET_FILE_LAST_SUPPORTED_VERSION (CURRENCY_FORMATION_VERSION+74)
|
||||
#define WALLET_FILE_SERIALIZATION_VERSION (CURRENCY_FORMATION_VERSION+74)
|
||||
#define WALLET_FILE_LAST_SUPPORTED_VERSION (CURRENCY_FORMATION_VERSION+75)
|
||||
#define WALLET_FILE_SERIALIZATION_VERSION (CURRENCY_FORMATION_VERSION+75)
|
||||
#endif
|
||||
|
||||
#define CURRENT_MEMPOOL_ARCHIVE_VER (CURRENCY_FORMATION_VERSION+31)
|
||||
|
|
|
|||
|
|
@ -1087,7 +1087,7 @@ bool simple_wallet::show_incoming_transfers(const std::vector<std::string>& args
|
|||
}
|
||||
}
|
||||
|
||||
tools::wallet2::transfer_container transfers;
|
||||
tools::transfer_container transfers;
|
||||
m_wallet->get_transfers(transfers);
|
||||
|
||||
bool transfers_found = false;
|
||||
|
|
@ -1130,7 +1130,7 @@ bool simple_wallet::show_incoming_transfers(const std::vector<std::string>& args
|
|||
bool simple_wallet::show_incoming_transfers_counts(const std::vector<std::string>& args)
|
||||
{
|
||||
|
||||
tools::wallet2::transfer_container transfers;
|
||||
tools::transfer_container transfers;
|
||||
m_wallet->get_transfers(transfers);
|
||||
|
||||
uint64_t spent_count = 0;
|
||||
|
|
@ -1189,7 +1189,7 @@ bool simple_wallet::fix_collisions(const std::vector<std::string> &args)
|
|||
return true;
|
||||
}
|
||||
|
||||
void print_td_list(const std::list<tools::wallet2::transfer_details>& td)
|
||||
void print_td_list(const std::list<tools::transfer_details>& td)
|
||||
{
|
||||
message_writer() << "entries found: " << td.size();
|
||||
for (auto& e : td)
|
||||
|
|
@ -1208,7 +1208,7 @@ bool simple_wallet::scan_transfers_for_id(const std::vector<std::string> &args)
|
|||
fail_msg_writer() << "expected valid tx id";
|
||||
return true;
|
||||
}
|
||||
std::list<tools::wallet2::transfer_details> td;
|
||||
std::list<tools::transfer_details> td;
|
||||
m_wallet->scan_for_transaction_entries(id, currency::null_ki, td);
|
||||
print_td_list(td);
|
||||
return true;
|
||||
|
|
@ -1222,7 +1222,7 @@ bool simple_wallet::scan_transfers_for_ki(const std::vector<std::string> &args)
|
|||
fail_msg_writer() << "expected valid key_image";
|
||||
return true;
|
||||
}
|
||||
std::list<tools::wallet2::transfer_details> td;
|
||||
std::list<tools::transfer_details> td;
|
||||
m_wallet->scan_for_transaction_entries(currency::null_hash, ki, td);
|
||||
print_td_list(td);
|
||||
return true;
|
||||
|
|
@ -1249,7 +1249,7 @@ bool simple_wallet::get_transfer_info(const std::vector<std::string> &args)
|
|||
}
|
||||
|
||||
size_t i = 0;
|
||||
tools::wallet2::transfer_details td = AUTO_VAL_INIT(td);
|
||||
tools::transfer_details td = AUTO_VAL_INIT(td);
|
||||
|
||||
if (epee::string_tools::get_xtype_from_string(i, args[0]))
|
||||
{
|
||||
|
|
@ -1294,7 +1294,7 @@ bool simple_wallet::show_payments(const std::vector<std::string> &args)
|
|||
bool payments_found = false;
|
||||
for(std::string arg : args)
|
||||
{
|
||||
std::list<tools::wallet2::payment_details> payments;
|
||||
std::list<tools::payment_details> payments;
|
||||
m_wallet->get_payments(arg, payments);
|
||||
if (payments.empty())
|
||||
{
|
||||
|
|
@ -1302,7 +1302,7 @@ bool simple_wallet::show_payments(const std::vector<std::string> &args)
|
|||
continue;
|
||||
}
|
||||
|
||||
for (const tools::wallet2::payment_details& pd : payments)
|
||||
for (const tools::payment_details& pd : payments)
|
||||
{
|
||||
if (!payments_found)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -66,18 +66,13 @@ namespace tools
|
|||
, m_wcallback(new i_wallet2_callback()) //stub
|
||||
, m_core_proxy(new default_http_core_proxy())
|
||||
, m_upper_transaction_size_limit(0)
|
||||
, m_height_of_start_sync(0)
|
||||
, m_last_sync_percent(0)
|
||||
, m_fake_outputs_count(0)
|
||||
, m_do_rise_transfer(false)
|
||||
, m_log_prefix("???")
|
||||
, m_watch_only(false)
|
||||
, m_last_pow_block_h(0)
|
||||
, m_minimum_height(WALLET_MINIMUM_HEIGHT_UNSET_CONST)
|
||||
, m_min_utxo_count_for_defragmentation_tx(WALLET_MIN_UTXO_COUNT_FOR_DEFRAGMENTATION_TX)
|
||||
, m_max_utxo_count_for_defragmentation_tx(WALLET_MAX_UTXO_COUNT_FOR_DEFRAGMENTATION_TX)
|
||||
, m_decoys_count_for_defragmentation_tx(WALLET_DEFAULT_DECOYS_COUNT_FOR_DEFRAGMENTATION_TX)
|
||||
, m_current_wallet_file_size(0)
|
||||
, m_use_deffered_global_outputs(false)
|
||||
#ifdef DISABLE_TOR
|
||||
, m_disable_tor_relay(true)
|
||||
|
|
@ -149,25 +144,25 @@ currency::transaction wallet2::transform_str_to_tx(const std::string& tx_str)
|
|||
return currency::transaction();
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
uint64_t wallet2::transfer_details_base_to_amount(const transfer_details_base& tdb)
|
||||
uint64_t transfer_details_base_to_amount(const transfer_details_base& tdb)
|
||||
{
|
||||
return tdb.amount();
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
std::string wallet2::transfer_details_base_to_tx_hash(const transfer_details_base& tdb)
|
||||
std::string transfer_details_base_to_tx_hash(const transfer_details_base& tdb)
|
||||
{
|
||||
return epee::string_tools::pod_to_hex(currency::get_transaction_hash(tdb.m_ptx_wallet_info->m_tx));
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
const wallet2::transaction_wallet_info& wallet2::transform_ptr_to_value(const std::shared_ptr<wallet2::transaction_wallet_info>& a)
|
||||
const transaction_wallet_info& wallet2::transform_ptr_to_value(const std::shared_ptr<transaction_wallet_info>& a)
|
||||
{
|
||||
return *a;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
std::shared_ptr<wallet2::transaction_wallet_info> wallet2::transform_value_to_ptr(const wallet2::transaction_wallet_info& d)
|
||||
std::shared_ptr<transaction_wallet_info> wallet2::transform_value_to_ptr(const transaction_wallet_info& d)
|
||||
{
|
||||
THROW_IF_TRUE_WALLET_INT_ERR_EX_NO_HANDLER(false, "transform_value_to_ptr shoruld never be called");
|
||||
return std::shared_ptr<wallet2::transaction_wallet_info>();
|
||||
return std::shared_ptr<transaction_wallet_info>();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
|
@ -1248,12 +1243,12 @@ void wallet2::change_contract_state(wallet_public::escrow_contract_details_basic
|
|||
contract.state = new_state;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
void from_outs_to_received_items(const std::vector<currency::wallet_out_info>& outs, std::vector<tools::wallet2::payment_details_subtransfer>& received, const currency::transaction& tx)
|
||||
void from_outs_to_received_items(const std::vector<currency::wallet_out_info>& outs, std::vector<tools::payment_details_subtransfer>& received, const currency::transaction& tx)
|
||||
{
|
||||
for (const auto& item : outs)
|
||||
{
|
||||
if(!out_is_multisig(tx.vout[item.index]))
|
||||
received.push_back(tools::wallet2::payment_details_subtransfer{ item.asset_id, item.amount});
|
||||
received.push_back(tools::payment_details_subtransfer{ item.asset_id, item.amount});
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
|
|
@ -2820,29 +2815,9 @@ bool wallet2::clear()
|
|||
//----------------------------------------------------------------------------------------------------
|
||||
bool wallet2::reset_all()
|
||||
{
|
||||
//m_blockchain.clear();
|
||||
m_chain.clear();
|
||||
m_transfers.clear();
|
||||
m_amount_gindex_to_transfer_id.clear();
|
||||
m_key_images.clear();
|
||||
// m_pending_key_images is not cleared intentionally
|
||||
m_unconfirmed_in_transfers.clear();
|
||||
m_unconfirmed_txs.clear();
|
||||
m_unconfirmed_multisig_transfers.clear();
|
||||
// m_tx_keys is not cleared intentionally, considered to be safe
|
||||
m_multisig_transfers.clear();
|
||||
m_payments.clear();
|
||||
m_transfer_history.clear();
|
||||
//m_account = AUTO_VAL_INIT(m_account);
|
||||
|
||||
//m_local_bc_size = 1; //including genesis
|
||||
m_last_bc_timestamp = 0;
|
||||
m_height_of_start_sync = 0;
|
||||
m_last_sync_percent = 0;
|
||||
m_last_pow_block_h = 0;
|
||||
m_current_wallet_file_size = 0;
|
||||
m_custom_assets.clear();
|
||||
m_own_asset_descriptors.clear();
|
||||
//static_cast<wallet2_base_state&>(*this) = wallet2_base_state{};
|
||||
static_cast<wallet2_base_state&>(*this).~wallet2_base_state();
|
||||
new (static_cast<wallet2_base_state*>(this)) wallet2_base_state();
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
|
@ -3571,7 +3546,7 @@ bool wallet2::load_whitelisted_tokens_if_not_loaded() const
|
|||
return load_whitelisted_tokens();
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::get_transfers(wallet2::transfer_container& incoming_transfers) const
|
||||
void wallet2::get_transfers(transfer_container& incoming_transfers) const
|
||||
{
|
||||
incoming_transfers = m_transfers;
|
||||
}
|
||||
|
|
@ -3673,7 +3648,7 @@ std::string wallet2::get_balance_str() const
|
|||
return ss.str();
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::get_payments(const std::string& payment_id, std::list<wallet2::payment_details>& payments, uint64_t min_height) const
|
||||
void wallet2::get_payments(const std::string& payment_id, std::list<payment_details>& payments, uint64_t min_height) const
|
||||
{
|
||||
auto range = m_payments.equal_range(payment_id);
|
||||
std::for_each(range.first, range.second, [&payments, &min_height](const payment_container::value_type& x)
|
||||
|
|
@ -4912,10 +4887,10 @@ std::string get_random_rext(size_t len)
|
|||
// local_transfers_struct - structure to avoid copying the whole m_transfers
|
||||
struct local_transfers_struct
|
||||
{
|
||||
local_transfers_struct(wallet2::transfer_container& tf) :l_transfers_ref(tf)
|
||||
local_transfers_struct(transfer_container& tf) :l_transfers_ref(tf)
|
||||
{}
|
||||
|
||||
wallet2::transfer_container& l_transfers_ref;
|
||||
transfer_container& l_transfers_ref;
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(l_transfers_ref)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
|
|
|
|||
|
|
@ -45,18 +45,11 @@
|
|||
#include "tor-connect/torlib/tor_lib_iface.h"
|
||||
#include "currency_core/pos_mining.h"
|
||||
#include "view_iface.h"
|
||||
|
||||
#include "wallet2_base.h"
|
||||
|
||||
#define WALLET_DEFAULT_TX_SPENDABLE_AGE 10
|
||||
#define WALLET_POS_MINT_CHECK_HEIGHT_INTERVAL 1
|
||||
|
||||
#define WALLET_TRANSFER_DETAIL_FLAG_SPENT uint32_t(1 << 0)
|
||||
#define WALLET_TRANSFER_DETAIL_FLAG_BLOCKED uint32_t(1 << 1)
|
||||
#define WALLET_TRANSFER_DETAIL_FLAG_ESCROW_PROPOSAL_RESERVATION uint32_t(1 << 2)
|
||||
#define WALLET_TRANSFER_DETAIL_FLAG_MINED_TRANSFER uint32_t(1 << 3)
|
||||
#define WALLET_TRANSFER_DETAIL_FLAG_COLD_SIG_RESERVATION uint32_t(1 << 4) // transfer is reserved for cold-signing (unsigned tx was created and passed for signing)
|
||||
#define WALLET_TRANSFER_DETAIL_FLAG_HTLC_REDEEM uint32_t(1 << 5) // for htlc keeps info if this htlc belong as redeem or as refund
|
||||
|
||||
|
||||
const uint64_t WALLET_MINIMUM_HEIGHT_UNSET_CONST = std::numeric_limits<uint64_t>::max();
|
||||
|
||||
|
|
@ -84,9 +77,6 @@ const uint64_t WALLET_MINIMUM_HEIGHT_UNSET_CONST = std::numeric_limits<uint64_t>
|
|||
#define WLT_THROW_IF_FALSE_WALLET_CMN_ERR_EX(cond, msg) THROW_IF_FALSE_WALLET_CMN_ERR_EX(cond, "[W:" << m_log_prefix << "] " << msg)
|
||||
#define WLT_THROW_IF_FALSE_WALLET_EX_MES(cond, exception_t, msg, ...) THROW_IF_FALSE_WALLET_EX_MES(cond, exception_t, "[W:" << m_log_prefix << "] " << msg, ## __VA_ARGS__)
|
||||
|
||||
|
||||
|
||||
|
||||
class test_generator;
|
||||
|
||||
namespace tools
|
||||
|
|
@ -124,194 +114,110 @@ namespace tools
|
|||
virtual bool on_mw_select_wallet(uint64_t wallet_id) { return true; }
|
||||
};
|
||||
|
||||
struct tx_dust_policy
|
||||
{
|
||||
uint64_t dust_threshold = 0;
|
||||
bool add_to_fee = false;
|
||||
currency::account_public_address addr_for_dust;
|
||||
|
||||
tx_dust_policy(uint64_t a_dust_threshold = DEFAULT_DUST_THRESHOLD, bool an_add_to_fee = true, currency::account_public_address an_addr_for_dust = currency::account_public_address())
|
||||
: dust_threshold(a_dust_threshold)
|
||||
, add_to_fee(an_add_to_fee)
|
||||
, addr_for_dust(an_addr_for_dust)
|
||||
{
|
||||
}
|
||||
|
||||
BEGIN_SERIALIZE_OBJECT()
|
||||
FIELD(dust_threshold)
|
||||
FIELD(add_to_fee)
|
||||
FIELD(addr_for_dust)
|
||||
END_SERIALIZE()
|
||||
};
|
||||
|
||||
class test_generator;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct out_key_to_ki
|
||||
|
||||
/*
|
||||
This structure aggregates all variables that hold current wallet synchronization state and could be reset
|
||||
*/
|
||||
struct wallet2_base_state
|
||||
{
|
||||
crypto::public_key out_key;
|
||||
crypto::key_image key_image;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
wallet_chain_shortener m_chain;
|
||||
uint64_t m_minimum_height = WALLET_MINIMUM_HEIGHT_UNSET_CONST;
|
||||
amount_gindex_to_transfer_id_container m_amount_gindex_to_transfer_id;
|
||||
transfer_container m_transfers;
|
||||
multisig_transfer_container m_multisig_transfers;
|
||||
payment_container m_payments;
|
||||
std::unordered_map<crypto::key_image, size_t> m_key_images;
|
||||
std::vector<wallet_public::wallet_transfer_info> m_transfer_history;
|
||||
std::unordered_map<crypto::hash, currency::transaction> m_unconfirmed_in_transfers;
|
||||
std::unordered_map<crypto::hash, tools::wallet_public::wallet_transfer_info> m_unconfirmed_txs;
|
||||
std::unordered_set<crypto::hash> m_unconfirmed_multisig_transfers;
|
||||
std::unordered_map<crypto::hash, crypto::secret_key> m_tx_keys;
|
||||
std::unordered_map<crypto::public_key, wallet_own_asset_context> m_own_asset_descriptors;
|
||||
std::unordered_map<crypto::public_key, currency::asset_descriptor_base> m_custom_assets; //assets that manually added by user
|
||||
escrow_contracts_container m_contracts;
|
||||
std::multimap<uint64_t, htlc_expiration_trigger> m_htlcs; //map [expired_if_more_then] -> height of expiration
|
||||
amount_gindex_to_transfer_id_container m_active_htlcs; // map [amount; gindex] -> transfer index
|
||||
std::unordered_map<crypto::hash, uint64_t> m_active_htlcs_txid; // map [txid] -> transfer index, limitation: 1 transactiom -> 1 htlc
|
||||
std::list<expiration_entry_info> m_money_expirations;
|
||||
std::unordered_map<crypto::public_key, crypto::key_image> m_pending_key_images; // (out_pk -> ki) pairs of change outputs to be added in watch-only wallet without spend sec key
|
||||
uint64_t m_last_pow_block_h = 0;
|
||||
std::list<std::pair<uint64_t, wallet_event_t>> m_rollback_events;
|
||||
|
||||
//variables that not being serialized
|
||||
std::atomic<uint64_t> m_last_bc_timestamp = 0;
|
||||
uint64_t m_height_of_start_sync = 0;
|
||||
std::atomic<uint64_t> m_last_sync_percent = 0;
|
||||
mutable uint64_t m_current_wallet_file_size = 0;
|
||||
|
||||
typedef tools::pod_array_file_container<out_key_to_ki> pending_ki_file_container_t;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
inline void digit_split_strategy(const std::vector<currency::tx_destination_entry>& dsts,
|
||||
const currency::tx_destination_entry& change_dst, uint64_t dust_threshold,
|
||||
std::vector<currency::tx_destination_entry>& splitted_dsts, uint64_t& dust, uint64_t max_output_allowed)
|
||||
//===============================================================
|
||||
template <class t_archive>
|
||||
inline void serialize(t_archive &a, const unsigned int ver)
|
||||
{
|
||||
splitted_dsts.clear();
|
||||
dust = 0;
|
||||
|
||||
for(auto& de : dsts)
|
||||
if (t_archive::is_saving::value)
|
||||
{
|
||||
if (de.addr.size() > 1)
|
||||
{
|
||||
//for multisig we don't split
|
||||
splitted_dsts.push_back(de);
|
||||
}
|
||||
else if (de.htlc_options.expiration != 0)
|
||||
{
|
||||
//for htlc we don't do split
|
||||
splitted_dsts.push_back(de);
|
||||
}
|
||||
else
|
||||
{
|
||||
currency::decompose_amount_into_digits(de.amount, dust_threshold,
|
||||
[&](uint64_t chunk) { splitted_dsts.push_back(currency::tx_destination_entry(chunk, de.addr, de.asset_id)); },
|
||||
[&](uint64_t a_dust) { splitted_dsts.push_back(currency::tx_destination_entry(a_dust, de.addr, de.asset_id)); }, max_output_allowed);
|
||||
}
|
||||
LOG_PRINT_MAGENTA("Serializing file with ver: " << ver, LOG_LEVEL_0);
|
||||
}
|
||||
|
||||
if (change_dst.amount > 0)
|
||||
|
||||
// do not load wallet if data version is greather than the code version
|
||||
if (ver > WALLET_FILE_SERIALIZATION_VERSION)
|
||||
{
|
||||
if (change_dst.addr.size() > 1)
|
||||
LOG_PRINT_MAGENTA("Wallet file truncated due to WALLET_FILE_SERIALIZATION_VERSION is more then curren build", LOG_LEVEL_0);
|
||||
return;
|
||||
}
|
||||
if (ver < WALLET_FILE_LAST_SUPPORTED_VERSION)
|
||||
{
|
||||
LOG_PRINT_MAGENTA("Wallet file truncated due to ver(" << ver << ") is less then WALLET_FILE_LAST_SUPPORTED_VERSION", LOG_LEVEL_0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (t_archive::is_saving::value)
|
||||
{
|
||||
uint64_t formation_ver = CURRENCY_FORMATION_VERSION;
|
||||
a & formation_ver;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint64_t formation_ver = 0;
|
||||
a & formation_ver;
|
||||
if (formation_ver != CURRENCY_FORMATION_VERSION)
|
||||
{
|
||||
//for multisig we don't split
|
||||
splitted_dsts.push_back(change_dst);
|
||||
}
|
||||
else
|
||||
{
|
||||
currency::decompose_amount_into_digits(change_dst.amount, dust_threshold,
|
||||
[&](uint64_t chunk) { splitted_dsts.push_back(currency::tx_destination_entry(chunk, change_dst.addr)); },
|
||||
[&](uint64_t a_dust) { dust = a_dust; }, max_output_allowed);
|
||||
LOG_PRINT_MAGENTA("Wallet file truncated due to mismatch CURRENCY_FORMATION_VERSION", LOG_LEVEL_0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
//convert from old version
|
||||
a & m_chain;
|
||||
a & m_minimum_height;
|
||||
a & m_amount_gindex_to_transfer_id;
|
||||
a & m_transfers;
|
||||
a & m_multisig_transfers;
|
||||
a & m_key_images;
|
||||
a & m_unconfirmed_txs;
|
||||
a & m_unconfirmed_multisig_transfers;
|
||||
a & m_payments;
|
||||
a & m_transfer_history;
|
||||
a & m_unconfirmed_in_transfers;
|
||||
a & m_contracts;
|
||||
a & m_money_expirations;
|
||||
a & m_pending_key_images;
|
||||
a & m_tx_keys;
|
||||
a & m_last_pow_block_h;
|
||||
a & m_htlcs;
|
||||
a & m_active_htlcs;
|
||||
a & m_active_htlcs_txid;
|
||||
a & m_own_asset_descriptors;
|
||||
a & m_custom_assets;
|
||||
a & m_rollback_events;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
inline void null_split_strategy(const std::vector<currency::tx_destination_entry>& dsts,
|
||||
const currency::tx_destination_entry& change_dst, uint64_t dust_threshold,
|
||||
std::vector<currency::tx_destination_entry>& splitted_dsts, uint64_t& dust, uint64_t max_output_allowed)
|
||||
{
|
||||
splitted_dsts = dsts;
|
||||
|
||||
dust = 0;
|
||||
uint64_t change = change_dst.amount;
|
||||
if (0 < dust_threshold)
|
||||
{
|
||||
for (uint64_t order = 10; order <= 10 * dust_threshold; order *= 10)
|
||||
{
|
||||
uint64_t dust_candidate = change_dst.amount % order;
|
||||
uint64_t change_candidate = (change_dst.amount / order) * order;
|
||||
if (dust_candidate <= dust_threshold)
|
||||
{
|
||||
dust = dust_candidate;
|
||||
change = change_candidate;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (0 != change)
|
||||
{
|
||||
splitted_dsts.push_back(currency::tx_destination_entry(change, change_dst.addr));
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
inline void void_split_strategy(const std::vector<currency::tx_destination_entry>& dsts,
|
||||
const currency::tx_destination_entry& change_dst, uint64_t dust_threshold,
|
||||
std::vector<currency::tx_destination_entry>& splitted_dsts, uint64_t& dust, uint64_t max_output_allowed)
|
||||
{
|
||||
splitted_dsts.insert(splitted_dsts.end(), dsts.begin(), dsts.end());
|
||||
if (change_dst.amount > 0)
|
||||
splitted_dsts.push_back(change_dst);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
enum split_strategy_id_t { ssi_none = 0, ssi_digit = 1, ssi_null = 2, ssi_void = 3 };
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
inline bool apply_split_strategy_by_id(split_strategy_id_t id, const std::vector<currency::tx_destination_entry>& dsts,
|
||||
const currency::tx_destination_entry& change_dst, uint64_t dust_threshold,
|
||||
std::vector<currency::tx_destination_entry>& splitted_dsts, uint64_t& dust, uint64_t max_output_allowed)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case ssi_digit:
|
||||
digit_split_strategy(dsts, change_dst, dust_threshold, splitted_dsts, dust, max_output_allowed);
|
||||
return true;
|
||||
case ssi_null:
|
||||
null_split_strategy(dsts, change_dst, dust_threshold, splitted_dsts, dust, max_output_allowed);
|
||||
return true;
|
||||
case ssi_void:
|
||||
void_split_strategy(dsts, change_dst, dust_threshold, splitted_dsts, dust, max_output_allowed);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
struct construct_tx_param
|
||||
{
|
||||
// preparing data for tx
|
||||
std::vector<currency::tx_destination_entry> dsts;
|
||||
size_t fake_outputs_count = 0;
|
||||
uint64_t fee = 0;
|
||||
tx_dust_policy dust_policy;
|
||||
crypto::hash multisig_id = currency::null_hash;
|
||||
uint8_t flags = 0;
|
||||
uint8_t split_strategy_id = 0;
|
||||
bool mark_tx_as_complete = false;
|
||||
|
||||
crypto::hash htlc_tx_id;
|
||||
std::string htlc_origin;
|
||||
|
||||
// constructing tx
|
||||
uint64_t unlock_time = 0;
|
||||
std::vector<currency::extra_v> extra;
|
||||
std::vector<currency::attachment_v> attachments;
|
||||
currency::account_public_address crypt_address;
|
||||
uint8_t tx_outs_attr = 0;
|
||||
bool shuffle = false;
|
||||
bool create_utxo_defragmentation_tx = false;
|
||||
bool need_at_least_1_zc = false;
|
||||
crypto::secret_key asset_deploy_control_key = currency::null_skey;
|
||||
};
|
||||
|
||||
struct mode_separate_context
|
||||
{
|
||||
currency::transaction tx_for_mode_separate;
|
||||
view::ionic_swap_proposal_info proposal_info;
|
||||
bool escrow = false;
|
||||
};
|
||||
|
||||
|
||||
struct selection_for_amount
|
||||
{
|
||||
uint64_t needed_amount = 0;
|
||||
uint64_t found_amount = 0;
|
||||
//std::vector<uint64_t> selected_indicies;
|
||||
};
|
||||
typedef std::unordered_map<crypto::public_key, selection_for_amount> assets_selection_context;
|
||||
|
||||
class wallet2: public tools::tor::t_transport_state_notifier, public boost::static_visitor<void>
|
||||
class wallet2: public tools::tor::t_transport_state_notifier, public boost::static_visitor<void>, public wallet2_base_state
|
||||
{
|
||||
wallet2(const wallet2&) = delete;
|
||||
public:
|
||||
|
|
@ -321,195 +227,12 @@ namespace tools
|
|||
static std::string transform_tx_to_str(const currency::transaction& tx);
|
||||
static currency::transaction transform_str_to_tx(const std::string& tx_str);
|
||||
|
||||
//general rollback mechanism
|
||||
struct asset_register_event
|
||||
{
|
||||
crypto::public_key asset_id = currency::null_pkey;
|
||||
BEGIN_BOOST_SERIALIZATION()
|
||||
BOOST_SERIALIZE(asset_id)
|
||||
END_BOOST_SERIALIZATION()
|
||||
|
||||
};
|
||||
|
||||
struct wallet_own_asset_context
|
||||
{
|
||||
currency::asset_descriptor_base asset_descriptor;
|
||||
crypto::secret_key control_key;
|
||||
//uint64_t height = 0;
|
||||
|
||||
BEGIN_BOOST_SERIALIZATION()
|
||||
BOOST_SERIALIZE(asset_descriptor)
|
||||
BOOST_SERIALIZE(control_key)
|
||||
//BOOST_SERIALIZE(height)
|
||||
END_BOOST_SERIALIZATION()
|
||||
};
|
||||
|
||||
struct asset_update_event
|
||||
{
|
||||
crypto::public_key asset_id = currency::null_pkey;
|
||||
wallet_own_asset_context own_context;
|
||||
|
||||
BEGIN_BOOST_SERIALIZATION()
|
||||
BOOST_SERIALIZE(asset_id)
|
||||
BOOST_SERIALIZE(own_context)
|
||||
END_BOOST_SERIALIZATION()
|
||||
};
|
||||
|
||||
struct asset_unown_event
|
||||
{
|
||||
crypto::public_key asset_id = currency::null_pkey;
|
||||
wallet_own_asset_context own_context;
|
||||
|
||||
BEGIN_BOOST_SERIALIZATION()
|
||||
BOOST_SERIALIZE(asset_id)
|
||||
BOOST_SERIALIZE(own_context)
|
||||
END_BOOST_SERIALIZATION()
|
||||
};
|
||||
|
||||
typedef boost::variant<asset_register_event, asset_update_event, asset_unown_event> wallet_event_t;
|
||||
|
||||
struct transaction_wallet_info
|
||||
{
|
||||
uint64_t m_block_height = 0;
|
||||
uint64_t m_block_timestamp = 0;
|
||||
currency::transaction m_tx;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(m_block_height)
|
||||
KV_SERIALIZE(m_block_timestamp)
|
||||
KV_SERIALIZE_CUSTOM(m_tx, std::string, tools::wallet2::transform_tx_to_str, tools::wallet2::transform_str_to_tx)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
static const transaction_wallet_info& transform_ptr_to_value(const std::shared_ptr<transaction_wallet_info>& a);
|
||||
static std::shared_ptr<transaction_wallet_info> transform_value_to_ptr(const transaction_wallet_info& d);
|
||||
|
||||
struct transfer_details_base;
|
||||
|
||||
static uint64_t transfer_details_base_to_amount(const transfer_details_base& tdb);
|
||||
static std::string transfer_details_base_to_tx_hash(const transfer_details_base& tdb);
|
||||
|
||||
struct transfer_details_base
|
||||
{
|
||||
struct ZC_out_info // TODO: @#@# consider using wallet_out_info instead
|
||||
{
|
||||
ZC_out_info() = default;
|
||||
ZC_out_info(const crypto::scalar_t& amount_blinding_mask, const crypto::scalar_t& asset_id_blinding_mask, const crypto::public_key& asset_id)
|
||||
: amount_blinding_mask(amount_blinding_mask), asset_id_blinding_mask(asset_id_blinding_mask), asset_id(asset_id)
|
||||
{}
|
||||
crypto::scalar_t amount_blinding_mask = 0;
|
||||
crypto::scalar_t asset_id_blinding_mask = 0;
|
||||
crypto::public_key asset_id = currency::null_pkey; // not blinded, not multiplied by 1/8 TODO: @#@# consider changing to point_t, also consider using wallet wallet_out_info
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(amount_blinding_mask)
|
||||
KV_SERIALIZE(asset_id_blinding_mask)
|
||||
KV_SERIALIZE_POD_AS_HEX_STRING(asset_id)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
std::shared_ptr<transaction_wallet_info> m_ptx_wallet_info;
|
||||
uint64_t m_internal_output_index = 0;
|
||||
uint64_t m_spent_height = 0;
|
||||
uint32_t m_flags = 0;
|
||||
uint64_t m_amount = 0;
|
||||
boost::shared_ptr<ZC_out_info> m_zc_info_ptr;
|
||||
|
||||
uint64_t amount() const { return m_amount; }
|
||||
uint64_t amount_for_global_output_index() const { return is_zc() ? 0 : m_amount; } // amount value for global outputs index, it's zero for outputs with hidden amounts
|
||||
|
||||
// @#@ will throw if type is not tx_out_bare, TODO: change according to new model,
|
||||
// need to replace all get_tx_out_bare_from_out_v() to proper code
|
||||
//const currency::tx_out_bare& output() const { return currency::get_tx_out_bare_from_out_v(m_ptx_wallet_info->m_tx.vout[m_internal_output_index]); }
|
||||
|
||||
const currency::tx_out_v& output() const { return m_ptx_wallet_info->m_tx.vout[m_internal_output_index]; }
|
||||
uint8_t mix_attr() const { uint8_t result = UINT8_MAX; get_mix_attr_from_tx_out_v(output(), result); return result; }
|
||||
crypto::hash tx_hash() const { return get_transaction_hash(m_ptx_wallet_info->m_tx); }
|
||||
bool is_spent() const { return m_flags & WALLET_TRANSFER_DETAIL_FLAG_SPENT; }
|
||||
bool is_spendable() const { return (m_flags & (WALLET_TRANSFER_DETAIL_FLAG_SPENT | WALLET_TRANSFER_DETAIL_FLAG_BLOCKED | WALLET_TRANSFER_DETAIL_FLAG_ESCROW_PROPOSAL_RESERVATION | WALLET_TRANSFER_DETAIL_FLAG_COLD_SIG_RESERVATION)) == 0; }
|
||||
bool is_reserved_for_escrow() const { return ( (m_flags & WALLET_TRANSFER_DETAIL_FLAG_ESCROW_PROPOSAL_RESERVATION) != 0 ); }
|
||||
bool is_zc() const { return m_zc_info_ptr.get(); }
|
||||
const crypto::public_key& get_asset_id() const { if (m_zc_info_ptr.get()) { return m_zc_info_ptr->asset_id; } else { return currency::native_coin_asset_id; } }
|
||||
bool is_native_coin() const { return m_zc_info_ptr.get() ? (m_zc_info_ptr->asset_id == currency::native_coin_asset_id) : true; }
|
||||
bool is_htlc() const {
|
||||
|
||||
if (m_ptx_wallet_info->m_tx.vout[m_internal_output_index].type() == typeid(currency::tx_out_bare) &&
|
||||
boost::get<currency::tx_out_bare>(m_ptx_wallet_info->m_tx.vout[m_internal_output_index]).target.type() == typeid(currency::txout_htlc))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE_CUSTOM(m_ptx_wallet_info, const transaction_wallet_info&, tools::wallet2::transform_ptr_to_value, tools::wallet2::transform_value_to_ptr)
|
||||
KV_SERIALIZE(m_internal_output_index)
|
||||
KV_SERIALIZE(m_spent_height)
|
||||
KV_SERIALIZE(m_flags)
|
||||
KV_SERIALIZE(m_amount)
|
||||
KV_SERIALIZE_N(m_zc_info_ptr, "zc_out_info")
|
||||
KV_SERIALIZE_EPHEMERAL_N(uint64_t, tools::wallet2::transfer_details_base_to_amount, "amount")
|
||||
KV_SERIALIZE_EPHEMERAL_N(std::string, tools::wallet2::transfer_details_base_to_tx_hash, "tx_id")
|
||||
END_KV_SERIALIZE_MAP()
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct transfer_details_extra_option_htlc_info
|
||||
{
|
||||
std::string origin; //this field filled only if htlc had been redeemed
|
||||
crypto::hash redeem_tx_id = currency::null_hash;
|
||||
};
|
||||
|
||||
|
||||
typedef boost::variant<transfer_details_extra_option_htlc_info, currency::tx_payer> transfer_details_extra_options_v;
|
||||
|
||||
struct transfer_details : public transfer_details_base
|
||||
{
|
||||
uint64_t m_global_output_index = 0;
|
||||
crypto::key_image m_key_image; //TODO: key_image stored twice :(
|
||||
std::vector<transfer_details_extra_options_v> varian_options;
|
||||
|
||||
//v2
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(m_global_output_index)
|
||||
KV_SERIALIZE_POD_AS_HEX_STRING(m_key_image)
|
||||
KV_CHAIN_BASE(transfer_details_base)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
//used in wallet
|
||||
struct htlc_expiration_trigger
|
||||
{
|
||||
bool is_wallet_owns_redeem = false; //specify if this HTLC belong to this wallet by pkey_redeem or by pkey_refund
|
||||
uint64_t transfer_index = 0;
|
||||
};
|
||||
|
||||
|
||||
struct payment_details_subtransfer
|
||||
{
|
||||
crypto::public_key asset_id = currency::null_pkey;
|
||||
uint64_t amount = 0;
|
||||
|
||||
BEGIN_BOOST_SERIALIZATION()
|
||||
BOOST_SERIALIZE(asset_id)
|
||||
BOOST_SERIALIZE(amount)
|
||||
END_BOOST_SERIALIZATION()
|
||||
};
|
||||
|
||||
struct payment_details
|
||||
{
|
||||
crypto::hash m_tx_hash = currency::null_hash;
|
||||
uint64_t m_amount = 0; // native coins amount
|
||||
uint64_t m_block_height = 0;
|
||||
uint64_t m_unlock_time = 0;
|
||||
std::vector<payment_details_subtransfer> subtransfers; //subtransfers added for confidential asset only, native amount should be stored in m_amount (for space saving)
|
||||
|
||||
BEGIN_BOOST_SERIALIZATION()
|
||||
BOOST_SERIALIZE(m_tx_hash)
|
||||
BOOST_SERIALIZE(m_amount)
|
||||
BOOST_SERIALIZE(m_block_height)
|
||||
BOOST_SERIALIZE(m_unlock_time)
|
||||
BOOST_SERIALIZE(subtransfers)
|
||||
END_BOOST_SERIALIZATION()
|
||||
};
|
||||
|
||||
struct mining_context : public currency::pos_mining_context
|
||||
{
|
||||
std::string status;
|
||||
|
|
@ -528,20 +251,6 @@ namespace tools
|
|||
uint64_t total_amount_checked = 0;
|
||||
};
|
||||
|
||||
struct expiration_entry_info
|
||||
{
|
||||
std::vector<uint64_t> selected_transfers;
|
||||
uint64_t expiration_time = 0;
|
||||
crypto::hash related_tx_id = currency::null_hash; // tx id which caused money lock, if any (ex: escrow proposal transport tx)
|
||||
std::vector<payment_details_subtransfer> receved;
|
||||
|
||||
BEGIN_BOOST_SERIALIZATION()
|
||||
BOOST_SERIALIZE(selected_transfers)
|
||||
BOOST_SERIALIZE(expiration_time)
|
||||
BOOST_SERIALIZE(related_tx_id)
|
||||
BOOST_SERIALIZE(receved)
|
||||
END_BOOST_SERIALIZATION()
|
||||
};
|
||||
|
||||
/*
|
||||
This might be not the best solution so far, but after discussion with @sowle we came up to conclusion
|
||||
|
|
@ -559,17 +268,6 @@ namespace tools
|
|||
};
|
||||
|
||||
|
||||
|
||||
typedef std::unordered_multimap<std::string, payment_details> payment_container;
|
||||
|
||||
typedef std::deque<transfer_details> transfer_container;
|
||||
typedef std::unordered_map<crypto::hash, transfer_details_base> multisig_transfer_container;
|
||||
typedef std::unordered_map<crypto::hash, tools::wallet_public::escrow_contract_details_basic> escrow_contracts_container;
|
||||
typedef std::map<uint64_t, std::set<size_t> > free_amounts_cache_type;
|
||||
typedef std::unordered_map<crypto::public_key, free_amounts_cache_type> free_assets_amounts_cache_type;
|
||||
typedef std::unordered_map<std::pair<uint64_t, uint64_t>, uint64_t> amount_gindex_to_transfer_id_container; // maps [amount; gindex] -> tid
|
||||
|
||||
|
||||
struct keys_file_data_old
|
||||
{
|
||||
crypto::chacha8_iv iv;
|
||||
|
|
@ -832,7 +530,7 @@ namespace tools
|
|||
bool scan_pos(mining_context& cxt, std::atomic<bool>& stop, idle_condition_cb_t idle_condition_cb, const currency::core_runtime_config &runtime_config);
|
||||
bool fill_mining_context(mining_context& ctx);
|
||||
|
||||
void get_transfers(wallet2::transfer_container& incoming_transfers) const;
|
||||
void get_transfers(transfer_container& incoming_transfers) const;
|
||||
std::string get_transfers_str(bool include_spent = true, bool include_unspent = true, bool show_only_unknown = false, const std::string& filter_asset_ticker = std::string{}) const;
|
||||
std::string get_balance_str() const;
|
||||
|
||||
|
|
@ -868,61 +566,7 @@ namespace tools
|
|||
template <class t_archive>
|
||||
inline void serialize(t_archive &a, const unsigned int ver)
|
||||
{
|
||||
if (t_archive::is_saving::value)
|
||||
{
|
||||
WLT_LOG_MAGENTA("Serializing file with ver: " << ver, LOG_LEVEL_0);
|
||||
}
|
||||
|
||||
|
||||
// do not load wallet if data version is greather than the code version
|
||||
if (ver > WALLET_FILE_SERIALIZATION_VERSION)
|
||||
{
|
||||
WLT_LOG_MAGENTA("Wallet file truncated due to WALLET_FILE_SERIALIZATION_VERSION is more then curren build", LOG_LEVEL_0);
|
||||
return;
|
||||
}
|
||||
if(ver < WALLET_FILE_LAST_SUPPORTED_VERSION)
|
||||
{
|
||||
WLT_LOG_MAGENTA("Wallet file truncated due to ver(" << ver << ") is less then WALLET_FILE_LAST_SUPPORTED_VERSION", LOG_LEVEL_0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (t_archive::is_saving::value)
|
||||
{
|
||||
uint64_t formation_ver = CURRENCY_FORMATION_VERSION;
|
||||
a & formation_ver;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint64_t formation_ver = 0;
|
||||
a & formation_ver;
|
||||
if (formation_ver != CURRENCY_FORMATION_VERSION)
|
||||
{
|
||||
WLT_LOG_MAGENTA("Wallet file truncated due to mismatch CURRENCY_FORMATION_VERSION", LOG_LEVEL_0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
//convert from old version
|
||||
a & m_chain;
|
||||
a & m_minimum_height;
|
||||
a & m_amount_gindex_to_transfer_id;
|
||||
a & m_transfers;
|
||||
a & m_multisig_transfers;
|
||||
a & m_key_images;
|
||||
a & m_unconfirmed_txs;
|
||||
a & m_unconfirmed_multisig_transfers;
|
||||
a & m_payments;
|
||||
a & m_transfer_history;
|
||||
a & m_unconfirmed_in_transfers;
|
||||
a & m_contracts;
|
||||
a & m_money_expirations;
|
||||
a & m_pending_key_images;
|
||||
a & m_tx_keys;
|
||||
a & m_last_pow_block_h;
|
||||
a & m_htlcs;
|
||||
a & m_active_htlcs;
|
||||
a & m_active_htlcs_txid;
|
||||
a & m_own_asset_descriptors;
|
||||
a & m_custom_assets;
|
||||
wallet2_base_state::serialize(a, ver);
|
||||
}
|
||||
|
||||
bool is_transfer_ready_to_go(const transfer_details& td, uint64_t fake_outputs_count);
|
||||
|
|
@ -1197,71 +841,52 @@ private:
|
|||
static void wti_to_txt_line(std::ostream& ss, const wallet_public::wallet_transfer_info& wti, size_t index);
|
||||
static void wti_to_json_line(std::ostream& ss, const wallet_public::wallet_transfer_info& wti, size_t index);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
!!!!! IMPORTAN !!!!!
|
||||
|
||||
All variables that supposed to hold wallet state of synchronization(i.e. transfers, assets, htlc, swaps, contracts) - should
|
||||
be placed in wallet2_base_state base class to avoid typical bugs when it's forgotten to be included in reset/resync/serialize functions
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
currency::account_base m_account;
|
||||
bool m_watch_only;
|
||||
std::string m_log_prefix; // part of pub address, prefix for logging functions
|
||||
std::wstring m_wallet_file;
|
||||
std::wstring m_pending_ki_file;
|
||||
std::string m_password;
|
||||
uint64_t m_minimum_height;
|
||||
|
||||
|
||||
std::atomic<uint64_t> m_last_bc_timestamp;
|
||||
bool m_do_rise_transfer;
|
||||
uint64_t m_min_utxo_count_for_defragmentation_tx;
|
||||
uint64_t m_max_utxo_count_for_defragmentation_tx;
|
||||
size_t m_decoys_count_for_defragmentation_tx;
|
||||
|
||||
transfer_container m_transfers;
|
||||
multisig_transfer_container m_multisig_transfers;
|
||||
amount_gindex_to_transfer_id_container m_amount_gindex_to_transfer_id;
|
||||
payment_container m_payments;
|
||||
std::unordered_map<crypto::key_image, size_t> m_key_images;
|
||||
std::unordered_map<crypto::public_key, crypto::key_image> m_pending_key_images; // (out_pk -> ki) pairs of change outputs to be added in watch-only wallet without spend sec key
|
||||
pending_ki_file_container_t m_pending_key_images_file_container;
|
||||
uint64_t m_upper_transaction_size_limit; //TODO: auto-calc this value or request from daemon, now use some fixed value
|
||||
|
||||
std::atomic<bool> m_stop;
|
||||
std::vector<wallet_public::wallet_transfer_info> m_transfer_history;
|
||||
std::unordered_map<crypto::hash, currency::transaction> m_unconfirmed_in_transfers;
|
||||
std::unordered_map<crypto::hash, tools::wallet_public::wallet_transfer_info> m_unconfirmed_txs;
|
||||
std::unordered_set<crypto::hash> m_unconfirmed_multisig_transfers;
|
||||
std::unordered_map<crypto::hash, crypto::secret_key> m_tx_keys;
|
||||
std::unordered_map<crypto::public_key, wallet_own_asset_context> m_own_asset_descriptors;
|
||||
std::unordered_map<crypto::public_key, currency::asset_descriptor_base> m_custom_assets; //assets that manually added by user
|
||||
mutable std::unordered_map<crypto::public_key, currency::asset_descriptor_base> m_whitelisted_assets; //assets that whitelisted
|
||||
|
||||
|
||||
std::multimap<uint64_t, htlc_expiration_trigger> m_htlcs; //map [expired_if_more_then] -> height of expiration
|
||||
amount_gindex_to_transfer_id_container m_active_htlcs; // map [amount; gindex] -> transfer index
|
||||
std::unordered_map<crypto::hash, uint64_t> m_active_htlcs_txid; // map [txid] -> transfer index, limitation: 1 transactiom -> 1 htlc
|
||||
|
||||
std::shared_ptr<i_core_proxy> m_core_proxy;
|
||||
std::shared_ptr<i_wallet2_callback> m_wcallback;
|
||||
uint64_t m_height_of_start_sync;
|
||||
std::atomic<uint64_t> m_last_sync_percent;
|
||||
uint64_t m_last_pow_block_h;
|
||||
currency::core_runtime_config m_core_runtime_config;
|
||||
escrow_contracts_container m_contracts;
|
||||
wallet_chain_shortener m_chain;
|
||||
std::list<expiration_entry_info> m_money_expirations;
|
||||
//optimization for big wallets and batch tx
|
||||
|
||||
|
||||
currency::core_runtime_config m_core_runtime_config;
|
||||
//optimization for big wallets and batch tx
|
||||
free_assets_amounts_cache_type m_found_free_amounts;
|
||||
uint64_t m_fake_outputs_count;
|
||||
std::string m_miner_text_info;
|
||||
|
||||
mutable uint64_t m_current_wallet_file_size;
|
||||
bool m_use_deffered_global_outputs;
|
||||
bool m_disable_tor_relay;
|
||||
bool m_use_assets_whitelisting = true;
|
||||
|
||||
mutable current_operation_context m_current_context;
|
||||
//this needed to access wallets state in coretests, for creating abnormal blocks and tranmsactions
|
||||
friend class test_generator;
|
||||
|
||||
std::list<std::pair<uint64_t, wallet_event_t>> m_rollback_events;
|
||||
|
||||
|
||||
}; // class wallet2
|
||||
|
||||
} // namespace tools
|
||||
|
|
@ -1269,70 +894,23 @@ private:
|
|||
BOOST_CLASS_VERSION(tools::wallet2, WALLET_FILE_SERIALIZATION_VERSION)
|
||||
|
||||
BOOST_CLASS_VERSION(tools::wallet_public::wallet_transfer_info, 12)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::transfer_details, 3)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::transfer_details_base, 2)
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace serialization
|
||||
{
|
||||
template <class Archive>
|
||||
inline void serialize(Archive &a, tools::wallet2::transaction_wallet_info &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.m_block_height;
|
||||
a & x.m_block_timestamp;
|
||||
a & x.m_tx;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
inline void serialize(Archive& a, tools::wallet2::transfer_details_base::ZC_out_info& x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.amount_blinding_mask;
|
||||
a & x.asset_id_blinding_mask;
|
||||
a & x.asset_id;
|
||||
}
|
||||
// template <class Archive>
|
||||
// inline void serialize(Archive &a, tools::transfer_details &x, const boost::serialization::version_type ver)
|
||||
// {
|
||||
// a & x.m_global_output_index;
|
||||
// a & x.m_key_image;
|
||||
// a & static_cast<tools::transfer_details_base&>(x);
|
||||
// if (ver < 3)
|
||||
// return;
|
||||
// a & x.varian_options;
|
||||
// }
|
||||
|
||||
template <class Archive>
|
||||
inline void serialize(Archive &a, tools::wallet2::transfer_details_base &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.m_ptx_wallet_info;
|
||||
a & x.m_internal_output_index;
|
||||
a & x.m_flags;
|
||||
a & x.m_spent_height;
|
||||
if (ver < 2)
|
||||
{
|
||||
x.m_amount = get_amount_from_variant(x.output());
|
||||
return;
|
||||
}
|
||||
a & x.m_amount;
|
||||
a & x.m_zc_info_ptr;
|
||||
}
|
||||
|
||||
|
||||
template <class Archive>
|
||||
inline void serialize(Archive &a, tools::wallet2::transfer_details_extra_option_htlc_info &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.origin;
|
||||
}
|
||||
|
||||
|
||||
template <class Archive>
|
||||
inline void serialize(Archive &a, tools::wallet2::transfer_details &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.m_global_output_index;
|
||||
a & x.m_key_image;
|
||||
a & static_cast<tools::wallet2::transfer_details_base&>(x);
|
||||
if (ver < 3)
|
||||
return;
|
||||
a & x.varian_options;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
inline void serialize(Archive &a, tools::wallet2::htlc_expiration_trigger &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.is_wallet_owns_redeem;
|
||||
a & x.transfer_index;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
inline void serialize(Archive& a, tools::wallet_public::escrow_contract_details_basic& x, const boost::serialization::version_type ver)
|
||||
|
|
|
|||
|
|
@ -15,10 +15,7 @@
|
|||
static void exception_handler(){}
|
||||
|
||||
|
||||
wallet_chain_shortener::wallet_chain_shortener(): m_genesis(currency::gdefault_genesis)
|
||||
{
|
||||
m_local_bc_size = 1;
|
||||
}
|
||||
|
||||
void wallet_chain_shortener::clear()
|
||||
{
|
||||
m_local_bc_size = 1;
|
||||
|
|
|
|||
|
|
@ -18,12 +18,11 @@
|
|||
|
||||
#include "include_base_utils.h"
|
||||
#include "crypto/crypto.h"
|
||||
|
||||
#include "currency_core/currency_basic.h"
|
||||
|
||||
class wallet_chain_shortener
|
||||
{
|
||||
public:
|
||||
wallet_chain_shortener();
|
||||
void push_new_block_id(const crypto::hash& id, uint64_t height);
|
||||
uint64_t get_top_block_height() const;
|
||||
uint64_t get_blockchain_current_size() const;
|
||||
|
|
@ -48,8 +47,8 @@ public:
|
|||
//debug functions
|
||||
std::string get_internal_state_text() const;
|
||||
private:
|
||||
std::atomic<uint64_t> m_local_bc_size; //temporary workaround
|
||||
crypto::hash m_genesis;
|
||||
std::atomic<uint64_t> m_local_bc_size = 1; //temporary workaround
|
||||
crypto::hash m_genesis = currency::gdefault_genesis;
|
||||
std::map<uint64_t, crypto::hash> m_last_20_blocks;
|
||||
std::map<uint64_t, crypto::hash> m_last_144_blocks_every_10; //1 day
|
||||
std::map<uint64_t, crypto::hash> m_last_144_blocks_every_100; //10 days
|
||||
|
|
|
|||
|
|
@ -448,7 +448,7 @@ namespace tools
|
|||
}
|
||||
|
||||
res.payments.clear();
|
||||
std::list<wallet2::payment_details> payment_list;
|
||||
std::list<payment_details> payment_list;
|
||||
w.get_wallet()->get_payments(payment_id, payment_list);
|
||||
for (auto payment : payment_list)
|
||||
{
|
||||
|
|
@ -486,7 +486,7 @@ namespace tools
|
|||
return false;
|
||||
}
|
||||
|
||||
std::list<wallet2::payment_details> payment_list;
|
||||
std::list<payment_details> payment_list;
|
||||
w.get_wallet()->get_payments(payment_id, payment_list, req.min_block_height);
|
||||
|
||||
for (auto & payment : payment_list)
|
||||
|
|
@ -772,7 +772,7 @@ namespace tools
|
|||
bool wallet_rpc_server::on_contracts_get_all(const wallet_public::COMMAND_CONTRACTS_GET_ALL::request& req, wallet_public::COMMAND_CONTRACTS_GET_ALL::response& res, epee::json_rpc::error& er, connection_context& cntx)
|
||||
{
|
||||
WALLET_RPC_BEGIN_TRY_ENTRY();
|
||||
tools::wallet2::escrow_contracts_container ecc;
|
||||
tools::escrow_contracts_container ecc;
|
||||
w.get_wallet()->get_contracts(ecc);
|
||||
res.contracts.resize(ecc.size());
|
||||
size_t i = 0;
|
||||
|
|
|
|||
|
|
@ -1669,7 +1669,7 @@ std::string wallets_manager::get_wallet_info_extra(uint64_t wallet_id, view::wal
|
|||
|
||||
std::string wallets_manager::get_contracts(size_t wallet_id, std::vector<tools::wallet_public::escrow_contract_details>& contracts)
|
||||
{
|
||||
tools::wallet2::escrow_contracts_container cc;
|
||||
tools::escrow_contracts_container cc;
|
||||
GET_WALLET_OPT_BY_ID(wallet_id, w);
|
||||
try
|
||||
{
|
||||
|
|
@ -1693,7 +1693,7 @@ std::string wallets_manager::get_contracts(size_t wallet_id, std::vector<tools::
|
|||
}
|
||||
std::string wallets_manager::create_proposal(const view::create_proposal_param_gui& cpp)
|
||||
{
|
||||
//tools::wallet2::escrow_contracts_container cc;
|
||||
//tools::escrow_contracts_container cc;
|
||||
GET_WALLET_OPT_BY_ID(cpp.wallet_id, w);
|
||||
currency::transaction tx = AUTO_VAL_INIT(tx);
|
||||
currency::transaction template_tx = AUTO_VAL_INIT(template_tx);
|
||||
|
|
|
|||
|
|
@ -634,7 +634,7 @@ bool test_generator::find_kernel(const std::list<currency::account_base>& accs,
|
|||
found_timestamp = context.sk.block_timestamp;
|
||||
found_kh = crypto::cn_fast_hash(&context.sk, sizeof(context.sk)); // TODO: consider passing kernel_hash from scan_pos and do_pos_mining_iteration
|
||||
|
||||
tools::wallet2::transfer_details td = AUTO_VAL_INIT(td);
|
||||
tools::transfer_details td = AUTO_VAL_INIT(td);
|
||||
r = w->get_transfer_info_by_index(context.index, td);
|
||||
CHECK_AND_NO_ASSERT_MES(r, false, "get_transfer_info_by_index() failed for index " << context.index);
|
||||
|
||||
|
|
@ -2151,18 +2151,18 @@ bool make_tx_multisig_to_key(const currency::transaction& source_tx,
|
|||
|
||||
bool estimate_wallet_balance_blocked_for_escrow(const tools::wallet2& w, uint64_t& result, bool substruct_change_from_result /* = true */)
|
||||
{
|
||||
std::deque<tools::wallet2::transfer_details> transfers;
|
||||
std::deque<tools::transfer_details> transfers;
|
||||
w.get_transfers(transfers);
|
||||
|
||||
result = 0;
|
||||
for (const tools::wallet2::transfer_details& td : transfers)
|
||||
for (const tools::transfer_details& td : transfers)
|
||||
{
|
||||
if (td.m_flags == (WALLET_TRANSFER_DETAIL_FLAG_BLOCKED | WALLET_TRANSFER_DETAIL_FLAG_ESCROW_PROPOSAL_RESERVATION))
|
||||
result += td.amount();
|
||||
}
|
||||
if (substruct_change_from_result)
|
||||
{
|
||||
const std::list<tools::wallet2::expiration_entry_info>& ee = w.get_expiration_entries();
|
||||
const std::list<tools::expiration_entry_info>& ee = w.get_expiration_entries();
|
||||
for (auto &e : ee)
|
||||
{
|
||||
uint64_t change_amount_native = 0;
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ bool escrow_altchain_meta_impl::c1(currency::core& c, size_t ev_index, const std
|
|||
LOG_PRINT_YELLOW("sub event #" << eam_event_index << " (height " << e.height << "): eam_event_refresh_and_check", LOG_LEVEL_0);
|
||||
|
||||
LOG_PRINT_GREEN("Alice's wallet is refreshing...", LOG_LEVEL_1);
|
||||
tools::wallet2::escrow_contracts_container contracts;
|
||||
tools::escrow_contracts_container contracts;
|
||||
bool stub;
|
||||
alice_wlt->scan_tx_pool(stub);
|
||||
size_t blocks_fetched = 0;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ inline bool refresh_wallet_and_check_1_contract_state(const char* wallet_name, s
|
|||
LOG_PRINT_CYAN("Scan tx pool for " << wallet_name << "'s wallet...", LOG_LEVEL_0);
|
||||
wallet->scan_tx_pool(stub_bool);
|
||||
|
||||
tools::wallet2::escrow_contracts_container contracts;
|
||||
tools::escrow_contracts_container contracts;
|
||||
r = wallet->get_contracts(contracts);
|
||||
CHECK_AND_ASSERT_MES(r && contracts.size() == 1, false, "get_contracts() for " << wallet_name << " failed or returned wrong contracts count: " << contracts.size());
|
||||
CHECK_AND_ASSERT_MES(contracts.begin()->second.state == expected_contract_state, false, wallet_name << " has invalid contract state: " << tools::wallet_public::get_escrow_contract_state_name(contracts.begin()->second.state)
|
||||
|
|
@ -85,7 +85,7 @@ inline bool refresh_wallet_and_check_contract_state(const char* wallet_name, std
|
|||
CHECK_AND_ASSERT_MES(block_to_be_fetched == SIZE_MAX || blocks_fetched == block_to_be_fetched, false, wallet_name << ": incorrect amount of fetched blocks: " << blocks_fetched << ", expected: " << block_to_be_fetched);
|
||||
wallet->scan_tx_pool(stub_bool);
|
||||
|
||||
tools::wallet2::escrow_contracts_container contracts;
|
||||
tools::escrow_contracts_container contracts;
|
||||
r = wallet->get_contracts(contracts);
|
||||
CHECK_AND_ASSERT_MES(r, false, "get_contracts() for " << wallet_name << " failed");
|
||||
for (const auto& c : contracts)
|
||||
|
|
@ -611,7 +611,7 @@ inline bool operator==(const bc_services::contract_private_details& lhs, const b
|
|||
lhs.title == rhs.title;
|
||||
}
|
||||
|
||||
inline bool check_contract_state(const tools::wallet2::escrow_contracts_container& contracts, const bc_services::contract_private_details& cpd, tools::wallet_public::escrow_contract_details::contract_state state, const char* party)
|
||||
inline bool check_contract_state(const tools::escrow_contracts_container& contracts, const bc_services::contract_private_details& cpd, tools::wallet_public::escrow_contract_details::contract_state state, const char* party)
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(contracts.size() == 1, false, party << " has incorrect number of contracts: " << contracts.size());
|
||||
CHECK_AND_ASSERT_MES(contracts.begin()->second.private_detailes == cpd, false, party << " has invalid contract's private details");
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ bool escrow_wallet_test::prepare_proposal_accepted_test(currency::core& c, const
|
|||
wallet_buyer->refresh();
|
||||
wallet_seller->refresh();
|
||||
|
||||
tools::wallet2::escrow_contracts_container contracts_buyer, contracts_seller;
|
||||
tools::escrow_contracts_container contracts_buyer, contracts_seller;
|
||||
wallet_buyer->get_contracts(contracts_buyer);
|
||||
wallet_seller->get_contracts(contracts_seller);
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ bool escrow_wallet_test::prepare_proposal_accepted_test(currency::core& c, const
|
|||
CHECK_AND_FORCE_ASSERT_MES(contracts_buyer.begin()->second.state == tools::wallet_public::escrow_contract_details_basic::contract_accepted, false, "Incorrect contracts_buyer state");
|
||||
CHECK_AND_FORCE_ASSERT_MES(contracts_seller.begin()->second.state == tools::wallet_public::escrow_contract_details_basic::contract_accepted, false, "Incorrect contracts_seller state");
|
||||
|
||||
tools::wallet2::multisig_transfer_container ms_buyer, ms_seller;
|
||||
tools::multisig_transfer_container ms_buyer, ms_seller;
|
||||
wallet_buyer->get_multisig_transfers(ms_buyer);
|
||||
wallet_seller->get_multisig_transfers(ms_seller);
|
||||
CHECK_AND_FORCE_ASSERT_MES(ms_buyer.size() == 1, false, "Incorrect contracts_buyer state");
|
||||
|
|
@ -195,7 +195,7 @@ bool escrow_wallet_test::exec_test_with_specific_release_type(currency::core& c,
|
|||
expected_state = tools::wallet_public::escrow_contract_details_basic::contract_released_burned;
|
||||
}
|
||||
|
||||
tools::wallet2::escrow_contracts_container contracts_buyer, contracts_seller;
|
||||
tools::escrow_contracts_container contracts_buyer, contracts_seller;
|
||||
wallet_buyer->finish_contract(multisig_id, release_instruction);
|
||||
r = mine_next_pow_blocks_in_playtime(m_mining_accunt.get_public_address(), c, 2);
|
||||
wallet_buyer->refresh();
|
||||
|
|
@ -232,7 +232,7 @@ bool escrow_wallet_test::exec_test_with_cancel_release_type(currency::core& c, c
|
|||
wallet_miner->transfer(TESTS_DEFAULT_FEE, wallet_buyer->get_account().get_public_address());
|
||||
r = mine_next_pow_blocks_in_playtime(m_mining_accunt.get_public_address(), c, 10);
|
||||
wallet_buyer->refresh();
|
||||
tools::wallet2::escrow_contracts_container contracts_buyer, contracts_seller;
|
||||
tools::escrow_contracts_container contracts_buyer, contracts_seller;
|
||||
wallet_buyer->request_cancel_contract(multisig_id, TESTS_DEFAULT_FEE, 60 * 60);
|
||||
r = mine_next_pow_blocks_in_playtime(m_mining_accunt.get_public_address(), c, 2);
|
||||
wallet_buyer->refresh();
|
||||
|
|
@ -643,7 +643,7 @@ bool escrow_incorrect_proposal::check_normal_proposal(currency::core& c, size_t
|
|||
std::shared_ptr<tools::wallet2> alice_wlt = init_playtime_test_wallet(events, c, ALICE_ACC_IDX);
|
||||
alice_wlt->refresh();
|
||||
|
||||
tools::wallet2::escrow_contracts_container contracts;
|
||||
tools::escrow_contracts_container contracts;
|
||||
alice_wlt->get_contracts(contracts);
|
||||
CHECK_AND_ASSERT_MES(contracts.size() == 1, false, "Alice didn't receive escrow proposal");
|
||||
CHECK_AND_ASSERT_MES(contracts.begin()->second.is_a == false, false, "proposal has wrong is_a");
|
||||
|
|
@ -682,7 +682,7 @@ bool escrow_incorrect_proposal::check_incorrect_proposal(currency::core& c, size
|
|||
std::shared_ptr<tools::wallet2> alice_wlt = init_playtime_test_wallet(events, c, ALICE_ACC_IDX);
|
||||
alice_wlt->refresh();
|
||||
|
||||
tools::wallet2::escrow_contracts_container contracts;
|
||||
tools::escrow_contracts_container contracts;
|
||||
alice_wlt->get_contracts(contracts);
|
||||
|
||||
if (contracts.size() != 0)
|
||||
|
|
@ -780,7 +780,7 @@ bool escrow_proposal_expiration::c1(currency::core& c, size_t ev_index, const st
|
|||
uint64_t alice_post_proposal_balance = alice_wlt->balance();
|
||||
uint64_t alice_post_proposal_balance_expected = alice_start_balance - TESTS_DEFAULT_FEE;
|
||||
CHECK_AND_ASSERT_MES(alice_post_proposal_balance == alice_post_proposal_balance_expected, false, "Incorrect alice_post_proposal_balance: " << print_money(alice_post_proposal_balance) << ", expected: " << print_money(alice_post_proposal_balance_expected));
|
||||
std::deque<tools::wallet2::transfer_details> transfers;
|
||||
std::deque<tools::transfer_details> transfers;
|
||||
alice_wlt->get_transfers(transfers);
|
||||
CHECK_AND_ASSERT_MES(transfers.size() == 2 && (
|
||||
(transfers[0].is_spent() && (transfers[1].m_flags & (WALLET_TRANSFER_DETAIL_FLAG_BLOCKED | WALLET_TRANSFER_DETAIL_FLAG_ESCROW_PROPOSAL_RESERVATION))) ||
|
||||
|
|
@ -1330,7 +1330,7 @@ bool escrow_incorrect_proposal_acceptance::check_normal_acceptance(currency::cor
|
|||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
|
||||
|
||||
tools::wallet2::escrow_contracts_container contracts;
|
||||
tools::escrow_contracts_container contracts;
|
||||
r = alice_wlt->get_contracts(contracts);
|
||||
CHECK_AND_ASSERT_MES(r, false, "get_contracts() for Alice failed");
|
||||
|
||||
|
|
@ -1393,7 +1393,7 @@ bool escrow_incorrect_proposal_acceptance::check_incorrect_acceptance(currency::
|
|||
alice_wlt->dump_trunsfers(ss, false);
|
||||
LOG_PRINT_L0("check_incorrect_acceptance(" << param << "):" << ENDL << "Alice balance: " << print_money(alice_balance) << ", transfers: " << ENDL << ss.str());
|
||||
|
||||
tools::wallet2::escrow_contracts_container contracts;
|
||||
tools::escrow_contracts_container contracts;
|
||||
r = alice_wlt->get_contracts(contracts);
|
||||
CHECK_AND_ASSERT_MES(r, false, "get_contracts() for Alice failed");
|
||||
|
||||
|
|
@ -1723,7 +1723,7 @@ bool escrow_custom_test::do_custom_test(currency::core& c, size_t ev_index, cons
|
|||
bob_wlt->refresh();
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*bob_wlt.get(), "Bob", bob_start_balance, 0, INVALID_BALANCE_VAL, 0, 0), false, "");
|
||||
|
||||
tools::wallet2::escrow_contracts_container contracts;
|
||||
tools::escrow_contracts_container contracts;
|
||||
r = bob_wlt->get_contracts(contracts);
|
||||
CHECK_AND_ASSERT_MES(r, false, "get_contracts() for Bob failed");
|
||||
CHECK_AND_ASSERT_MES(check_contract_state(contracts, cd.cpd, tools::wallet_public::escrow_contract_details::proposal_sent, "Bob"), false, "wrong contract");
|
||||
|
|
@ -2121,7 +2121,7 @@ bool escrow_incorrect_cancel_proposal::check_normal_cancel_proposal(currency::co
|
|||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
|
||||
|
||||
tools::wallet2::escrow_contracts_container contracts;
|
||||
tools::escrow_contracts_container contracts;
|
||||
r = alice_wlt->get_contracts(contracts);
|
||||
CHECK_AND_ASSERT_MES(r, false, "get_contracts() for Alice failed");
|
||||
CHECK_AND_ASSERT_MES(contracts.size() == 1, false, "Alice has incorrect number of contracts: " << contracts.size());
|
||||
|
|
@ -2209,7 +2209,7 @@ bool escrow_incorrect_cancel_proposal::check_incorrect_cancel_proposal_internal(
|
|||
|
||||
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Incorrect txs count in the pool");
|
||||
|
||||
tools::wallet2::escrow_contracts_container contracts;
|
||||
tools::escrow_contracts_container contracts;
|
||||
r = alice_wlt->get_contracts(contracts);
|
||||
CHECK_AND_ASSERT_MES(r, false, "get_contracts() for Alice failed");
|
||||
CHECK_AND_ASSERT_MES(contracts.size() == 1, false, "Alice has incorrect number of contracts: " << contracts.size());
|
||||
|
|
@ -2283,7 +2283,7 @@ bool escrow_proposal_not_enough_money::c1(currency::core& c, size_t ev_index, co
|
|||
|
||||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt.get(), "Alice", MK_TEST_COINS(30), 0, MK_TEST_COINS(30), 0, 0), false, "");
|
||||
|
||||
std::deque<tools::wallet2::transfer_details> transfers;
|
||||
std::deque<tools::transfer_details> transfers;
|
||||
alice_wlt->get_transfers(transfers);
|
||||
CHECK_AND_ASSERT_MES(transfers.size() == 1, false, "Incorrect transfers size: " << transfers.size());
|
||||
|
||||
|
|
@ -2392,7 +2392,7 @@ bool escrow_cancellation_and_tx_order::c1(currency::core& c, size_t ev_index, co
|
|||
LOG_PRINT_GREEN("\n" "alice_wlt->send_escrow_proposal()", LOG_LEVEL_0);
|
||||
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_time, TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, "", proposal_tx, escrow_template_tx);
|
||||
|
||||
tools::wallet2::escrow_contracts_container contracts;
|
||||
tools::escrow_contracts_container contracts;
|
||||
r = alice_wlt->get_contracts(contracts);
|
||||
CHECK_AND_ASSERT_MES(r, false, "get_contracts() for Alice failed");
|
||||
CHECK_AND_ASSERT_MES(contracts.size() == 1, false, "Alice has incorrect number of contracts: " << contracts.size());
|
||||
|
|
@ -2593,7 +2593,7 @@ bool escrow_cancellation_proposal_expiration::c1(currency::core& c, size_t ev_in
|
|||
LOG_PRINT_GREEN("\n" "alice_wlt->send_escrow_proposal()", LOG_LEVEL_0);
|
||||
alice_wlt->send_escrow_proposal(cpd, 0, 0, expiration_time, TESTS_DEFAULT_FEE, b_release_fee, "", proposal_tx, escrow_template_tx);
|
||||
|
||||
tools::wallet2::escrow_contracts_container contracts;
|
||||
tools::escrow_contracts_container contracts;
|
||||
r = alice_wlt->get_contracts(contracts);
|
||||
CHECK_AND_ASSERT_MES(r, false, "get_contracts() for Alice failed");
|
||||
CHECK_AND_ASSERT_MES(contracts.size() == 1, false, "Alice has incorrect number of contracts: " << contracts.size());
|
||||
|
|
@ -2843,7 +2843,7 @@ bool escrow_cancellation_acceptance_expiration::c1(currency::core& c, size_t ev_
|
|||
CHECK_AND_ASSERT_MES(refresh_wallet_and_check_1_contract_state("Alice", alice_wlt, tools::wallet_public::escrow_contract_details::proposal_sent), false, "");
|
||||
CHECK_AND_ASSERT_MES(refresh_wallet_and_check_1_contract_state("Bob", bob_wlt, tools::wallet_public::escrow_contract_details::proposal_sent), false, "");
|
||||
|
||||
tools::wallet2::escrow_contracts_container contracts;
|
||||
tools::escrow_contracts_container contracts;
|
||||
r = alice_wlt->get_contracts(contracts);
|
||||
CHECK_AND_ASSERT_MES(r && contracts.size() == 1, false, "get_contracts() for Alice failed");
|
||||
crypto::hash contract_id = contracts.begin()->first;
|
||||
|
|
@ -3217,7 +3217,7 @@ bool escrow_balance::c1(currency::core& c, size_t ev_index, const std::vector<te
|
|||
|
||||
CHECK_AND_ASSERT_MES(alice_bc->check(), false, "balance callback check failed, see above");
|
||||
|
||||
tools::wallet2::escrow_contracts_container contracts;
|
||||
tools::escrow_contracts_container contracts;
|
||||
r = alice_wlt->get_contracts(contracts);
|
||||
CHECK_AND_ASSERT_MES(r && contracts.size() == 1, false, "get_contracts() for Alice failed");
|
||||
crypto::hash contract_id = contracts.begin()->first;
|
||||
|
|
|
|||
|
|
@ -493,9 +493,9 @@ bool assets_and_explicit_native_coins_in_outs::c2_alice_deploys_asset(currency::
|
|||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt, "Alice", m_alice_initial_balance - TESTS_DEFAULT_FEE, 0, m_alice_initial_balance - TESTS_DEFAULT_FEE, 0, 0), false, "");
|
||||
|
||||
// make sure Alice has two UTXO now
|
||||
tools::wallet2::transfer_container transfers{};
|
||||
tools::transfer_container transfers{};
|
||||
alice_wlt->get_transfers(transfers);
|
||||
size_t unspent_transfers = std::count_if(transfers.begin(), transfers.end(), [](const tools::wallet2::transfer_details& tr){ return !tr.is_spent(); });
|
||||
size_t unspent_transfers = std::count_if(transfers.begin(), transfers.end(), [](const tools::transfer_details& tr){ return !tr.is_spent(); });
|
||||
CHECK_AND_ASSERT_MES(unspent_transfers == 2, false, "unexpected number of Alice's unspent transfers: " << unspent_transfers);
|
||||
|
||||
asset_descriptor_base adb{};
|
||||
|
|
@ -654,7 +654,7 @@ bool asset_depoyment_and_few_zc_utxos::c1(currency::core& c, size_t ev_index, co
|
|||
CHECK_AND_ASSERT_MES(check_balance_via_wallet(*alice_wlt, "Alice", m_alice_initial_balance, 0, m_alice_initial_balance, 0, 0), false, "");
|
||||
|
||||
// make sure Alice has correct UTXO wallet structure
|
||||
tools::wallet2::transfer_container transfers{};
|
||||
tools::transfer_container transfers{};
|
||||
alice_wlt->get_transfers(transfers);
|
||||
size_t zc_unspent_outs = 0, unspent_outs = 0;
|
||||
for(auto& td : transfers)
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ bool multisig_wallet_test::c1(currency::core& c, size_t ev_index, const std::vec
|
|||
|
||||
wallet_a->refresh();
|
||||
wallet_b->refresh();
|
||||
tools::wallet2::multisig_transfer_container ms_a, ms_b;
|
||||
tools::multisig_transfer_container ms_a, ms_b;
|
||||
wallet_a->get_multisig_transfers(ms_a);
|
||||
wallet_b->get_multisig_transfers(ms_b);
|
||||
CHECK_AND_ASSERT_MES(ms_a.size() == 1 && ms_b.size() == 1, false, "Multisig failed: ms_a.size() == 1 && ms_b.size() == 1");
|
||||
|
|
@ -334,7 +334,7 @@ bool multisig_wallet_test_many_dst::c1(currency::core& c, size_t ev_index, const
|
|||
r = check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", amount - TESTS_DEFAULT_FEE);
|
||||
CHECK_AND_ASSERT_MES(r, false, "invalid balance");
|
||||
|
||||
tools::wallet2::multisig_transfer_container mstc;
|
||||
tools::multisig_transfer_container mstc;
|
||||
alice_wlt->get_multisig_transfers(mstc);
|
||||
CHECK_AND_ASSERT_MES(mstc.empty(), false, "Got invalid multisig transfer");
|
||||
|
||||
|
|
@ -446,7 +446,7 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
|
|||
CHECK_AND_ASSERT_MES(blocks_fetched == CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 1, false, "Incorrect numbers of blocks fetched");
|
||||
r = check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", amount5 + TESTS_DEFAULT_FEE);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Invalid wallet balance");
|
||||
tools::wallet2::multisig_transfer_container alice_mstc;
|
||||
tools::multisig_transfer_container alice_mstc;
|
||||
alice_wlt->get_multisig_transfers(alice_mstc);
|
||||
CHECK_AND_ASSERT_MES(alice_mstc.size() == 2 && alice_mstc.count(ms1_hash) == 1 && alice_mstc.count(ms3_hash) == 1, false, "Alice has incorrect multisig transfers");
|
||||
|
||||
|
|
@ -456,7 +456,7 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
|
|||
CHECK_AND_ASSERT_MES(blocks_fetched == CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 1, false, "Incorrect numbers of blocks fetched");
|
||||
r = check_balance_via_wallet(*bob_wlt.get(), "bob_wlt", 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Invalid wallet balance");
|
||||
tools::wallet2::multisig_transfer_container bob_mstc;
|
||||
tools::multisig_transfer_container bob_mstc;
|
||||
bob_wlt->get_multisig_transfers(bob_mstc);
|
||||
CHECK_AND_ASSERT_MES(bob_mstc.size() == 2 && bob_mstc.count(ms1_hash) == 1 && bob_mstc.count(ms4_hash) == 1, false, "Bob has incorrect multisig transfers");
|
||||
|
||||
|
|
@ -466,7 +466,7 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
|
|||
CHECK_AND_ASSERT_MES(blocks_fetched == CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 1, false, "Incorrect numbers of blocks fetched");
|
||||
r = check_balance_via_wallet(*carol_wlt.get(), "carol_wlt", 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Invalid wallet balance");
|
||||
tools::wallet2::multisig_transfer_container carol_mstc;
|
||||
tools::multisig_transfer_container carol_mstc;
|
||||
carol_wlt->get_multisig_transfers(carol_mstc);
|
||||
CHECK_AND_ASSERT_MES(carol_mstc.size() == 2 && carol_mstc.count(ms2_hash) == 1 && carol_mstc.count(ms4_hash) == 1, false, "Carol has incorrect multisig transfers");
|
||||
|
||||
|
|
@ -476,7 +476,7 @@ bool multisig_wallet_heterogenous_dst::c1(currency::core& c, size_t ev_index, co
|
|||
CHECK_AND_ASSERT_MES(blocks_fetched == CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 1, false, "Incorrect numbers of blocks fetched");
|
||||
r = check_balance_via_wallet(*dan_wlt.get(), "dan_wlt", amount6 + TESTS_DEFAULT_FEE);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Invalid wallet balance");
|
||||
tools::wallet2::multisig_transfer_container dan_mstc;
|
||||
tools::multisig_transfer_container dan_mstc;
|
||||
dan_wlt->get_multisig_transfers(dan_mstc);
|
||||
CHECK_AND_ASSERT_MES(dan_mstc.size() == 2 && dan_mstc.count(ms2_hash) == 1 && dan_mstc.count(ms3_hash) == 1, false, "Dan has incorrect multisig transfers");
|
||||
|
||||
|
|
@ -2540,7 +2540,7 @@ bool multisig_unconfirmed_transfer_and_multiple_scan_pool_calls::c1(currency::co
|
|||
|
||||
miner_wlt->refresh();
|
||||
alice_wlt->refresh();
|
||||
tools::wallet2::multisig_transfer_container ms_m, ms_a;
|
||||
tools::multisig_transfer_container ms_m, ms_a;
|
||||
miner_wlt->get_multisig_transfers(ms_m);
|
||||
alice_wlt->get_multisig_transfers(ms_a);
|
||||
CHECK_AND_ASSERT_MES(ms_m.size() == 1 && ms_a.size() == 1, false, "Multisig failed: ms_m.size() == 1 && ms_a.size() == 1");
|
||||
|
|
@ -2571,7 +2571,7 @@ bool multisig_unconfirmed_transfer_and_multiple_scan_pool_calls::c1(currency::co
|
|||
LOG_PRINT_YELLOW("%%%%% tx " << get_transaction_hash(tx) << " is spending multisig output " << multisig_id, LOG_LEVEL_0);
|
||||
|
||||
bool stub;
|
||||
std::deque<tools::wallet2::transfer_details> transfers;
|
||||
std::deque<tools::transfer_details> transfers;
|
||||
std::vector<tools::wallet_public::wallet_transfer_info> unconfirmed_transfers;
|
||||
|
||||
alice_wlt->scan_tx_pool(stub);
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ bool wallet_rpc_integrated_address_transfer::c1(currency::core& c, size_t ev_ind
|
|||
CHECK_AND_ASSERT_MES(refresh_wallet_and_check_balance("", "Alice", alice_wlt, tds.amount), false, "");
|
||||
|
||||
// check the transfer has been received
|
||||
std::list<tools::wallet2::payment_details> payments;
|
||||
std::list<tools::payment_details> payments;
|
||||
alice_wlt->get_payments(payment_id, payments);
|
||||
CHECK_AND_ASSERT_MES(payments.size() == 1, false, "Invalid payments count: " << payments.size());
|
||||
CHECK_AND_ASSERT_MES(payments.front().m_amount == MK_TEST_COINS(3), false, "Invalid payment");
|
||||
|
|
@ -254,7 +254,7 @@ bool wallet_rpc_transfer::c1(currency::core& c, size_t ev_index, const std::vect
|
|||
CHECK_AND_ASSERT_MES(refresh_wallet_and_check_balance("", "Alice", alice_wlt, tds.amount), false, "");
|
||||
|
||||
// check the transfer has been received
|
||||
tools::wallet2::transfer_details td = AUTO_VAL_INIT(td);
|
||||
tools::transfer_details td = AUTO_VAL_INIT(td);
|
||||
CHECK_AND_ASSERT_MES(alice_wlt->get_transfer_info_by_index(0, td), false, "");
|
||||
CHECK_AND_ASSERT_MES(td.amount() == MK_TEST_COINS(3), false, "Invalid payment");
|
||||
CHECK_AND_ASSERT_MES(check_mixin_value_for_each_input(2, td.tx_hash(), c), false, "");
|
||||
|
|
|
|||
|
|
@ -1072,10 +1072,10 @@ bool gen_wallet_payment_id::generate(std::vector<test_event_entry>& events) cons
|
|||
CHECK_TEST_WALLET_BALANCE_AT_GEN_TIME(alice_wlt, MK_TEST_COINS(40 + 5 + 7 - 10 + 13 + 1) - TESTS_DEFAULT_FEE);
|
||||
DO_CALLBACK_PARAMS(events, "check_balance", params_check_balance(ALICE_ACC_IDX, MK_TEST_COINS(40 + 5 + 7 - 10 + 13 + 1) - TESTS_DEFAULT_FEE));
|
||||
|
||||
std::list<tools::wallet2::payment_details> payments;
|
||||
std::list<tools::payment_details> payments;
|
||||
alice_wlt->get_payments(m_payment_id, payments);
|
||||
CHECK_AND_ASSERT_MES(payments.size() == 3, false, "Invalid payments count");
|
||||
payments.sort([](const tools::wallet2::payment_details& lhs, const tools::wallet2::payment_details& rhs) -> bool { return lhs.m_amount < rhs.m_amount; } ); // sort payments by amount to order them for further checks
|
||||
payments.sort([](const tools::payment_details& lhs, const tools::payment_details& rhs) -> bool { return lhs.m_amount < rhs.m_amount; } ); // sort payments by amount to order them for further checks
|
||||
CHECK_AND_ASSERT_MES(payments.front().m_amount == MK_TEST_COINS(5) && payments.front().m_tx_hash == get_transaction_hash(tx_1), false, "Invalid payments #1");
|
||||
CHECK_AND_ASSERT_MES(payments.back().m_amount == MK_TEST_COINS(13) && payments.back().m_tx_hash == get_transaction_hash(tx_4), false, "Invalid payments #3");
|
||||
payments.clear();
|
||||
|
|
@ -1104,7 +1104,7 @@ bool gen_wallet_payment_id::generate(std::vector<test_event_entry>& events) cons
|
|||
payments.clear();
|
||||
alice_wlt->get_payments(m_payment_id, payments);
|
||||
CHECK_AND_ASSERT_MES(payments.size() == 3, false, "Invalid payments count (2)");
|
||||
payments.sort([](const tools::wallet2::payment_details& lhs, const tools::wallet2::payment_details& rhs) -> bool { return lhs.m_amount < rhs.m_amount; } ); // sort payments by amount to order them for further checks
|
||||
payments.sort([](const tools::payment_details& lhs, const tools::payment_details& rhs) -> bool { return lhs.m_amount < rhs.m_amount; } ); // sort payments by amount to order them for further checks
|
||||
CHECK_AND_ASSERT_MES(payments.front().m_amount == MK_TEST_COINS(5) && payments.front().m_tx_hash == get_transaction_hash(tx_1), false, "Invalid payments #1");
|
||||
CHECK_AND_ASSERT_MES(payments.back().m_amount == MK_TEST_COINS(9) && payments.back().m_tx_hash == get_transaction_hash(tx_6), false, "Invalid payments #3");
|
||||
|
||||
|
|
@ -1126,10 +1126,10 @@ bool gen_wallet_payment_id::c1(currency::core& c, size_t ev_index, const std::ve
|
|||
if (!check_balance_via_wallet(*alice_wlt.get(), "alice_wlt", MK_TEST_COINS(56) - TESTS_DEFAULT_FEE, 0, 0, 0, 0))
|
||||
return false;
|
||||
|
||||
std::list<tools::wallet2::payment_details> payments;
|
||||
std::list<tools::payment_details> payments;
|
||||
alice_wlt->get_payments(m_payment_id, payments);
|
||||
CHECK_AND_ASSERT_MES(payments.size() == 3, false, "Invalid payments count (4)");
|
||||
payments.sort([](const tools::wallet2::payment_details& lhs, const tools::wallet2::payment_details& rhs) -> bool { return lhs.m_amount < rhs.m_amount; } ); // sort payments by amount to order them for further checks
|
||||
payments.sort([](const tools::payment_details& lhs, const tools::payment_details& rhs) -> bool { return lhs.m_amount < rhs.m_amount; } ); // sort payments by amount to order them for further checks
|
||||
CHECK_AND_ASSERT_MES(payments.front().m_amount == MK_TEST_COINS(5), false, "Invalid payments #1");
|
||||
CHECK_AND_ASSERT_MES(payments.back().m_amount == MK_TEST_COINS(13), false, "Invalid payments #3");
|
||||
|
||||
|
|
@ -1157,10 +1157,10 @@ bool gen_wallet_payment_id::c2(currency::core& c, size_t ev_index, const std::ve
|
|||
return false;
|
||||
|
||||
|
||||
std::list<tools::wallet2::payment_details> payments;
|
||||
std::list<tools::payment_details> payments;
|
||||
alice_wlt->get_payments(m_payment_id, payments);
|
||||
CHECK_AND_ASSERT_MES(payments.size() == 3, false, "Invalid payments count (4)");
|
||||
payments.sort([](const tools::wallet2::payment_details& lhs, const tools::wallet2::payment_details& rhs) -> bool { return lhs.m_amount < rhs.m_amount; } ); // sort payments by amount to order them for further checks
|
||||
payments.sort([](const tools::payment_details& lhs, const tools::payment_details& rhs) -> bool { return lhs.m_amount < rhs.m_amount; } ); // sort payments by amount to order them for further checks
|
||||
CHECK_AND_ASSERT_MES(payments.front().m_amount == MK_TEST_COINS(5), false, "Invalid payments #1");
|
||||
CHECK_AND_ASSERT_MES(payments.back().m_amount == MK_TEST_COINS(9), false, "Invalid payments #3");
|
||||
|
||||
|
|
@ -1230,7 +1230,7 @@ bool gen_wallet_oversized_payment_id::c1(currency::core& c, size_t ev_index, con
|
|||
alice_wlt->refresh(blocks_fetched, received_money, atomic_false);
|
||||
CHECK_AND_ASSERT_MES(blocks_fetched == CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 3 + 1, false, "incorrect number of blocks fetched by Alice's wallet: " << blocks_fetched);
|
||||
|
||||
std::list<tools::wallet2::payment_details> payments;
|
||||
std::list<tools::payment_details> payments;
|
||||
alice_wlt->get_payments(payment_id, payments);
|
||||
CHECK_AND_ASSERT_MES(payments.size() == 1, false, "Invalid payments count: " << payments.size());
|
||||
CHECK_AND_ASSERT_MES(payments.front().m_amount == MK_TEST_COINS(3), false, "Invalid payment");
|
||||
|
|
@ -1306,7 +1306,7 @@ bool gen_wallet_transfers_and_outdated_unconfirmed_txs::generate(std::vector<tes
|
|||
// refresh the wallet and check transfers, both should be not spent
|
||||
CREATE_TEST_WALLET(alice_wlt, alice_acc, blk_0);
|
||||
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_1r, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 2 + WALLET_DEFAULT_TX_SPENDABLE_AGE);
|
||||
tools::wallet2::transfer_container trs;
|
||||
tools::transfer_container trs;
|
||||
alice_wlt->get_transfers(trs);
|
||||
CHECK_AND_ASSERT_MES(trs.size() == 2 && !trs[0].is_spent() && !trs[1].is_spent(), false, "Wrong transfers state");
|
||||
|
||||
|
|
@ -1383,7 +1383,7 @@ bool gen_wallet_transfers_and_chain_switch::generate(std::vector<test_event_entr
|
|||
// refresh the wallet and check transfers, both should be not spent
|
||||
CREATE_TEST_WALLET(alice_wlt, alice_acc, blk_0);
|
||||
REFRESH_TEST_WALLET_AT_GEN_TIME(events, alice_wlt, blk_1r, CURRENCY_MINED_MONEY_UNLOCK_WINDOW + 1 + WALLET_DEFAULT_TX_SPENDABLE_AGE);
|
||||
tools::wallet2::transfer_container trs;
|
||||
tools::transfer_container trs;
|
||||
alice_wlt->get_transfers(trs);
|
||||
CHECK_AND_ASSERT_MES(trs.size() == 2 && !trs[0].is_spent() && !trs[1].is_spent(), false, "Wrong transfers state");
|
||||
|
||||
|
|
|
|||
|
|
@ -193,11 +193,11 @@ bool do_send_money_by_fractions(tools::wallet2& w1, tools::wallet2& w2, size_t m
|
|||
}
|
||||
}
|
||||
|
||||
uint64_t got_money_in_first_transfers(const tools::wallet2::transfer_container& incoming_transfers, size_t n_transfers)
|
||||
uint64_t got_money_in_first_transfers(const tools::transfer_container& incoming_transfers, size_t n_transfers)
|
||||
{
|
||||
uint64_t summ = 0;
|
||||
size_t count = 0;
|
||||
BOOST_FOREACH(const tools::wallet2::transfer_details& td, incoming_transfers)
|
||||
BOOST_FOREACH(const tools::transfer_details& td, incoming_transfers)
|
||||
{
|
||||
summ += boost::get<tx_out_bare>(td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index]).amount;
|
||||
if(++count >= n_transfers)
|
||||
|
|
@ -240,7 +240,7 @@ void wait_unlock_money(tools::wallet2& w, flow_test_context& control)
|
|||
|
||||
std::string get_incoming_transfers_str(tools::wallet2& w)
|
||||
{
|
||||
tools::wallet2::transfer_container transfers;
|
||||
tools::transfer_container transfers;
|
||||
w.get_transfers(transfers);
|
||||
|
||||
uint64_t spent_count = 0;
|
||||
|
|
@ -453,7 +453,7 @@ bool transactions_flow_test(
|
|||
LOG_PRINT_GREEN("Transfers: " << get_incoming_transfers_str(w1), LOG_LEVEL_0);
|
||||
|
||||
uint64_t transfer_size = TX_DEFAULT_FEE;//amount_to_transfer / transactions_count;
|
||||
tools::wallet2::transfer_container incoming_transfers;
|
||||
tools::transfer_container incoming_transfers;
|
||||
size_t prepared_transfers = 0;
|
||||
|
||||
|
||||
|
|
@ -469,7 +469,7 @@ bool transactions_flow_test(
|
|||
//lets go!
|
||||
size_t count = 0;
|
||||
prepared_transfers = 0;
|
||||
BOOST_FOREACH(tools::wallet2::transfer_details& td, incoming_transfers)
|
||||
BOOST_FOREACH(tools::transfer_details& td, incoming_transfers)
|
||||
{
|
||||
if (td.is_spent())
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue