35#include <boost/program_options/options_description.hpp>
36#include <boost/program_options/variables_map.hpp>
37#if BOOST_VERSION >= 107400
38#include <boost/serialization/library_version_type.hpp>
40#include <boost/serialization/list.hpp>
41#include <boost/serialization/vector.hpp>
42#include <boost/serialization/deque.hpp>
43#include <boost/thread/lock_guard.hpp>
76#undef MONERO_DEFAULT_LOG_CATEGORY
77#define MONERO_DEFAULT_LOG_CATEGORY "wallet.wallet2"
79#define THROW_ON_RPC_RESPONSE_ERROR(r, error, res, method, ...) \
81 handle_payment_changes(res, std::integral_constant<bool, HasCredits<decltype(res)>::Has>()); \
82 throw_on_rpc_response_error(r, error, res.status, method); \
83 THROW_WALLET_EXCEPTION_IF(res.status != CORE_RPC_STATUS_OK, ## __VA_ARGS__); \
86#define THROW_ON_RPC_RESPONSE_ERROR_GENERIC(r, err, res, method) \
87 THROW_ON_RPC_RESPONSE_ERROR(r, err, res, method, tools::error::wallet_generic_rpc_error, method, res.status)
89class Serialization_portability_wallet_Test;
111 static constexpr result_type max() {
return std::numeric_limits<result_type>::max(); }
116 std::gamma_distribution<double>
gamma;
147 virtual boost::optional<epee::wipeable_string>
on_get_password(
const char *reason) {
return boost::none; }
209 template <
class t_archive>
233 friend class ::Serialization_portability_wallet_Test;
234 friend class ::wallet_accessor_test;
238 static constexpr const std::chrono::seconds
rpc_timeout = std::chrono::minutes(3) + std::chrono::seconds(30);
270 throw std::logic_error(
"Unknown background sync type");
278 static const char*
tr(
const char*
str);
280 static bool has_testnet_option(
const boost::program_options::variables_map&
vm);
281 static bool has_stagenet_option(
const boost::program_options::variables_map&
vm);
282 static std::string device_name_option(
const boost::program_options::variables_map&
vm);
283 static std::string device_derivation_path_option(
const boost::program_options::variables_map &
vm);
284 static void init_options(boost::program_options::options_description& desc_params);
287 static std::pair<std::unique_ptr<wallet2>,
password_container> make_from_json(
const boost::program_options::variables_map&
vm,
bool unattended,
const std::string& json_file,
const std::function<boost::optional<password_container>(
const char *,
bool)> &password_prompter);
291 make_from_file(
const boost::program_options::variables_map&
vm,
bool unattended,
const std::string& wallet_file,
const std::function<boost::optional<password_container>(
const char *,
bool)> &password_prompter);
294 static std::pair<std::unique_ptr<wallet2>,
password_container> make_new(
const boost::program_options::variables_map&
vm,
bool unattended,
const std::function<boost::optional<password_container>(
const char *,
bool)> &password_prompter);
297 static std::unique_ptr<wallet2> make_dummy(
const boost::program_options::variables_map&
vm,
bool unattended,
const std::function<boost::optional<password_container>(
const char *,
bool)> &password_prompter);
302 return verify_password(keys_file_name, password, no_spend_key, hwdev, kdf_rounds, spend_key);
342 boost::optional<cryptonote::subaddress_receive_info>
received;
368 std::vector<std::pair<uint64_t, crypto::hash>>
m_uses;
378 return output_public_key;
382 FIELD(m_block_height)
385 FIELD(m_internal_output_index)
386 FIELD(m_global_output_index)
389 FIELD(m_spent_height)
394 FIELD(m_key_image_known)
395 FIELD(m_key_image_request)
397 FIELD(m_subaddr_index)
398 FIELD(m_key_image_partial)
400 FIELD(m_multisig_info)
497 std::vector<cryptonote::tx_destination_entry>
m_dests;
503 std::vector<std::pair<crypto::key_image, std::vector<uint64_t>>>
m_rings;
530 std::vector<cryptonote::tx_destination_entry>
m_dests;
536 std::vector<std::pair<crypto::key_image, std::vector<uint64_t>>>
m_rings;
540 m_tx(utd.
m_tx),
m_amount_in(utd.
m_amount_in),
m_amount_out(utd.
m_amount_out),
m_change(utd.
m_change),
m_block_height(height),
m_dests(utd.
m_dests),
m_payment_id(utd.
m_payment_id),
m_timestamp(utd.
m_timestamp),
m_unlock_time(utd.
m_tx.unlock_time),
m_subaddr_account(utd.
m_subaddr_account),
m_subaddr_indices(utd.
m_subaddr_indices),
m_rings(utd.
m_rings) {}
555 FIELD(m_subaddr_indices)
562 std::vector<cryptonote::tx_source_entry>
sources;
571 std::vector<cryptonote::tx_destination_entry>
dests;
595 if (!typename Archive<W>::is_saving())
614 FIELD(subaddr_account)
615 FIELD(subaddr_indices)
626 std::unordered_set<crypto::public_key>
ignore;
665 std::vector<cryptonote::tx_destination_entry>
dests;
690 FIELD(multisig_tx_key_entropy)
698 std::vector<tx_construction_data>
txes;
699 std::tuple<uint64_t, uint64_t, wallet2::transfer_container>
transfers;
700 std::tuple<uint64_t, uint64_t, std::vector<wallet2::exported_transfer_details>>
new_transfers;
707 std::pair<size_t, wallet2::transfer_container> v0_transfers;
709 std::get<0>(
transfers) = std::get<0>(v0_transfers);
710 std::get<1>(
transfers) = std::get<0>(v0_transfers) + std::get<1>(v0_transfers).size();
711 std::get<2>(
transfers) = std::get<1>(v0_transfers);
716 std::pair<size_t, std::vector<wallet2::exported_transfer_details>> v1_transfers;
719 std::get<1>(
new_transfers) = std::get<0>(v1_transfers) + std::get<1>(v1_transfers).size();
730 std::vector<pending_tx>
ptx;
755 crypto::chacha_iv
iv;
766 crypto::chacha_iv
iv;
868 std::vector<cryptonote::transaction>
txes;
877 std::vector<boost::optional<cryptonote::subaddress_receive_info>>
received;
936 bool two_random =
false,
bool create_address_file =
false);
975 const std::vector<std::string> &kex_messages,
976 const std::uint32_t threshold);
983 const std::vector<std::string> &kex_messages,
984 const bool force_update_use_with_caution =
false);
1039 std::string
path()
const;
1055 void encrypt_keys(
const crypto::chacha_key &
key);
1057 void decrypt_keys(
const crypto::chacha_key &
key);
1071 boost::optional<epee::net_utils::http::login> daemon_login = boost::none,
1072 const std::string &proxy =
"",
1073 uint64_t upper_transaction_weight_limit = 0,
1074 bool trusted_daemon =
true,
1076 bool set_daemon(std::string
daemon_address =
"http://localhost:8080",
1077 boost::optional<epee::net_utils::http::login> daemon_login = boost::none,
bool trusted_daemon =
true,
1079 const std::string &proxy =
"");
1080 bool set_proxy(
const std::string &
address);
1093 bool is_deterministic()
const;
1107 const std::string &get_seed_language()
const;
1111 void set_seed_language(
const std::string &language);
1121 std::string get_integrated_address_as_str(
const crypto::hash8& payment_id)
const;
1122 void add_subaddress_account(
const std::string& label);
1125 void add_subaddress(
uint32_t index_major,
const std::string& label);
1142 bool is_deprecated()
const;
1143 void refresh(
bool trusted_daemon);
1144 void refresh(
bool trusted_daemon,
uint64_t start_height,
uint64_t & blocks_fetched);
1145 void refresh(
bool trusted_daemon,
uint64_t start_height,
uint64_t & blocks_fetched,
bool& received_money,
bool check_pool =
true,
bool try_incremental =
true,
uint64_t max_blocks = std::numeric_limits<uint64_t>::max());
1146 bool refresh(
bool trusted_daemon,
uint64_t & blocks_fetched,
bool& received_money,
bool& ok);
1155 bool has_multisig_partial_key_images()
const;
1156 bool has_unknown_key_images()
const;
1160 bool reconnect_device();
1166 std::map<uint32_t, uint64_t> balance_per_subaddress(
uint32_t subaddr_index_major,
bool strict)
const;
1167 std::map<uint32_t, std::pair<uint64_t, std::pair<uint64_t, uint64_t>>> unlocked_balance_per_subaddress(
uint32_t subaddr_index_major,
bool strict);
1169 uint64_t balance_all(
bool strict)
const;
1171 template<
typename T>
1172 void transfer_selected(
const std::vector<cryptonote::tx_destination_entry>& dsts,
const std::vector<size_t>& selected_transfers,
size_t fake_outputs_count,
1173 std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs, std::unordered_set<crypto::public_key> &valid_public_keys_cache,
1175 void transfer_selected_rct(std::vector<cryptonote::tx_destination_entry> dsts,
const std::vector<size_t>& selected_transfers,
size_t fake_outputs_count,
1176 std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs, std::unordered_set<crypto::public_key> &valid_public_keys_cache,
1180 void commit_tx(std::vector<pending_tx>& ptx_vector);
1181 bool save_tx(
const std::vector<pending_tx>& ptx_vector,
const std::string &filename)
const;
1182 std::string
dump_tx_to_str(
const std::vector<pending_tx> &ptx_vector)
const;
1186 bool save_multisig_tx(
const std::vector<pending_tx>& ptx_vector,
const std::string &filename);
1189 bool sign_tx(
const std::string &unsigned_filename,
const std::string &signed_filename, std::vector<wallet2::pending_tx> &
ptx, std::function<
bool(
const unsigned_tx_set&)> accept_func = NULL,
bool export_raw =
false);
1197 bool load_tx(
const std::string &signed_filename, std::vector<tools::wallet2::pending_tx> &
ptx, std::function<
bool(
const signed_tx_set&)> accept_func = NULL);
1199 std::vector<wallet2::pending_tx>
create_transactions_2(std::vector<cryptonote::tx_destination_entry> dsts,
const size_t fake_outs_count,
uint32_t priority,
const std::vector<uint8_t>& extra,
uint32_t subaddr_account, std::set<uint32_t> subaddr_indices,
const unique_index_container& subtract_fee_from_outputs = {});
1202 std::vector<wallet2::pending_tx> create_transactions_from(
const cryptonote::account_public_address &
address,
bool is_subaddress,
const size_t outputs, std::vector<size_t> unused_transfers_indices, std::vector<size_t> unused_dust_indices,
const size_t fake_outs_count,
uint32_t priority,
const std::vector<uint8_t>& extra);
1203 bool sanity_check(
const std::vector<wallet2::pending_tx> &ptx_vector,
const std::vector<cryptonote::tx_destination_entry>& dsts,
const unique_index_container& subtract_fee_from_outputs = {})
const;
1204 void cold_tx_aux_import(
const std::vector<pending_tx>&
ptx,
const std::vector<std::string>& tx_device_aux);
1205 void cold_sign_tx(
const std::vector<pending_tx>& ptx_vector, signed_tx_set &
exported_txs, std::vector<cryptonote::address_parse_info> &dsts_info, std::vector<std::string> & tx_device_aux);
1207 void device_show_address(
uint32_t account_index,
uint32_t address_index,
const boost::optional<crypto::hash8> &payment_id);
1208 bool parse_multisig_tx_from_str(std::string multisig_tx_st, multisig_tx_set &
exported_txs)
const;
1210 bool load_multisig_tx_from_file(
const std::string &filename, multisig_tx_set &
exported_txs, std::function<
bool(
const multisig_tx_set&)> accept_func = NULL);
1211 bool sign_multisig_tx_from_file(
const std::string &filename, std::vector<crypto::hash> &txids, std::function<
bool(
const multisig_tx_set&)> accept_func);
1212 bool sign_multisig_tx(multisig_tx_set &
exported_txs, std::vector<crypto::hash> &txids);
1213 bool sign_multisig_tx_to_file(multisig_tx_set &
exported_txs,
const std::string &filename, std::vector<crypto::hash> &txids);
1214 std::vector<pending_tx> create_unmixable_sweep_transactions();
1215 void discard_unmixable_outputs();
1216 bool check_connection(
uint32_t *
version = NULL,
bool *ssl = NULL,
uint32_t timeout = 200000,
bool *wallet_is_outdated = NULL,
bool *daemon_is_outdated = NULL);
1217 bool check_version(
uint32_t *
version,
bool *wallet_is_outdated,
bool *daemon_is_outdated);
1218 bool check_hard_fork_version(
cryptonote::network_type nettype,
const std::vector<std::pair<uint8_t, uint64_t>> &daemon_hard_forks,
const uint64_t height,
const uint64_t target_height,
bool *wallet_is_outdated,
bool *daemon_is_outdated);
1219 void get_transfers(wallet2::transfer_container& incoming_transfers)
const;
1220 void get_payments(
const crypto::hash& payment_id, std::list<wallet2::payment_details>& payments,
uint64_t min_height = 0,
const boost::optional<uint32_t>& subaddr_account = boost::none,
const std::set<uint32_t>& subaddr_indices = {})
const;
1221 void get_payments(std::list<std::pair<crypto::hash,wallet2::payment_details>>& payments,
uint64_t min_height,
uint64_t max_height = (
uint64_t)-1,
const boost::optional<uint32_t>& subaddr_account = boost::none,
const std::set<uint32_t>& subaddr_indices = {})
const;
1222 void get_payments_out(std::list<std::pair<crypto::hash,wallet2::confirmed_transfer_details>>& confirmed_payments,
1223 uint64_t min_height,
uint64_t max_height = (
uint64_t)-1,
const boost::optional<uint32_t>& subaddr_account = boost::none,
const std::set<uint32_t>& subaddr_indices = {})
const;
1224 void get_unconfirmed_payments_out(std::list<std::pair<crypto::hash,wallet2::unconfirmed_transfer_details>>& unconfirmed_payments,
const boost::optional<uint32_t>& subaddr_account = boost::none,
const std::set<uint32_t>& subaddr_indices = {})
const;
1225 void get_unconfirmed_payments(std::list<std::pair<crypto::hash,wallet2::pool_payment_details>>& unconfirmed_payments,
const boost::optional<uint32_t>& subaddr_account = boost::none,
const std::set<uint32_t>& subaddr_indices = {})
const;
1228 void rescan_spent();
1229 void rescan_blockchain(
bool hard,
bool refresh =
true,
bool keep_key_images =
false);
1230 bool is_transfer_unlocked(
const transfer_details& td);
1236 std::vector<cryptonote::public_node> get_public_nodes(
bool white_only =
true);
1238 template <
class t_archive>
1275 a & dummy_refresh_height;
1284 std::unordered_map<crypto::hash, payment_details> m;
1287 for (std::unordered_map<crypto::hash, payment_details>::const_iterator i = m.begin(); i != m.end(); ++i)
1312 std::unordered_multimap<crypto::hash, payment_details> m;
1315 for (
const auto &i: m)
1325 std::unordered_map<cryptonote::subaddress_index, crypto::public_key> dummy_subaddresses_inv;
1326 a & dummy_subaddresses_inv;
1337 a & (std::pair<std::map<std::string, std::string>, std::vector<std::string>>&)
m_account_tags;
1375 FIELD(m_account_public_address)
1377 FIELD(m_unconfirmed_txs)
1380 FIELD(m_confirmed_txs)
1382 FIELD(m_unconfirmed_payments)
1384 FIELD(m_address_book)
1385 FIELD(m_scanned_pool_txs[0])
1386 FIELD(m_scanned_pool_txs[1])
1387 FIELD(m_subaddresses)
1388 FIELD(m_subaddress_labels)
1389 FIELD(m_additional_tx_keys)
1391 FIELD(m_account_tags)
1392 FIELD(m_ring_history_saved)
1393 FIELD(m_last_block_reward)
1395 FIELD(m_device_last_key_image_sync)
1396 FIELD(m_cold_key_images)
1397 FIELD(m_rpc_client_secret_key)
1403 FIELD(m_has_ever_refreshed_from_node)
1409 FIELD(m_background_sync_data)
1418 static
void wallet_exists(
const std::
string& file_path,
bool& keys_file_exists,
bool& wallet_file_exists);
1424 static
bool wallet_valid_path_format(
const std::
string& file_path);
1425 static
std::
string make_background_wallet_file_name(
const std::
string &wallet_file);
1426 static
std::
string make_background_keys_file_name(
const std::
string &wallet_file);
1427 static
bool parse_long_payment_id(
const std::
string& payment_id_str,
crypto::hash& payment_id);
1428 static
bool parse_short_payment_id(
const std::
string& payment_id_str,
crypto::hash8& payment_id);
1429 static
bool parse_payment_id(
const std::
string& payment_id_str,
crypto::hash& payment_id);
1476 void setup_background_sync(BackgroundSyncType background_sync_type,
const epee::wipeable_string &wallet_password,
const boost::optional<epee::wipeable_string> &background_cache_password);
1506 void set_tx_key(
const crypto::hash &txid,
const crypto::secret_key &tx_key,
const std::vector<crypto::secret_key> &additional_tx_keys,
const boost::optional<cryptonote::account_public_address> &single_destination_subaddress = boost::none);
1517 std::string get_spend_proof(
const crypto::hash &txid,
const std::string &message);
1518 bool check_spend_proof(
const crypto::hash &txid,
const std::string &message,
const std::string &sig_str);
1520 void scan_tx(
const std::unordered_set<crypto::hash> &txids);
1529 std::string get_reserve_proof(
const boost::optional<std::pair<uint32_t, uint64_t>> &account_minreserve,
const std::string &message);
1547 bool delete_address_book_row(std::size_t row_id);
1551 const transfer_details &get_transfer_details(
size_t idx)
const;
1553 uint8_t get_current_hard_fork();
1556 int get_fee_algorithm();
1558 std::string get_wallet_file()
const;
1559 std::string get_keys_file()
const;
1560 std::string get_daemon_address()
const;
1563 uint64_t get_daemon_blockchain_height(std::string& err);
1564 uint64_t get_daemon_blockchain_target_height(std::string& err);
1565 uint64_t get_daemon_adjusted_time();
1570 uint64_t get_approximate_blockchain_height()
const;
1571 uint64_t estimate_blockchain_height();
1572 std::vector<size_t> select_available_outputs_from_histogram(
uint64_t count,
bool atleast,
bool unlocked,
bool allow_rct);
1573 std::vector<size_t> select_available_outputs(
const std::function<
bool(
const transfer_details &td)> &f);
1574 std::vector<size_t> select_available_unmixable_outputs();
1575 std::vector<size_t> select_available_mixable_outputs();
1577 size_t pop_best_value_from(
const transfer_container &transfers, std::vector<size_t> &unused_dust_indices,
const std::vector<size_t>& selected_transfers,
bool smallest =
false)
const;
1578 size_t pop_best_value(std::vector<size_t> &unused_dust_indices,
const std::vector<size_t>& selected_transfers,
bool smallest =
false)
const;
1580 void set_tx_note(
const crypto::hash &txid,
const std::string ¬e);
1581 std::string get_tx_note(
const crypto::hash &txid)
const;
1583 void set_tx_device_aux(
const crypto::hash &txid,
const std::string &aux);
1584 std::string get_tx_device_aux(
const crypto::hash &txid)
const;
1586 void set_description(
const std::string &description);
1587 std::string get_description()
const;
1593 const std::pair<serializable_map<std::string, std::string>, std::vector<std::string>>& get_account_tags();
1599 void set_account_tag(
const std::set<uint32_t> &account_indices,
const std::string&
tag);
1605 void set_account_tag_description(
const std::string&
tag,
const std::string& description);
1629 std::tuple<uint64_t, uint64_t, std::vector<tools::wallet2::exported_transfer_details>>
export_outputs(
bool all =
false,
uint32_t start = 0,
uint32_t count = 0xffffffff)
const;
1636 void import_payments_out(
const std::list<std::pair<crypto::hash,wallet2::confirmed_transfer_details>> &confirmed_payments);
1637 std::tuple<size_t, crypto::hash, std::vector<crypto::hash>>
export_blockchain()
const;
1640 std::pair<uint64_t, std::vector<std::pair<crypto::key_image, crypto::signature>>>
export_key_images(
bool all =
false)
const;
1643 bool import_key_images(std::vector<crypto::key_image> key_images,
size_t offset=0, boost::optional<std::unordered_set<size_t>> selected_transfers=boost::none);
1647 void update_pool_state(std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> &process_txs,
bool refreshed =
false,
bool try_incremental =
false);
1648 void process_pool_state(
const std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> &txs);
1651 std::string
encrypt(
const char *plaintext,
size_t len,
const crypto::secret_key &skey,
bool authenticated =
true)
const;
1659 std::string
make_uri(
const std::string &
address,
const std::string &payment_id,
uint64_t amount,
const std::string &tx_description,
const std::string &recipient_name, std::string &
error)
const;
1660 bool parse_uri(
const std::string &
uri, std::string &
address, std::string &payment_id,
uint64_t &amount, std::string &tx_description, std::string &recipient_name, std::vector<std::string> &unknown_parameters, std::string &
error);
1666 std::vector<std::pair<uint64_t, uint64_t>>
estimate_backlog(
const std::vector<std::pair<double, double>> &fee_levels);
1669 static uint64_t estimate_fee(
bool use_per_byte_fee,
bool use_rct,
int n_inputs,
int mixin,
int n_outputs,
size_t extra_size,
bool bulletproof,
bool clsag,
bool bulletproof_plus,
bool use_view_tags,
uint64_t base_fee,
uint64_t fee_quantization_mask);
1682 std::pair<size_t, uint64_t> estimate_tx_size_and_weight(
bool use_rct,
int n_inputs,
int ring_size,
int n_outputs,
size_t extra_size);
1684 bool get_rpc_payment_info(
bool mining,
bool &payment_required,
uint64_t &credits,
uint64_t &diff,
uint64_t &credits_per_hash_found,
cryptonote::blobdata &hashing_blob,
uint64_t &height,
uint64_t &seed_height,
crypto::hash &seed_hash,
crypto::hash &next_seed_hash,
uint32_t &cookie);
1685 bool daemon_requires_payment();
1687 bool search_for_rpc_payment(
uint64_t credits_target,
uint32_t n_threads,
const std::function<
bool(
uint64_t,
uint64_t)> &startfunc,
const std::function<
bool(
unsigned)> &contfunc,
const std::function<
bool(
uint64_t)> &foundfunc = NULL,
const std::function<
void(
const std::string&)> &errorfunc = NULL);
1701 void light_wallet_get_unspent_outs();
1703 void light_wallet_get_address_txs();
1707 bool light_wallet_login(
bool &new_address);
1711 void light_wallet_get_outs(std::vector<std::vector<get_outs_entry>> &outs,
const std::vector<size_t> &selected_transfers,
size_t fake_outputs_count);
1740 template<
class t_request,
class t_response>
1741 inline bool invoke_http_json(
const boost::string_ref
uri,
const t_request& req, t_response&
res, std::chrono::milliseconds timeout = std::chrono::seconds(15),
const boost::string_ref http_method =
"POST")
1747 template<
class t_request,
class t_response>
1748 inline bool invoke_http_bin(
const boost::string_ref
uri,
const t_request& req, t_response&
res, std::chrono::milliseconds timeout = std::chrono::seconds(15),
const boost::string_ref http_method =
"POST")
1754 template<
class t_request,
class t_response>
1755 inline bool invoke_http_json_rpc(
const boost::string_ref
uri,
const std::string& method_name,
const t_request& req, t_response&
res, std::chrono::milliseconds timeout = std::chrono::seconds(15),
const boost::string_ref http_method =
"POST",
const std::string& req_id =
"0")
1762 bool set_ring_database(
const std::string &filename);
1766 bool get_rings(
const crypto::chacha_key &
key,
const std::vector<crypto::key_image> &key_images, std::vector<std::vector<uint64_t>> &outs);
1767 bool set_ring(
const crypto::key_image &key_image,
const std::vector<uint64_t> &outs,
bool relative);
1768 bool set_rings(
const std::vector<std::pair<
crypto::key_image, std::vector<uint64_t>>> &rings,
bool relative);
1769 bool unset_ring(
const std::vector<crypto::key_image> &key_images);
1771 [[deprecated]]
bool find_and_save_rings(
bool force =
true);
1773 bool blackball_output(
const std::pair<uint64_t, uint64_t> &output);
1774 bool set_blackballed_outputs(
const std::vector<std::pair<uint64_t, uint64_t>> &
outputs,
bool add =
false);
1775 bool unblackball_output(
const std::pair<uint64_t, uint64_t> &output);
1776 bool is_output_blackballed(
const std::pair<uint64_t, uint64_t> &output)
const;
1778 void freeze(
size_t idx);
1779 void thaw(
size_t idx);
1780 bool frozen(
size_t idx)
const;
1784 bool frozen(
const transfer_details &td)
const;
1785 bool frozen(
const multisig_tx_set& txs)
const;
1787 bool save_to_file(
const std::string& path_to_file,
const std::string& binary,
bool is_printable =
false)
const;
1788 static bool load_from_file(
const std::string& path_to_file, std::string& target_str,
size_t max_size = 1000000000);
1791 uint64_t get_bytes_received()
const;
1793 void start_background_sync();
1801 bool lock_keys_file();
1802 bool unlock_keys_file();
1803 bool is_keys_file_locked()
const;
1809 bool is_tx_spendtime_unlocked(
uint64_t unlock_time,
uint64_t block_height);
1811 uint64_t hash_m_transfers(boost::optional<uint64_t> transfer_height,
crypto::hash &hash)
const;
1814 void set_offline(
bool offline =
true);
1830 bool store_keys(
const std::string& keys_file_name,
const epee::wipeable_string& password,
bool watch_only =
false);
1831 bool store_keys(
const std::string& keys_file_name,
const crypto::chacha_key&
key,
bool watch_only =
false,
bool background_keys_file =
false);
1832 boost::optional<wallet2::keys_file_data> get_keys_file_data(
const crypto::chacha_key&
key,
bool watch_only =
false,
bool background_keys_file =
false);
1833 bool store_keys_file_data(
const std::string& keys_file_name,
wallet2::keys_file_data &keys_file_data,
bool background_keys_file =
false);
1846 bool load_keys_buf(
const std::string& keys_buf,
const epee::wipeable_string& password, boost::optional<crypto::chacha_key>& keys_to_encrypt);
1847 void load_wallet_cache(
const bool use_fs,
const std::string& cache_buf =
"");
1848 void process_new_transaction(
const crypto::hash &txid,
const cryptonote::transaction&
tx,
const std::vector<uint64_t> &o_indices,
uint64_t height,
uint8_t block_version,
uint64_t ts,
bool miner_tx,
bool pool,
bool double_spend_seen,
const tx_cache_data &tx_cache_data, std::map<std::pair<uint64_t, uint64_t>,
size_t> *output_tracker_cache = NULL,
bool ignore_callbacks =
false);
1851 detached_blockchain_data detach_blockchain(
uint64_t height, std::map<std::pair<uint64_t, uint64_t>,
size_t> *output_tracker_cache = NULL);
1852 void handle_reorg(
uint64_t height, std::map<std::pair<uint64_t, uint64_t>,
size_t> *output_tracker_cache = NULL);
1853 void get_short_chain_history(std::list<crypto::hash>& ids,
uint64_t granularity = 1)
const;
1855 void clear_soft(
bool keep_key_images=
false);
1864 void clear_user_data();
1865 void pull_blocks(
bool first,
bool try_incremental,
uint64_t start_height,
uint64_t& blocks_start_height,
const std::list<crypto::hash> &short_chain_history, std::vector<cryptonote::block_complete_entry> &
blocks, std::vector<cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices> &o_indices,
uint64_t ¤t_height);
1866 void pull_hashes(
uint64_t start_height,
uint64_t& blocks_start_height,
const std::list<crypto::hash> &short_chain_history, std::vector<crypto::hash> &
hashes);
1867 void fast_refresh(
uint64_t stop_height,
uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history,
bool force =
false);
1868 void pull_and_parse_next_blocks(
bool first,
bool try_incremental,
uint64_t start_height,
uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history,
const std::vector<cryptonote::block_complete_entry> &prev_blocks,
const std::vector<parsed_block> &prev_parsed_blocks, std::vector<cryptonote::block_complete_entry> &
blocks, std::vector<parsed_block> &parsed_blocks,
bool &last,
bool &
error, std::exception_ptr &exception);
1869 void process_parsed_blocks(
uint64_t start_height,
const std::vector<cryptonote::block_complete_entry> &
blocks,
const std::vector<parsed_block> &parsed_blocks,
uint64_t& blocks_added, std::map<std::pair<uint64_t, uint64_t>,
size_t> *output_tracker_cache = NULL);
1870 bool accept_pool_tx_for_processing(
const crypto::hash &txid);
1873 void update_pool_state_by_pool_query(std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> &process_txs,
bool refreshed =
false);
1874 void update_pool_state_from_pool_data(
bool incremental,
const std::vector<crypto::hash> &removed_pool_txids,
const std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> &added_pool_txs, std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> &process_txs,
bool refreshed);
1875 uint64_t select_transfers(
uint64_t needed_money, std::vector<size_t> unused_transfers_indices, std::vector<size_t>& selected_transfers)
const;
1876 bool prepare_file_names(
const std::string& file_path);
1881 void check_genesis(
const crypto::hash& genesis_hash)
const;
1882 bool generate_chacha_key_from_secret_keys(crypto::chacha_key &
key)
const;
1885 void check_acc_out_precomp(
const cryptonote::tx_out &o,
const crypto::key_derivation &derivation,
const std::vector<crypto::key_derivation> &additional_derivations,
size_t i, tx_scan_info_t &tx_scan_info)
const;
1886 void check_acc_out_precomp(
const cryptonote::tx_out &o,
const crypto::key_derivation &derivation,
const std::vector<crypto::key_derivation> &additional_derivations,
size_t i,
const is_out_data *is_out_data, tx_scan_info_t &tx_scan_info)
const;
1887 void check_acc_out_precomp_once(
const cryptonote::tx_out &o,
const crypto::key_derivation &derivation,
const std::vector<crypto::key_derivation> &additional_derivations,
size_t i,
const is_out_data *is_out_data, tx_scan_info_t &tx_scan_info,
bool &already_seen)
const;
1889 uint64_t get_upper_transaction_weight_limit();
1890 std::vector<uint64_t> get_unspent_amounts_vector(
bool strict);
1891 uint64_t get_dynamic_base_fee_estimate();
1892 float get_output_relatedness(
const transfer_details &td0,
const transfer_details &td1)
const;
1893 std::vector<size_t> pick_preferred_rct_inputs(
uint64_t needed_money,
uint32_t subaddr_account,
const std::set<uint32_t> &subaddr_indices);
1894 void set_spent(
size_t idx,
uint64_t height);
1895 void set_unspent(
size_t idx);
1896 bool is_spent(
const transfer_details &td,
bool strict =
true)
const;
1897 bool is_spent(
size_t idx,
bool strict =
true)
const;
1898 void get_outs(std::vector<std::vector<get_outs_entry>> &outs,
const std::vector<size_t> &selected_transfers,
size_t fake_outputs_count,
bool rct, std::unordered_set<crypto::public_key> &valid_public_keys_cache);
1899 void get_outs(std::vector<std::vector<get_outs_entry>> &outs,
const std::vector<size_t> &selected_transfers,
size_t fake_outputs_count, std::vector<uint64_t> &rct_offsets, std::unordered_set<crypto::public_key> &valid_public_keys_cache);
1901 bool should_pick_a_second_output(
bool use_rct,
size_t n_transfers,
const std::vector<size_t> &unused_transfers_indices,
const std::vector<size_t> &unused_dust_indices)
const;
1902 std::vector<size_t>
get_only_rct(
const std::vector<size_t> &unused_dust_indices,
const std::vector<size_t> &unused_transfers_indices)
const;
1909 void update_multisig_rescan_info(
const std::vector<std::vector<rct::key>> &multisig_k,
const std::vector<std::vector<tools::wallet2::multisig_info>> &
info,
size_t n);
1927 void store_background_cache(
const crypto::chacha_key &custom_background_key,
const bool do_reset_background_sync_data =
true);
1971 const std::unique_ptr<epee::net_utils::http::abstract_http_client>
m_http_client;
1990 std::pair<serializable_map<std::string, std::string>, std::vector<std::string>>
m_account_tags;
2148 template<
class Archive,
class F,
class S,
class T>
2151 std::tuple<F, S, T> & t,
2154 ar & boost::serialization::make_nvp(
"f", std::get<0>(t));
2155 ar & boost::serialization::make_nvp(
"s", std::get<1>(t));
2156 ar & boost::serialization::make_nvp(
"t", std::get<2>(t));
2159 template <
class Archive>
2163 template <
class Archive>
2207 template <
class Archive>
2306 template <
class Archive>
2313 template <
class Archive>
2321 template <
class Archive>
2328 template <
class Archive>
2377 template <
class Archive>
2407 if (!
typename Archive::is_saving())
2424 template <
class Archive>
2459 template <
class Archive>
2466 template <
class Archive>
2477 bool is_long =
false;
2478 for (
int i = 8; i < 32; ++i)
2479 is_long |= payment_id.data[i];
2482 MWARNING(
"Long payment ID ignored on address book load");
2504 template <
class Archive>
2515 template <
class Archive>
2522 std::pair<size_t, tools::wallet2::transfer_container> old_transfers;
2524 std::get<0>(x.
transfers) = std::get<0>(old_transfers);
2525 std::get<1>(x.
transfers) = std::get<0>(old_transfers) + std::get<1>(old_transfers).size();
2526 std::get<2>(x.
transfers) = std::get<1>(old_transfers);
2529 throw std::runtime_error(
"Boost serialization not supported for newest unsigned_tx_set");
2532 template <
class Archive>
2542 template <
class Archive>
2551 std::list<size_t> selected_transfers;
2552 a & selected_transfers;
2555 for (
size_t t: selected_transfers)
2571 if (!
typename Archive::is_saving())
2578 if (!
typename Archive::is_saving())
2585 a & use_bulletproofs;
2586 if (!
typename Archive::is_saving())
2593 template <
class Archive>
2609 template <
class Archive>
2620 std::list<size_t> selected_transfers;
2621 a & selected_transfers;
2624 for (
size_t t: selected_transfers)
2642 template <
class Archive>
2653 template <
class Archive>
2675 std::vector<cryptonote::tx_destination_entry>& splitted_dsts, std::vector<cryptonote::tx_destination_entry> &dust_dsts)
2677 splitted_dsts.clear();
2683 [&](
uint64_t chunk) { splitted_dsts.push_back(cryptonote::tx_destination_entry(chunk, de.addr, de.is_subaddress)); },
2684 [&](
uint64_t a_dust) { splitted_dsts.push_back(cryptonote::tx_destination_entry(a_dust, de.addr, de.is_subaddress)); } );
2689 if (chunk <= dust_threshold)
2690 dust_dsts.push_back(cryptonote::tx_destination_entry(chunk, change_dst.addr, false));
2692 splitted_dsts.push_back(cryptonote::tx_destination_entry(chunk, change_dst.addr, false));
2694 [&](
uint64_t a_dust) { dust_dsts.push_back(cryptonote::tx_destination_entry(a_dust, change_dst.addr, false)); } );
2699 std::vector<cryptonote::tx_destination_entry>& splitted_dsts, std::vector<cryptonote::tx_destination_entry> &dust_dsts)
2701 splitted_dsts = dsts;
2714 std::string indexes;
#define s(x, c)
Definition aesb.c:47
cryptonote::block b
Definition block.cpp:40
static boost::multiprecision::uint128_t fees
Definition blockchain_stats.cpp:58
A container for blockchain checkpoints.
Definition checkpoints.h:53
Definition cryptonote_basic.h:171
std::vector< tx_out > vout
Definition cryptonote_basic.h:179
Definition cryptonote_basic.h:205
Non-owning sequence of data. Does not deep copy.
Definition span.h:55
Definition wipeable_string.h:41
device_type
Definition device.hpp:104
@ SOFTWARE
Definition device.hpp:105
Definition message_store.h:268
Definition containers.h:49
std::unordered_map< K, V > & parent()
Definition containers.h:52
Definition containers.h:71
Definition wallet_tools.h:52
const uint8_t seed[32]
Definition code-generator.cpp:37
binary_archive< false > ar
Definition cold-outputs.cpp:54
crypto::secret_key spendkey
Definition cold-outputs.cpp:44
size_t n_outputs
Definition cold-outputs.cpp:56
std::tuple< uint64_t, uint64_t, std::vector< tools::wallet2::transfer_details > > outputs
Definition cold-outputs.cpp:53
wallet set_subaddress_lookahead(1, 1)
std::vector< tools::wallet2::pending_tx > ptx
Definition cold-transaction.cpp:56
tools::wallet2::unsigned_tx_set exported_txs
Definition cold-transaction.cpp:53
#define tr(x)
Definition common_defines.h:4
#define CORE_RPC_STATUS_PAYMENT_REQUIRED
Definition core_rpc_server_commands_defs.h:81
#define CORE_RPC_STATUS_OK
Definition core_rpc_server_commands_defs.h:78
#define FEE_PER_KB
Definition cryptonote_config.h:70
void * memcpy(void *a, const void *b, size_t c)
Definition glibc_compat.cpp:16
#define BEGIN_SERIALIZE_OBJECT()
const char * res
Definition hmac_keccak.cpp:42
const char * key
Definition hmac_keccak.cpp:40
#define const
Definition ipfrdr.c:80
static void init()
Definition logging.cpp:42
static MDB_envinfo info
Definition mdb_load.c:37
static int version
Definition mdb_load.c:29
uint32_t address
Definition getifaddr.c:269
Definition blockchain.py:1
std::enable_if<!Archive::is_loading::value, void >::type initialize_transfer_details(Archive &a, tools::wallet2::transfer_details &x, const boost::serialization::version_type ver)
Definition wallet2.h:2160
Definition portable_binary_archive.hpp:29
crypto namespace.
Definition crypto.cpp:60
static constexpr crypto::hash8 null_hash8
Definition hash.h:103
T rand()
Definition crypto.h:174
POD_CLASS signature
Definition crypto.h:98
const crypto::secret_key null_skey
Definition crypto.cpp:75
epee::mlocked< tools::scrubbed< ec_scalar > > secret_key
Definition crypto.h:72
POD_CLASS hash8
Definition hash.h:52
POD_CLASS key_derivation
Definition crypto.h:91
POD_CLASS public_key
Definition crypto.h:64
static constexpr crypto::hash null_hash
Definition hash.h:102
POD_CLASS key_image
Definition crypto.h:95
POD_CLASS hash
Definition hash.h:49
network_type
Definition cryptonote_config.h:302
@ MAINNET
Definition cryptonote_config.h:303
void decompose_amount_into_digits(uint64_t amount, uint64_t dust_threshold, const chunk_handler_t &chunk_handler, const dust_handler_t &dust_handler)
Definition cryptonote_format_utils.h:217
std::string print_money(uint64_t amount, unsigned int decimal_point)
Definition cryptonote_format_utils.cpp:1180
crypto::hash get_transaction_hash(const transaction &t)
Definition cryptonote_format_utils.cpp:1273
std::string blobdata
Definition blobdatatype.h:39
declaration and default definition for the functions used the API
Definition expect.cpp:34
bool invoke_http_bin(const boost::string_ref uri, const t_request &out_struct, t_response &result_struct, t_transport &transport, std::chrono::milliseconds timeout=std::chrono::seconds(15), const boost::string_ref method="POST")
Definition http_abstract_invoke.h:76
bool invoke_http_json_rpc(const boost::string_ref uri, std::string method_name, const t_request &out_struct, t_response &result_struct, epee::json_rpc::error &error_struct, t_transport &transport, std::chrono::milliseconds timeout=std::chrono::seconds(15), const boost::string_ref http_method="POST", const std::string &req_id="0")
Definition http_abstract_invoke.h:110
bool invoke_http_json(const boost::string_ref uri, const t_request &out_struct, t_response &result_struct, t_transport &transport, std::chrono::milliseconds timeout=std::chrono::seconds(15), const boost::string_ref method="POST")
Definition http_abstract_invoke.h:42
@ e_ssl_support_autodetect
Definition net_ssl.h:52
Definition multisig.cpp:46
Definition bulletproofs.cc:64
std::vector< key > keyV
Definition rctTypes.h:89
std::vector< keyV > keyM
Definition rctTypes.h:90
@ RangeProofBorromean
Definition rctTypes.h:307
@ RangeProofPaddedBulletproof
Definition rctTypes.h:307
key identity()
Definition rctOps.h:73
Definition binary_utils.h:36
BOOST_CLASS_VERSION(nodetool::peerlist_types, nodetool::CURRENT_PEERLIST_STORAGE_ARCHIVE_VER)
void generate(randomx::Program &p, uint32_t nonce)
Definition perf-simulation.cpp:62
const GenericPointer< typename T::ValueType > T2 value
Definition pointer.h:1225
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1124
const char *const str
Definition portlistingparse.c:23
const portMappingElt code
Definition portlistingparse.c:22
void serialize(Archive &a, unsigned_tx_set &x, const boost::serialization::version_type ver)
Definition serialization.cpp:898
#define ts
Definition skein.c:522
static __thread int depth
Definition threadpool.cpp:34
static std::string decrypt(const std::string &ciphertext, const crypto::key_image &key_image, const crypto::chacha_key &key, uint8_t field)
Definition ringdb.cpp:136
static std::string encrypt(const std::string &plaintext, const crypto::key_image &key_image, const crypto::chacha_key &key, uint8_t field)
Definition ringdb.cpp:121
unsigned short uint16_t
Definition stdint.h:125
signed __int64 int64_t
Definition stdint.h:135
unsigned int uint32_t
Definition stdint.h:126
unsigned char uint8_t
Definition stdint.h:124
unsigned __int64 uint64_t
Definition stdint.h:136
Definition core_rpc_server_commands_defs.h:205
epee::misc_utils::struct_init< response_t > response
Definition core_rpc_server_commands_defs.h:264
Definition core_rpc_server_commands_defs.h:393
Definition cryptonote_basic.h:512
Definition cryptonote_protocol_defs.h:133
Definition cryptonote_basic.h:475
Definition cryptonote_basic.h:539
Definition subaddress_index.h:39
Definition cryptonote_tx_utils.h:75
uint64_t amount
Definition cryptonote_tx_utils.h:77
account_public_address addr
Definition cryptonote_tx_utils.h:78
Definition cryptonote_basic.h:158
Definition cryptonote_tx_utils.h:43
uint64_t amount
Definition cryptonote_tx_utils.h:51
uint64_t real_output
Definition cryptonote_tx_utils.h:47
uint64_t real_output_in_tx_index
Definition cryptonote_tx_utils.h:50
std::vector< output_entry > outputs
Definition cryptonote_tx_utils.h:46
std::pair< uint64_t, rct::ctkey > output_entry
Definition cryptonote_tx_utils.h:44
Definition jsonrpc_structs.h:32
Definition minixmlvalid.c:15
Definition message_store.h:242
Definition chaingen.h:294
Definition rctTypes.h:308
RangeProofType range_proof_type
Definition rctTypes.h:309
Definition rctTypes.h:113
Definition rctTypes.h:122
Definition rctTypes.h:613
cryptonote::transaction tx
Definition wallet2.h:900
cryptonote::COMMAND_RPC_GET_TRANSACTIONS::entry tx_entry
Definition wallet2.h:899
crypto::hash tx_hash
Definition wallet2.h:901
crypto::public_key shared_secret
Definition wallet2.h:798
crypto::signature key_image_sig
Definition wallet2.h:801
crypto::signature shared_secret_sig
Definition wallet2.h:800
uint64_t index_in_tx
Definition wallet2.h:797
crypto::key_image key_image
Definition wallet2.h:799
crypto::hash txid
Definition wallet2.h:796
uint64_t lowest_height
Definition wallet2.h:907
uint64_t highest_height
Definition wallet2.h:908
tx_entry_data()
Definition wallet2.h:910
std::vector< process_tx_entry_t > tx_entries
Definition wallet2.h:906
Definition serialization.cpp:893
#define CRITICAL_REGION_LOCAL(x)
Definition syncobj.h:153
const char * tag
Definition testobsdrdr.c:19
std::string data
Definition base58.cpp:37
struct hash_func hashes[]
randomx_vm * vm
Definition tests.cpp:20
cryptonote::transaction tx
Definition transaction.cpp:40
string daemon_address
Definition transfers.cpp:41
static crypto::public_key get_tx_pub_key_from_received_outs(const tools::wallet2::transfer_details &td)
Definition trezor_tests.cpp:413
static std::string get_payment_id(const std::vector< uint8_t > &tx_extra)
Definition trezor_tests.cpp:473
static void ready(int code, upnpc_t *p, upnpc_device_t *d, void *data)
Definition upnpc-libevent.c:40
#define THROW_WALLET_EXCEPTION_IF(cond, err_type,...)
Definition wallet_errors.h:1036