211 friend class ::Serialization_portability_wallet_Test;
212 friend class ::wallet_accessor_test;
216 static constexpr const std::chrono::seconds
rpc_timeout = std::chrono::minutes(3) + std::chrono::seconds(30);
237 static const char*
tr(
const char* str);
241 static std::string
device_name_option(
const boost::program_options::variables_map& vm);
243 static void init_options(boost::program_options::options_description& desc_params);
246 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);
250 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);
253 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);
256 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);
296 boost::optional<cryptonote::subaddress_receive_info>
received;
322 std::vector<std::pair<uint64_t, crypto::hash>>
m_uses;
330 FIELD(m_block_height)
333 FIELD(m_internal_output_index)
334 FIELD(m_global_output_index)
337 FIELD(m_spent_height)
342 FIELD(m_key_image_known)
343 FIELD(m_key_image_request)
345 FIELD(m_subaddr_index)
346 FIELD(m_key_image_partial)
348 FIELD(m_multisig_info)
385 std::vector<cryptonote::tx_destination_entry>
m_dests;
391 std::vector<std::pair<crypto::key_image, std::vector<uint64_t>>>
m_rings;
400 std::vector<cryptonote::tx_destination_entry>
m_dests;
406 std::vector<std::pair<crypto::key_image, std::vector<uint64_t>>>
m_rings;
412 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),
m_is_migration(utd.m_tx.
version == 2),
422 std::vector<cryptonote::tx_source_entry>
sources;
430 std::vector<cryptonote::tx_destination_entry>
dests;
455 std::unordered_set<crypto::public_key>
ignore;
474 std::vector<cryptonote::tx_destination_entry>
dests;
499 std::vector<tx_construction_data>
txes;
500 std::pair<size_t, wallet2::transfer_container>
transfers;
505 std::vector<pending_tx>
ptx;
523 crypto::chacha_iv
iv;
534 crypto::chacha_iv
iv;
568 std::vector<cryptonote::transaction>
txes;
577 std::vector<boost::optional<cryptonote::subaddress_receive_info>>
received;
624 bool two_random =
false,
bool create_address_file =
false);
663 const std::vector<std::string> &
info,
671 const std::vector<crypto::secret_key> &view_keys,
672 const std::vector<crypto::public_key> &spend_keys,
675 const std::vector<std::string> &
info);
680 std::unordered_set<crypto::public_key> pkeys,
681 std::vector<crypto::public_key> signers);
728 std::string
path()
const;
737 void encrypt_keys(
const crypto::chacha_key &
key);
739 void decrypt_keys(
const crypto::chacha_key &
key);
750 boost::optional<epee::net_utils::http::login> daemon_login = boost::none,
751 boost::asio::ip::tcp::endpoint proxy = {},
752 uint64_t upper_transaction_weight_limit = 0,
753 bool trusted_daemon =
true,
755 std::string blockchain_db_path =
"");
756 bool set_daemon(std::string
daemon_address =
"http://localhost:8080",
757 boost::optional<epee::net_utils::http::login> daemon_login = boost::none,
bool trusted_daemon =
true,
760 void stop() { m_run.store(
false, std::memory_order_relaxed); m_message_store.stop(); }
771 bool is_deterministic()
const;
785 const std::string &get_seed_language()
const;
789 void set_seed_language(
const std::string &language);
799 std::string get_integrated_address_as_str(
const crypto::hash8& payment_id)
const;
800 void add_subaddress_account(
const std::string& label,
const bool update_account_tags =
true);
802 size_t get_num_subaddresses(
uint32_t index_major)
const {
return index_major < m_subaddress_labels.size() ? m_subaddress_labels[index_major].size() : 0; }
803 void add_subaddress(
uint32_t index_major,
const std::string& label);
807 void set_subaddress_lookahead(
size_t major,
size_t minor);
808 std::pair<size_t, size_t>
get_subaddress_lookahead()
const {
return {m_subaddress_lookahead_major, m_subaddress_lookahead_minor}; }
815 bool is_deprecated()
const;
816 void refresh(
bool trusted_daemon);
817 void refresh(
bool trusted_daemon,
uint64_t start_height,
uint64_t & blocks_fetched);
818 void refresh(
bool trusted_daemon,
uint64_t start_height,
uint64_t & blocks_fetched,
bool& received_etn,
bool check_pool =
true);
819 bool refresh(
bool trusted_daemon,
uint64_t & blocks_fetched,
bool& received_etn,
bool& ok);
827 bool has_multisig_partial_key_images()
const;
828 bool has_unknown_key_images()
const;
832 bool reconnect_device();
835 uint64_t balance(
uint32_t subaddr_index_major,
bool public_blockchain)
const;
836 uint64_t unlocked_balance(
uint32_t subaddr_index_major,
bool public_blockchain,
uint64_t *blocks_to_unlock = NULL)
const;
839 std::map<uint32_t, uint64_t> balance_per_subaddress(
uint32_t subaddr_index_major,
bool public_blockchain =
false)
const;
842 std::map<uint32_t, std::pair<uint64_t, uint64_t>> unlocked_balance_per_subaddress(
uint32_t subaddr_index_major,
bool public_blockchain =
false)
const;
843 uint64_t balance_all(
bool public_blockchain)
const;
844 uint64_t unlocked_balance_all(
bool public_blockchain,
uint64_t *blocks_to_unlock = NULL)
const;
846 void transfer_selected(
const std::vector<cryptonote::tx_destination_entry>& dsts,
const std::vector<size_t>& selected_transfers,
size_t fake_outputs_count,
847 std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs,
849 void commit_tx(pending_tx& ptx_vector);
850 void commit_tx(std::vector<pending_tx>& ptx_vector);
851 bool save_tx(
const std::vector<pending_tx>& ptx_vector,
const std::string &filename)
const;
852 std::string dump_tx_to_str(
const std::vector<pending_tx> &ptx_vector)
const;
853 std::string save_multisig_tx(multisig_tx_set txs);
854 bool save_multisig_tx(
const multisig_tx_set &txs,
const std::string &filename);
855 std::string save_multisig_tx(
const std::vector<pending_tx>& ptx_vector);
856 bool save_multisig_tx(
const std::vector<pending_tx>& ptx_vector,
const std::string &filename);
857 multisig_tx_set make_multisig_tx_set(
const std::vector<pending_tx>& ptx_vector)
const;
859 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);
861 bool sign_tx(
unsigned_tx_set &exported_txs,
const std::string &signed_filename, std::vector<wallet2::pending_tx> &ptx,
bool export_raw =
false);
867 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);
868 bool parse_tx_from_str(
const std::string &signed_tx_st, std::vector<tools::wallet2::pending_tx> &ptx, std::function<
bool(
const signed_tx_set &)> accept_func);
869 std::vector<wallet2::pending_tx>
create_transactions_2(std::vector<cryptonote::tx_destination_entry> dsts,
const size_t fake_outs_count,
const uint64_t unlock_time,
uint32_t priority,
const std::vector<uint8_t>& extra,
uint32_t subaddr_account, std::set<uint32_t> subaddr_indices);
870 std::vector<wallet2::pending_tx>
create_transactions_all(
uint64_t below,
const cryptonote::account_public_address &
address,
bool is_subaddress,
const size_t outputs,
const size_t fake_outs_count,
const uint64_t unlock_time,
uint32_t priority,
const std::vector<uint8_t>& extra,
uint32_t subaddr_account, std::set<uint32_t> subaddr_indices,
const bool migrate =
false);
873 bool sanity_check(
const std::vector<wallet2::pending_tx> &ptx_vector, std::vector<cryptonote::tx_destination_entry> dsts)
const;
874 void cold_tx_aux_import(
const std::vector<pending_tx>& ptx,
const std::vector<std::string>& tx_device_aux);
875 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);
887 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;
888 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;
889 void get_payments_out(std::list<std::pair<crypto::hash,wallet2::confirmed_transfer_details>>& confirmed_payments,
890 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;
891 void get_payments_out_migration(std::list<std::pair<crypto::hash,wallet2::confirmed_transfer_details>>& confirmed_payments,
892 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;
893 void get_payments_out_sc_migration(std::list<std::pair<crypto::hash,wallet2::confirmed_transfer_details>>& confirmed_payments,
894 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;
895 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;
896 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;
902 void rescan_blockchain(
bool hard,
bool refresh =
true,
bool keep_key_images =
false);
903 bool is_transfer_unlocked(
const transfer_details& td)
const;
904 bool is_transfer_unlocked(
uint64_t unlock_time,
uint64_t block_height)
const;
909 template <
class t_archive>
917 std::vector<crypto::hash> blockchain;
919 for (
const auto &b: blockchain)
921 m_blockchain.push_back(b);
929 a & m_account_public_address;
933 a & m_unconfirmed_txs;
945 a & dummy_refresh_height;
954 std::unordered_map<crypto::hash, payment_details> m;
956 for (std::unordered_map<crypto::hash, payment_details>::const_iterator i = m.begin(); i != m.end(); ++i)
957 m_unconfirmed_payments.insert(std::make_pair(i->first,
pool_payment_details{i->second, false}));
964 for (
size_t i = 0; i < m_transfers.size(); ++i)
969 m_pub_keys.emplace(o.
key, i);
982 std::unordered_multimap<crypto::hash, payment_details> m;
984 for (
const auto &i: m)
989 a & m_scanned_pool_txs[0];
990 a & m_scanned_pool_txs[1];
994 std::unordered_map<cryptonote::subaddress_index, crypto::public_key> dummy_subaddresses_inv;
995 a & dummy_subaddresses_inv;
996 a & m_subaddress_labels;
997 a & m_additional_tx_keys;
1003 a & m_unconfirmed_payments;
1009 a & m_ring_history_saved;
1012 a & m_last_block_reward;
1018 a & m_device_last_key_image_sync;
1021 a & m_cold_key_images;
1024 a & m_chainstate_indexes;
1033 static void wallet_exists(
const std::string& file_path,
bool& keys_file_exists,
bool& wallet_file_exists);
1042 if (ts < 1234567890)
1052 uint64_t diff = ts > now ? ts - now : now - ts;
1054 strftime(buffer,
sizeof(buffer),
"%Y-%m-%d", &tm);
1056 strftime(buffer,
sizeof(buffer),
"%I:%M:%S %p", &tm);
1057 return std::string(buffer);
1060 static bool wallet_valid_path_format(
const std::string& file_path);
1061 static bool parse_long_payment_id(
const std::string& payment_id_str,
crypto::hash& payment_id);
1062 static bool parse_short_payment_id(
const std::string& payment_id_str,
crypto::hash8& payment_id);
1063 static bool parse_payment_id(
const std::string& payment_id_str,
crypto::hash& payment_id);
1126 bool check_spend_proof(
const crypto::hash &txid,
const std::string &
message,
const std::string &sig_str);
1135 std::string get_reserve_proof(
const boost::optional<std::pair<uint32_t, uint64_t>> &account_minreserve,
const std::string &
message);
1152 bool delete_address_book_row(std::size_t row_id);
1156 const transfer_details &get_transfer_details(
size_t idx)
const;
1160 int get_fee_algorithm()
const;
1162 std::string get_wallet_file()
const;
1163 std::string get_keys_file()
const;
1164 std::string get_daemon_address()
const;
1165 const boost::optional<epee::net_utils::http::login>&
get_daemon_login()
const {
return m_daemon_login; }
1166 uint64_t get_daemon_blockchain_height(std::string& err)
const;
1167 uint64_t get_daemon_blockchain_target_height(std::string& err);
1171 uint64_t get_approximate_blockchain_height()
const;
1172 uint64_t estimate_blockchain_height();
1173 std::vector<size_t> select_available_outputs_from_histogram(
uint64_t count,
bool atleast,
bool unlocked,
bool allow_rct);
1174 std::vector<size_t> select_available_outputs(
const std::function<
bool(
const transfer_details &td)> &f)
const;
1175 std::vector<size_t> select_available_unmixable_outputs();
1176 std::vector<size_t> select_available_mixable_outputs();
1178 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;
1179 size_t pop_best_value(std::vector<size_t> &unused_dust_indices,
const std::vector<size_t>& selected_transfers,
bool smallest =
false)
const;
1181 void set_tx_note(
const crypto::hash &txid,
const std::string ¬e);
1182 std::string get_tx_note(
const crypto::hash &txid)
const;
1184 void set_tx_device_aux(
const crypto::hash &txid,
const std::string &aux);
1185 std::string get_tx_device_aux(
const crypto::hash &txid)
const;
1187 void set_description(
const std::string &description);
1188 std::string get_description()
const;
1194 const std::pair<std::map<std::string, std::string>, std::vector<std::string>>& get_account_tags();
1200 void set_account_tag(
const std::set<uint32_t> &account_indices,
const std::string& tag);
1206 void set_account_tag_description(
const std::string& tag,
const std::string& description);
1208 std::string sign(
const std::string &data)
const;
1217 std::string sign_multisig_participant(
const std::string& data)
const;
1225 bool verify_with_public_key(
const std::string &data,
const crypto::public_key &public_key,
const std::string &signature)
const;
1228 std::pair<size_t, std::vector<tools::wallet2::transfer_details>> export_outputs(
bool all =
false)
const;
1229 std::string export_outputs_to_str(
bool all =
false)
const;
1230 size_t import_outputs(
const std::pair<
size_t, std::vector<tools::wallet2::transfer_details>> &outputs);
1231 size_t import_outputs_from_str(
const std::string &outputs_st);
1232 payment_container export_payments()
const;
1233 void import_payments(
const payment_container &payments);
1234 void import_payments_out(
const std::list<std::pair<crypto::hash,wallet2::confirmed_transfer_details>> &confirmed_payments);
1235 std::tuple<size_t, crypto::hash, std::vector<crypto::hash>> export_blockchain()
const;
1236 void import_blockchain(
const std::tuple<
size_t,
crypto::hash, std::vector<crypto::hash>> &bc);
1237 bool export_key_images(
const std::string &filename)
const;
1238 std::pair<size_t, std::vector<std::pair<crypto::key_image, crypto::signature>>> export_key_images(
bool all =
false)
const;
1239 uint64_t import_key_images(
const std::vector<std::pair<crypto::key_image, crypto::signature>> &signed_key_images,
size_t offset,
uint64_t &spent,
uint64_t &unspent,
bool check_spent =
true);
1241 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);
1242 bool import_key_images(signed_tx_set & signed_tx,
size_t offset=0,
bool only_selected_transfers=
false);
1245 void update_pool_state(
bool refreshed =
false);
1246 void remove_obsolete_pool_txs(
const std::vector<crypto::hash> &tx_hashes);
1248 std::string encrypt(
const char *plaintext,
size_t len,
const crypto::secret_key &skey,
bool authenticated =
true)
const;
1256 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;
1257 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);
1263 std::vector<std::pair<uint64_t, uint64_t>>
estimate_backlog(
const std::vector<std::pair<double, double>> &fee_levels);
1278 void light_wallet_get_unspent_outs();
1280 void light_wallet_get_address_txs();
1284 bool light_wallet_login(
bool &new_address);
1288 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);
1318 template<
class t_request,
class t_response>
1319 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 =
"GET")
1321 if (m_offline)
return false;
1322 boost::lock_guard<boost::recursive_mutex> lock(m_daemon_rpc_mutex);
1325 template<
class t_request,
class t_response>
1326 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 =
"GET")
1328 if (m_offline)
return false;
1329 boost::lock_guard<boost::recursive_mutex> lock(m_daemon_rpc_mutex);
1332 template<
class t_request,
class t_response>
1333 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 =
"GET",
const std::string& req_id =
"0")
1335 if (m_offline)
return false;
1336 boost::lock_guard<boost::recursive_mutex> lock(m_daemon_rpc_mutex);
1340 bool set_ring_database(
const std::string &filename);
1344 bool set_ring(
const crypto::key_image &key_image,
const std::vector<uint64_t> &outs,
bool relative);
1345 bool unset_ring(
const std::vector<crypto::key_image> &key_images);
1347 bool find_and_save_rings(
bool force =
true);
1349 bool blackball_output(
const std::pair<uint64_t, uint64_t> &output);
1350 bool set_blackballed_outputs(
const std::vector<std::pair<uint64_t, uint64_t>> &outputs,
bool add =
false);
1351 bool unblackball_output(
const std::pair<uint64_t, uint64_t> &output);
1352 bool is_output_blackballed(
const std::pair<uint64_t, uint64_t> &output)
const;
1354 void freeze(
size_t idx);
1355 void thaw(
size_t idx);
1356 bool frozen(
size_t idx)
const;
1360 bool frozen(
const transfer_details &td)
const;
1363 uint64_t get_bytes_received()
const;
1371 bool lock_keys_file();
1372 bool unlock_keys_file();
1373 bool is_keys_file_locked()
const;
1377 void set_tx_notify(
const std::shared_ptr<tools::Notify> ¬ify) { m_tx_notify = notify; }
1379 bool is_tx_spendtime_unlocked(
uint64_t unlock_time,
uint64_t block_height)
const;
1380 void hash_m_transfer(
const transfer_details & transfer,
crypto::hash &hash)
const;
1384 void set_offline(
bool offline =
true);
1394 bool store_keys(
const std::string& keys_file_name,
const epee::wipeable_string& password,
bool watch_only =
false);
1401 void process_new_transaction(
const crypto::hash &txid,
const cryptonote::transaction& tx,
const std::vector<uint64_t> &o_indices,
uint64_t height,
uint64_t ts,
bool miner_tx,
bool pool,
bool double_spend_seen,
bool nonexistent_utxo_seen,
const tx_cache_data &tx_cache_data, std::pair<std::map<std::pair<uint64_t, uint64_t>,
size_t>, std::map<std::pair<std::array<char, 32>,
size_t>,
size_t>> *output_tracker_cache = NULL);
1403 void process_new_blockchain_entry(
const cryptonote::block& b,
const cryptonote::block_complete_entry& bche,
const parsed_block &parsed_block,
const crypto::hash& bl_id,
uint64_t height,
const std::vector<tx_cache_data> &tx_cache_data,
size_t tx_cache_data_offset, std::pair<std::map<std::pair<uint64_t, uint64_t>,
size_t>, std::map<std::pair<std::array<char, 32>,
size_t>,
size_t>> *output_tracker_cache = NULL);
1404 void detach_blockchain(
uint64_t height, std::pair<std::map<std::pair<uint64_t, uint64_t>,
size_t>, std::map<std::pair<std::array<char, 32>,
size_t>,
size_t>> *output_tracker_cache = NULL);
1405 void get_short_chain_history(std::list<crypto::hash>& ids,
uint64_t granularity = 1)
const;
1407 void clear_soft(
bool keep_key_images=
false);
1408 void pull_blocks(
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);
1409 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);
1410 void fast_refresh(
uint64_t stop_height,
uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history,
bool force =
false);
1411 void pull_and_parse_next_blocks(
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 &
error);
1412 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::pair<std::map<std::pair<uint64_t, uint64_t>,
size_t>, std::map<std::pair<std::array<char, 32>,
size_t>,
size_t>> *output_tracker_cache = NULL);
1413 uint64_t select_transfers(
uint64_t needed_etn, std::vector<size_t> unused_transfers_indices, std::vector<size_t>& selected_transfers)
const;
1414 bool prepare_file_names(
const std::string& file_path);
1419 void check_genesis(
const crypto::hash& genesis_hash)
const;
1420 bool generate_chacha_key_from_secret_keys(crypto::chacha_key &
key)
const;
1422 crypto::hash get_payment_id(
const pending_tx &ptx)
const;
1423 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;
1424 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;
1425 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;
1427 uint64_t get_upper_transaction_weight_limit()
const;
1428 std::vector<uint64_t> get_unspent_amounts_vector()
const;
1429 uint64_t get_dynamic_base_fee_estimate()
const;
1430 float get_output_relatedness(
const transfer_details &td0,
const transfer_details &td1)
const;
1431 std::vector<size_t> pick_preferred_rct_inputs(
uint64_t needed_etn,
uint32_t subaddr_account,
const std::set<uint32_t> &subaddr_indices)
const;
1432 void set_spent(
size_t idx,
uint64_t height,
bool public_out =
false);
1433 void set_unspent(
size_t idx,
bool public_out =
false);
1434 void get_outs(std::vector<std::vector<get_outs_entry>> &outs,
const std::vector<size_t> &selected_transfers,
size_t fake_outputs_count,
const uint8_t tx_version);
1435 bool tx_add_fake_output(std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs,
uint64_t global_index,
const crypto::public_key& tx_public_key,
const rct::key& mask,
uint64_t real_index,
bool unlocked)
const;
1436 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;
1437 std::vector<size_t> get_only_rct(
const std::vector<size_t> &unused_dust_indices,
const std::vector<size_t> &unused_transfers_indices)
const;
1438 void scan_output(
const cryptonote::transaction &tx,
bool miner_tx,
const crypto::public_key &tx_pub_key,
size_t i, tx_scan_info_t &tx_scan_info,
int &num_vouts_received, std::unordered_map<cryptonote::subaddress_index, uint64_t> &tx_etn_got_in_outs, std::vector<size_t> &outs,
bool pool);
1439 void trim_hashchain();
1441 rct::multisig_kLRki get_multisig_composite_kLRki(
size_t n,
const std::unordered_set<crypto::public_key> &ignore_set, std::unordered_set<rct::key> &used_L, std::unordered_set<rct::key> &new_used_L)
const;
1443 rct::key get_multisig_k(
size_t idx,
const std::unordered_set<rct::key> &used_L)
const;
1444 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);
1448 bool get_ring(
const crypto::chacha_key &
key,
const crypto::key_image &key_image, std::vector<uint64_t> &outs);
1449 crypto::chacha_key get_ringdb_key();
1453 void register_devices();
1454 hw::device& lookup_device(
const std::string & device_descriptor);
1456 bool get_rct_distribution(
uint64_t &start_height, std::vector<uint64_t> &distribution);
1458 uint64_t get_segregation_fork_height()
const;
1459 void unpack_multisig_info(
const std::vector<std::string>&
info,
1460 std::vector<crypto::public_key> &public_keys,
1461 std::vector<crypto::secret_key> &secret_keys)
const;
1462 bool unpack_extra_multisig_info(
const std::vector<std::string>&
info,
1463 std::vector<crypto::public_key> &signers,
1464 std::unordered_set<crypto::public_key> &pkeys)
const;
1469 std::shared_ptr<std::pair<std::map<std::pair<uint64_t, uint64_t>,
size_t>, std::map<std::pair<std::array<char, 32>,
size_t>,
size_t>>> create_output_tracker_cache()
const;
1472 void setup_new_blockchain();
1473 void create_keys_file(
const std::string &wallet_,
bool watch_only,
const epee::wipeable_string &password,
bool create_address_file);
1476 void on_device_button_request(
uint64_t code);
1477 void on_device_button_pressed();
1478 boost::optional<epee::wipeable_string> on_device_pin_request();
1479 boost::optional<epee::wipeable_string> on_device_passphrase_request(
bool on_device);
1482 std::string get_rpc_status(
const std::string &s)
const;
1483 void throw_on_rpc_response_error(
const boost::optional<std::string> &status,
const char *method)
const;
1489 boost::optional<epee::net_utils::http::login> m_daemon_login;
1490 std::string m_daemon_address;
1491 std::string m_wallet_file;
1492 std::string m_keys_file;
1493 std::string m_mms_file;
1496 std::unordered_map<crypto::hash, unconfirmed_transfer_details> m_unconfirmed_txs;
1497 std::unordered_map<crypto::hash, confirmed_transfer_details> m_confirmed_txs;
1498 std::unordered_multimap<crypto::hash, pool_payment_details> m_unconfirmed_payments;
1499 std::unordered_map<crypto::hash, crypto::secret_key> m_tx_keys;
1501 uint64_t fallback_to_pow_checkpoint_height;
1502 std::string fallback_to_pow_checkpoint_hash;
1503 std::unordered_map<crypto::hash, std::vector<crypto::secret_key>> m_additional_tx_keys;
1505 transfer_container m_transfers;
1506 payment_container m_payments;
1507 std::unordered_map<crypto::key_image, size_t> m_key_images;
1508 std::unordered_map<crypto::public_key, size_t> m_pub_keys;
1509 std::unordered_map<std::pair<crypto::hash, size_t>, size_t, boost::hash<std::pair<crypto::hash, size_t>>> m_chainstate_indexes;
1511 std::unordered_map<crypto::public_key, cryptonote::subaddress_index> m_subaddresses;
1512 std::vector<std::vector<std::string>> m_subaddress_labels;
1513 std::unordered_map<crypto::hash, std::string> m_tx_notes;
1514 std::unordered_map<std::string, std::string> m_attributes;
1515 std::vector<tools::wallet2::address_book_row> m_address_book;
1516 std::pair<std::map<std::string, std::string>, std::vector<std::string>> m_account_tags;
1517 uint64_t m_upper_transaction_weight_limit;
1518 const std::vector<std::vector<tools::wallet2::multisig_info>> *m_multisig_rescan_info;
1519 const std::vector<std::vector<rct::key>> *m_multisig_rescan_k;
1520 std::unordered_map<crypto::public_key, crypto::key_image> m_cold_key_images;
1522 std::atomic<bool> m_run;
1524 boost::recursive_mutex m_daemon_rpc_mutex;
1526 bool m_trusted_daemon;
1531 std::string seed_language;
1532 bool is_old_file_format;
1536 std::vector<crypto::public_key> m_multisig_signers;
1539 std::vector<crypto::public_key> m_multisig_derivations;
1540 bool m_always_confirm_transfers;
1541 bool m_print_ring_members;
1542 bool m_store_tx_info;
1545 RefreshType m_refresh_type;
1546 bool m_auto_refresh;
1547 bool m_first_refresh_done;
1548 uint64_t m_refresh_from_block_height;
1551 bool m_explicit_refresh_from_block_height;
1552 bool m_confirm_missing_payment_id;
1553 bool m_confirm_non_default_ring_size;
1554 AskPasswordType m_ask_password;
1557 bool m_merge_destinations;
1558 bool m_confirm_backlog;
1559 uint32_t m_confirm_backlog_threshold;
1560 bool m_confirm_export_overwrite;
1561 bool m_auto_low_priority;
1562 bool m_segregate_pre_fork_outputs;
1563 bool m_key_reuse_mitigation2;
1565 bool m_ignore_fractional_outputs;
1567 BackgroundMiningSetupType m_setup_background_mining;
1568 bool m_is_initialized;
1570 std::unordered_set<crypto::hash> m_scanned_pool_txs[2];
1571 size_t m_subaddress_lookahead_major, m_subaddress_lookahead_minor;
1572 std::string m_device_name;
1573 std::string m_device_derivation_path;
1574 uint64_t m_device_last_key_image_sync;
1579 std::unordered_map<crypto::hash, std::string> m_tx_device;
1582 bool m_light_wallet;
1583 uint64_t m_light_wallet_scanned_block_height;
1584 uint64_t m_light_wallet_blockchain_height;
1586 bool m_light_wallet_connected;
1588 uint64_t m_light_wallet_unlocked_balance;
1591 std::unordered_map<crypto::hash, address_tx> m_light_wallet_address_txs;
1593 std::unordered_map<crypto::public_key, std::map<uint64_t, crypto::key_image> > m_key_image_cache;
1595 std::string m_ring_database;
1596 bool m_ring_history_saved;
1597 std::unique_ptr<ringdb> m_ringdb;
1598 boost::optional<crypto::chacha_key> m_ringdb_key;
1601 std::unique_ptr<tools::file_locker> m_keys_file_locker;
1604 bool m_original_keys_available;
1608 crypto::chacha_key m_cache_key;
1609 boost::optional<epee::wipeable_string> m_encrypt_keys_after_refresh;
1612 bool m_devices_registered;
1614 std::shared_ptr<tools::Notify> m_tx_notify;
1615 std::unique_ptr<wallet_device_callback> m_device_callback;
1617 bool m_display_progress_indicator;