Monero
Loading...
Searching...
No Matches
wallet2.h
Go to the documentation of this file.
1// Copyright (c) 2014-2022, The Monero Project
2//
3// All rights reserved.
4//
5// Redistribution and use in source and binary forms, with or without modification, are
6// permitted provided that the following conditions are met:
7//
8// 1. Redistributions of source code must retain the above copyright notice, this list of
9// conditions and the following disclaimer.
10//
11// 2. Redistributions in binary form must reproduce the above copyright notice, this list
12// of conditions and the following disclaimer in the documentation and/or other
13// materials provided with the distribution.
14//
15// 3. Neither the name of the copyright holder nor the names of its contributors may be
16// used to endorse or promote products derived from this software without specific
17// prior written permission.
18//
19// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28//
29// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
30
31#pragma once
32
33#include <memory>
34
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>
39#endif
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>
44#include <atomic>
45#include <random>
46
47#include "include_base_utils.h"
51#include "net/http.h"
57#include "common/util.h"
58#include "crypto/chacha.h"
59#include "crypto/hash.h"
60#include "ringct/rctTypes.h"
61#include "ringct/rctOps.h"
65#include "serialization/pair.h"
66#include "serialization/tuple.h"
68
69#include "wallet_errors.h"
70#include "common/password.h"
71#include "node_rpc_proxy.h"
72#include "message_store.h"
73#include "wallet_light_rpc.h"
74#include "wallet_rpc_helpers.h"
75
76#undef MONERO_DEFAULT_LOG_CATEGORY
77#define MONERO_DEFAULT_LOG_CATEGORY "wallet.wallet2"
78
79#define THROW_ON_RPC_RESPONSE_ERROR(r, error, res, method, ...) \
80 do { \
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__); \
84 } while(0)
85
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)
88
89class Serialization_portability_wallet_Test;
91
92namespace tools
93{
94 class ringdb;
95 class wallet2;
96 class Notify;
97
99 {
100 public:
101 uint64_t pick();
102 gamma_picker(const std::vector<uint64_t> &rct_offsets);
103 gamma_picker(const std::vector<uint64_t> &rct_offsets, double shape, double scale);
104
105 private:
107 {
109 static constexpr result_type min() { return 0; }
110 static constexpr result_type max() { return std::numeric_limits<result_type>::max(); }
111 result_type operator()() { return crypto::rand<result_type>(); }
113
114private:
115 std::gamma_distribution<double> gamma;
116 const std::vector<uint64_t> &rct_offsets;
120 };
121
123 {
124 public:
125 wallet_keys_unlocker(wallet2 &w, const boost::optional<tools::password_container> &password);
128 private:
130 bool locked;
131 crypto::chacha_key key;
132 static boost::mutex lockers_lock;
133 static unsigned int lockers;
134 };
135
137 {
138 public:
139 // Full wallet callbacks
140 virtual void on_new_block(uint64_t height, const cryptonote::block& block) {}
141 virtual void on_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t amount, uint64_t burnt, const cryptonote::subaddress_index& subaddr_index, bool is_change, uint64_t unlock_time) {}
142 virtual void on_unconfirmed_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t amount, const cryptonote::subaddress_index& subaddr_index) {}
143 virtual void on_money_spent(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& in_tx, uint64_t amount, const cryptonote::transaction& spend_tx, const cryptonote::subaddress_index& subaddr_index) {}
144 virtual void on_skip_transaction(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx) {}
145 virtual boost::optional<epee::wipeable_string> on_get_password(const char *reason) { return boost::none; }
146 // Light wallet callbacks
147 virtual void on_lw_new_block(uint64_t height) {}
148 virtual void on_lw_money_received(uint64_t height, const crypto::hash &txid, uint64_t amount) {}
149 virtual void on_lw_unconfirmed_money_received(uint64_t height, const crypto::hash &txid, uint64_t amount) {}
150 virtual void on_lw_money_spent(uint64_t height, const crypto::hash &txid, uint64_t amount) {}
151 // Device callbacks
153 virtual void on_device_button_pressed() {}
154 virtual boost::optional<epee::wipeable_string> on_device_pin_request() { return boost::none; }
155 virtual boost::optional<epee::wipeable_string> on_device_passphrase_request(bool & on_device) { on_device = true; return boost::none; }
157 // Common callbacks
158 virtual void on_pool_tx_removed(const crypto::hash &txid) {}
160 };
161
163 {
164 public:
166 void on_button_request(uint64_t code=0) override;
167 void on_button_pressed() override;
168 boost::optional<epee::wipeable_string> on_pin_request() override;
169 boost::optional<epee::wipeable_string> on_passphrase_request(bool & on_device) override;
170 void on_progress(const hw::device_progress& event) override;
171 private:
173 };
174
176 {
180
181 tx_dust_policy(uint64_t a_dust_threshold = 0, bool an_add_to_fee = true, cryptonote::account_public_address an_addr_for_dust = cryptonote::account_public_address())
182 : dust_threshold(a_dust_threshold)
183 , add_to_fee(an_add_to_fee)
184 , addr_for_dust(an_addr_for_dust)
185 {
186 }
187 };
188
190 {
191 public:
192 hashchain(): m_genesis(crypto::null_hash), m_offset(0) {}
193
194 size_t size() const { return m_blockchain.size() + m_offset; }
195 size_t offset() const { return m_offset; }
196 const crypto::hash &genesis() const { return m_genesis; }
197 void push_back(const crypto::hash &hash) { if (m_offset == 0 && m_blockchain.empty()) m_genesis = hash; m_blockchain.push_back(hash); }
198 bool is_in_bounds(size_t idx) const { return idx >= m_offset && idx < size(); }
199 const crypto::hash &operator[](size_t idx) const { return m_blockchain[idx - m_offset]; }
200 crypto::hash &operator[](size_t idx) { return m_blockchain[idx - m_offset]; }
201 void crop(size_t height) { m_blockchain.resize(height - m_offset); }
202 void clear() { m_offset = 0; m_blockchain.clear(); }
203 bool empty() const { return m_blockchain.empty() && m_offset == 0; }
204 void trim(size_t height) { while (height > m_offset && m_blockchain.size() > 1) { m_blockchain.pop_front(); ++m_offset; } m_blockchain.shrink_to_fit(); }
205 void refill(const crypto::hash &hash) { m_blockchain.push_back(hash); --m_offset; }
206
207 template <class t_archive>
208 inline void serialize(t_archive &a, const unsigned int ver)
209 {
210 a & m_offset;
211 a & m_genesis;
212 a & m_blockchain;
213 }
214
221
222 private:
223 size_t m_offset;
225 std::deque<crypto::hash> m_blockchain;
226 };
227
230 {
231 friend class ::Serialization_portability_wallet_Test;
232 friend class ::wallet_accessor_test;
235 public:
236 static constexpr const std::chrono::seconds rpc_timeout = std::chrono::minutes(3) + std::chrono::seconds(30);
237
242 RefreshDefault = RefreshOptimizeCoinbase,
243 };
244
246 AskPasswordNever = 0,
247 AskPasswordOnAction = 1,
248 AskPasswordToDecrypt = 2,
249 };
250
252 BackgroundMiningMaybe = 0,
253 BackgroundMiningYes = 1,
254 BackgroundMiningNo = 2,
255 };
256
258 Binary = 0,
260 };
261
262 static const char* tr(const char* str);
263
264 static bool has_testnet_option(const boost::program_options::variables_map& vm);
265 static bool has_stagenet_option(const boost::program_options::variables_map& vm);
266 static std::string device_name_option(const boost::program_options::variables_map& vm);
267 static std::string device_derivation_path_option(const boost::program_options::variables_map &vm);
268 static void init_options(boost::program_options::options_description& desc_params);
269
271 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);
272
274 static std::pair<std::unique_ptr<wallet2>, password_container>
275 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);
276
278 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);
279
281 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);
282
283 static bool verify_password(const std::string& keys_file_name, const epee::wipeable_string& password, bool no_spend_key, hw::device &hwdev, uint64_t kdf_rounds);
284 static bool query_device(hw::device::device_type& device_type, const std::string& keys_file_name, const epee::wipeable_string& password, uint64_t kdf_rounds = 1);
285
286 wallet2(cryptonote::network_type nettype = cryptonote::MAINNET, uint64_t kdf_rounds = 1, bool unattended = false, std::unique_ptr<epee::net_utils::http::http_client_factory> http_client_factory = std::unique_ptr<epee::net_utils::http::http_client_factory>(new net::http::client_factory()));
287 ~wallet2();
288
290 {
291 struct LR
292 {
295
297 FIELD(m_L)
298 FIELD(m_R)
300 };
301
302 crypto::public_key m_signer;
303 std::vector<LR> m_LR;
304 std::vector<crypto::key_image> m_partial_key_images; // one per key the participant has
305
307 FIELD(m_signer)
308 FIELD(m_LR)
309 FIELD(m_partial_key_images)
311 };
312
314 {
320 bool error;
321 boost::optional<cryptonote::subaddress_receive_info> received;
322
323 tx_scan_info_t(): amount(0), money_transfered(0), error(true) {}
324 };
325
327 {
336 crypto::key_image m_key_image; //TODO: key_image stored twice :(
339 bool m_rct;
341 bool m_key_image_request; // view wallets: we want to request it; cold wallets: it was requested
345 std::vector<rct::key> m_multisig_k;
346 std::vector<multisig_info> m_multisig_info; // one per other participant
347 std::vector<std::pair<uint64_t, crypto::hash>> m_uses;
348
349 bool is_rct() const { return m_rct; }
350 uint64_t amount() const { return m_amount; }
352 crypto::public_key output_public_key;
353 THROW_WALLET_EXCEPTION_IF(m_tx.vout.size() <= m_internal_output_index,
354 error::wallet_internal_error, "Too few outputs, outputs may be corrupted");
355 THROW_WALLET_EXCEPTION_IF(!get_output_public_key(m_tx.vout[m_internal_output_index], output_public_key),
356 error::wallet_internal_error, "Unable to get output public key from output");
357 return output_public_key;
358 };
359
361 FIELD(m_block_height)
362 FIELD(m_tx)
363 FIELD(m_txid)
364 FIELD(m_internal_output_index)
365 FIELD(m_global_output_index)
366 FIELD(m_spent)
367 FIELD(m_frozen)
368 FIELD(m_spent_height)
369 FIELD(m_key_image)
370 FIELD(m_mask)
371 FIELD(m_amount)
372 FIELD(m_rct)
373 FIELD(m_key_image_known)
374 FIELD(m_key_image_request)
375 FIELD(m_pk_index)
376 FIELD(m_subaddr_index)
377 FIELD(m_key_image_partial)
378 FIELD(m_multisig_k)
379 FIELD(m_multisig_info)
380 FIELD(m_uses)
382 };
383
385 {
390 union
391 {
392 struct
393 {
398 uint8_t m_key_image_request: 1; // view wallets: we want to request it; cold wallets: it was requested
400 };
402 } m_flags;
404 std::vector<crypto::public_key> m_additional_tx_keys;
407
411 return false;
412 FIELD(m_pubkey)
413 VARINT_FIELD(m_internal_output_index)
414 VARINT_FIELD(m_global_output_index)
415 FIELD(m_tx_pubkey)
416 FIELD(m_flags.flags)
417 VARINT_FIELD(m_amount)
418 FIELD(m_additional_tx_keys)
419 VARINT_FIELD(m_subaddr_index_major)
420 VARINT_FIELD(m_subaddr_index_minor)
422 };
423
426 {
436
439 FIELD(m_tx_hash)
440 VARINT_FIELD(m_amount)
441 FIELD(m_amounts)
442 VARINT_FIELD(m_fee)
443 VARINT_FIELD(m_block_height)
444 VARINT_FIELD(m_unlock_time)
445 VARINT_FIELD(m_timestamp)
446 FIELD(m_coinbase)
447 FIELD(m_subaddr_index)
449 };
450
452 {
455 };
456
458 {
461
464 FIELD(m_pd)
465 FIELD(m_double_spend_seen)
467 };
468
470 {
476 std::vector<cryptonote::tx_destination_entry> m_dests;
478 enum { pending, pending_not_in_pool, failed } m_state;
480 uint32_t m_subaddr_account; // subaddress account of your wallet to be used in this transfer
481 std::set<uint32_t> m_subaddr_indices; // set of address indices used as inputs in this transfer
482 std::vector<std::pair<crypto::key_image, std::vector<uint64_t>>> m_rings; // relative
483
486 FIELD(m_tx)
487 VARINT_FIELD(m_amount_in)
488 VARINT_FIELD(m_amount_out)
489 VARINT_FIELD(m_change)
490 VARINT_FIELD(m_sent_time)
491 FIELD(m_dests)
492 FIELD(m_payment_id)
493 if (version >= 1)
494 VARINT_FIELD(m_state)
495 VARINT_FIELD(m_timestamp)
496 VARINT_FIELD(m_subaddr_account)
497 FIELD(m_subaddr_indices)
498 FIELD(m_rings)
500 };
501
503 {
509 std::vector<cryptonote::tx_destination_entry> m_dests;
513 uint32_t m_subaddr_account; // subaddress account of your wallet to be used in this transfer
514 std::set<uint32_t> m_subaddr_indices; // set of address indices used as inputs in this transfer
515 std::vector<std::pair<crypto::key_image, std::vector<uint64_t>>> m_rings; // relative
516
517 confirmed_transfer_details(): m_amount_in(0), m_amount_out(0), m_change((uint64_t)-1), m_block_height(0), m_payment_id(crypto::null_hash), m_timestamp(0), m_unlock_time(0), m_subaddr_account((uint32_t)-1) {}
519 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) {}
520
523 if (version >= 1)
524 FIELD(m_tx)
525 VARINT_FIELD(m_amount_in)
526 VARINT_FIELD(m_amount_out)
527 VARINT_FIELD(m_change)
528 VARINT_FIELD(m_block_height)
529 FIELD(m_dests)
530 FIELD(m_payment_id)
531 VARINT_FIELD(m_timestamp)
532 VARINT_FIELD(m_unlock_time)
533 VARINT_FIELD(m_subaddr_account)
534 FIELD(m_subaddr_indices)
535 FIELD(m_rings)
537 };
538
540 {
541 std::vector<cryptonote::tx_source_entry> sources;
543 std::vector<cryptonote::tx_destination_entry> splitted_dsts; // split, includes change
544 std::vector<size_t> selected_transfers;
545 std::vector<uint8_t> extra;
550 std::vector<cryptonote::tx_destination_entry> dests; // original setup, does not include change
551 uint32_t subaddr_account; // subaddress account of your wallet to be used in this transfer
552 std::set<uint32_t> subaddr_indices; // set of address indices used as inputs in this transfer
553
555 {
556 _use_rct = 1 << 0, // 00000001
557 _use_view_tags = 1 << 1 // 00000010
558 // next flag = 1 << 2 // 00000100
559 // ...
560 // final flag = 1 << 7 // 10000000
561 };
563
565 FIELD(sources)
566 FIELD(change_dts)
567 FIELD(splitted_dsts)
568 FIELD(selected_transfers)
569 FIELD(extra)
570 FIELD(unlock_time)
571
572 // converted `use_rct` field into construction_flags when view tags
573 // were introduced to maintain backwards compatibility
574 if (!typename Archive<W>::is_saving())
575 {
576 FIELD_N("use_rct", construction_flags)
577 use_rct = (construction_flags & _use_rct) > 0;
578 use_view_tags = (construction_flags & _use_view_tags) > 0;
579 }
580 else
581 {
582 construction_flags = 0;
583 if (use_rct)
584 construction_flags ^= _use_rct;
585 if (use_view_tags)
586 construction_flags ^= _use_view_tags;
587
588 FIELD_N("use_rct", construction_flags)
589 }
590
591 FIELD(rct_config)
592 FIELD(dests)
593 FIELD(subaddr_account)
594 FIELD(subaddr_indices)
596 };
597
598 typedef std::vector<transfer_details> transfer_container;
600
602 {
604 std::unordered_set<crypto::public_key> ignore;
605 std::unordered_set<rct::key> used_L;
606 std::unordered_set<crypto::public_key> signing_keys;
608
613
617 return false;
618 FIELD(sigs)
619 FIELD(ignore)
620 FIELD(used_L)
621 FIELD(signing_keys)
622 FIELD(msout)
623 FIELD(total_alpha_G)
624 FIELD(total_alpha_H)
625 FIELD(c_0)
626 FIELD(s)
628 };
629
630 // The convention for destinations is:
631 // dests does not include change
632 // splitted_dsts (in construction_data) does
634 {
639 std::vector<size_t> selected_transfers;
640 std::string key_images;
642 std::vector<crypto::secret_key> additional_tx_keys;
643 std::vector<cryptonote::tx_destination_entry> dests;
644 std::vector<multisig_sig> multisig_sigs;
646
648
651 FIELD(tx)
652 FIELD(dust)
653 FIELD(fee)
654 FIELD(dust_added_to_fee)
655 FIELD(change_dts)
656 FIELD(selected_transfers)
657 FIELD(key_images)
658 FIELD(tx_key)
659 FIELD(additional_tx_keys)
660 FIELD(dests)
661 FIELD(construction_data)
662 FIELD(multisig_sigs)
664 {
665 multisig_tx_key_entropy = crypto::null_skey;
666 return true;
667 }
668 FIELD(multisig_tx_key_entropy)
670 };
671
672 // The term "Unsigned tx" is not really a tx since it's not signed yet.
673 // It doesnt have tx hash, key and the integrated address is not separated into addr + payment id.
675 {
676 std::vector<tx_construction_data> txes;
677 std::tuple<uint64_t, uint64_t, wallet2::transfer_container> transfers;
678 std::tuple<uint64_t, uint64_t, std::vector<wallet2::exported_transfer_details>> new_transfers;
679
682 FIELD(txes)
683 if (version == 0)
684 {
685 std::pair<size_t, wallet2::transfer_container> v0_transfers;
686 FIELD(v0_transfers);
687 std::get<0>(transfers) = std::get<0>(v0_transfers);
688 std::get<1>(transfers) = std::get<0>(v0_transfers) + std::get<1>(v0_transfers).size();
689 std::get<2>(transfers) = std::get<1>(v0_transfers);
690 return true;
691 }
692 if (version == 1)
693 {
694 std::pair<size_t, std::vector<wallet2::exported_transfer_details>> v1_transfers;
695 FIELD(v1_transfers);
696 std::get<0>(new_transfers) = std::get<0>(v1_transfers);
697 std::get<1>(new_transfers) = std::get<0>(v1_transfers) + std::get<1>(v1_transfers).size();
698 std::get<2>(new_transfers) = std::get<1>(v1_transfers);
699 return true;
700 }
701
702 FIELD(new_transfers)
704 };
705
707 {
708 std::vector<pending_tx> ptx;
709 std::vector<crypto::key_image> key_images;
711
714 FIELD(ptx)
715 FIELD(key_images)
716 FIELD(tx_key_images)
718 };
719
721 {
722 std::vector<pending_tx> m_ptx;
723 std::unordered_set<crypto::public_key> m_signers;
724
726 FIELD(m_ptx)
727 FIELD(m_signers)
729 };
730
732 {
733 crypto::chacha_iv iv;
734 std::string account_data;
735
737 FIELD(iv)
738 FIELD(account_data)
740 };
741
743 {
744 crypto::chacha_iv iv;
745 std::string cache_data;
746
748 FIELD(iv)
749 FIELD(cache_data)
751 };
752
753 // GUI Address book
755 {
758 std::string m_description;
761
764 FIELD(m_address)
765 FIELD(m_payment_id)
766 FIELD(m_description)
767 FIELD(m_is_subaddress)
768 FIELD(m_has_payment_id)
770 };
771
773 {
780
783 FIELD(txid)
784 VARINT_FIELD(index_in_tx)
785 FIELD(shared_secret)
786 FIELD(key_image)
787 FIELD(shared_secret_sig)
788 FIELD(key_image_sig)
790 };
791
792 typedef std::tuple<uint64_t, crypto::public_key, rct::key> get_outs_entry;
793
795 {
798 std::vector<cryptonote::transaction> txes;
800 bool error;
801 };
802
804 {
807 std::vector<boost::optional<cryptonote::subaddress_receive_info>> received;
808 };
809
811 {
812 std::vector<cryptonote::tx_extra_field> tx_extra_fields;
813 std::vector<is_out_data> primary;
814 std::vector<is_out_data> additional;
815
816 bool empty() const { return tx_extra_fields.empty() && primary.empty() && additional.empty(); }
817 };
818
827 void generate(const std::string& wallet_, const epee::wipeable_string& password,
828 const epee::wipeable_string& multisig_data, bool create_address_file = false);
829
840 crypto::secret_key generate(const std::string& wallet, const epee::wipeable_string& password,
841 const crypto::secret_key& recovery_param = crypto::secret_key(), bool recover = false,
842 bool two_random = false, bool create_address_file = false);
852 void generate(const std::string& wallet, const epee::wipeable_string& password,
853 const cryptonote::account_public_address &account_public_address,
854 const crypto::secret_key& spendkey, const crypto::secret_key& viewkey, bool create_address_file = false);
863 void generate(const std::string& wallet, const epee::wipeable_string& password,
864 const cryptonote::account_public_address &account_public_address,
865 const crypto::secret_key& viewkey = crypto::secret_key(), bool create_address_file = false);
873 void restore(const std::string& wallet_, const epee::wipeable_string& password, const std::string &device_name, bool create_address_file = false);
874
880 std::string make_multisig(const epee::wipeable_string &password,
881 const std::vector<std::string> &kex_messages,
882 const std::uint32_t threshold);
888 std::string exchange_multisig_keys(const epee::wipeable_string &password,
889 const std::vector<std::string> &kex_messages,
890 const bool force_update_use_with_caution = false);
895 std::string get_multisig_first_kex_msg() const;
900 cryptonote::blobdata export_multisig();
905 size_t import_multisig(std::vector<cryptonote::blobdata> info);
911 void rewrite(const std::string& wallet_name, const epee::wipeable_string& password);
912 void write_watch_only_wallet(const std::string& wallet_name, const epee::wipeable_string& password, std::string &new_keys_filename);
913 void load(const std::string& wallet, const epee::wipeable_string& password, const std::string& keys_buf = "", const std::string& cache_buf = "");
914 void store();
920 void store_to(const std::string &path, const epee::wipeable_string &password);
927 boost::optional<wallet2::keys_file_data> get_keys_file_data(const epee::wipeable_string& password, bool watch_only);
933 boost::optional<wallet2::cache_file_data> get_cache_file_data(const epee::wipeable_string& password);
934
935 std::string path() const;
936
940 bool verify_password(const epee::wipeable_string& password);
942 const cryptonote::account_base& get_account()const{return m_account;}
943
944 void encrypt_keys(const crypto::chacha_key &key);
945 void encrypt_keys(const epee::wipeable_string &password);
946 void decrypt_keys(const crypto::chacha_key &key);
947 void decrypt_keys(const epee::wipeable_string &password);
948
949 void set_refresh_from_block_height(uint64_t height) {m_refresh_from_block_height = height;}
950 uint64_t get_refresh_from_block_height() const {return m_refresh_from_block_height;}
951
952 void explicit_refresh_from_block_height(bool expl) {m_explicit_refresh_from_block_height = expl;}
953 bool explicit_refresh_from_block_height() const {return m_explicit_refresh_from_block_height;}
954
955 void max_reorg_depth(uint64_t depth) {m_max_reorg_depth = depth;}
956 uint64_t max_reorg_depth() const {return m_max_reorg_depth;}
957
958 bool deinit();
959 bool init(std::string daemon_address = "http://localhost:8080",
960 boost::optional<epee::net_utils::http::login> daemon_login = boost::none,
961 const std::string &proxy = "",
962 uint64_t upper_transaction_weight_limit = 0,
963 bool trusted_daemon = true,
965 bool set_daemon(std::string daemon_address = "http://localhost:8080",
966 boost::optional<epee::net_utils::http::login> daemon_login = boost::none, bool trusted_daemon = true,
968 bool set_proxy(const std::string &address);
969
970 void stop() { m_run.store(false, std::memory_order_relaxed); m_message_store.stop(); }
971
972 i_wallet2_callback* callback() const { return m_callback; }
973 void callback(i_wallet2_callback* callback) { m_callback = callback; }
974
975 bool is_trusted_daemon() const { return m_trusted_daemon; }
976 void set_trusted_daemon(bool trusted) { m_trusted_daemon = trusted; }
977
981 bool is_deterministic() const;
982 bool get_seed(epee::wipeable_string& electrum_words, const epee::wipeable_string &passphrase = epee::wipeable_string()) const;
983
987 bool light_wallet() const { return m_light_wallet; }
988 void set_light_wallet(bool light_wallet) { m_light_wallet = light_wallet; }
989 uint64_t get_light_wallet_scanned_block_height() const { return m_light_wallet_scanned_block_height; }
990 uint64_t get_light_wallet_blockchain_height() const { return m_light_wallet_blockchain_height; }
991
995 const std::string &get_seed_language() const;
999 void set_seed_language(const std::string &language);
1000
1001 // Subaddress scheme
1002 cryptonote::account_public_address get_subaddress(const cryptonote::subaddress_index& index) const;
1003 cryptonote::account_public_address get_address() const { return get_subaddress({0,0}); }
1004 boost::optional<cryptonote::subaddress_index> get_subaddress_index(const cryptonote::account_public_address& address) const;
1005 crypto::public_key get_subaddress_spend_public_key(const cryptonote::subaddress_index& index) const;
1006 std::vector<crypto::public_key> get_subaddress_spend_public_keys(uint32_t account, uint32_t begin, uint32_t end) const;
1007 std::string get_subaddress_as_str(const cryptonote::subaddress_index& index) const;
1008 std::string get_address_as_str() const { return get_subaddress_as_str({0, 0}); }
1009 std::string get_integrated_address_as_str(const crypto::hash8& payment_id) const;
1010 void add_subaddress_account(const std::string& label);
1011 size_t get_num_subaddress_accounts() const { return m_subaddress_labels.size(); }
1012 size_t get_num_subaddresses(uint32_t index_major) const { return index_major < m_subaddress_labels.size() ? m_subaddress_labels[index_major].size() : 0; }
1013 void add_subaddress(uint32_t index_major, const std::string& label); // throws when index is out of bound
1014 void expand_subaddresses(const cryptonote::subaddress_index& index);
1015 void create_one_off_subaddress(const cryptonote::subaddress_index& index);
1016 std::string get_subaddress_label(const cryptonote::subaddress_index& index) const;
1017 void set_subaddress_label(const cryptonote::subaddress_index &index, const std::string &label);
1018 void set_subaddress_lookahead(size_t major, size_t minor);
1019 std::pair<size_t, size_t> get_subaddress_lookahead() const { return {m_subaddress_lookahead_major, m_subaddress_lookahead_minor}; }
1023 bool is_deprecated() const;
1024 void refresh(bool trusted_daemon);
1025 void refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blocks_fetched);
1026 void refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blocks_fetched, bool& received_money, bool check_pool = true);
1027 bool refresh(bool trusted_daemon, uint64_t & blocks_fetched, bool& received_money, bool& ok);
1028
1029 void set_refresh_type(RefreshType refresh_type) { m_refresh_type = refresh_type; }
1030 RefreshType get_refresh_type() const { return m_refresh_type; }
1031
1032 cryptonote::network_type nettype() const { return m_nettype; }
1033 bool watch_only() const { return m_watch_only; }
1034 bool multisig(bool *ready = NULL, uint32_t *threshold = NULL, uint32_t *total = NULL) const;
1035 bool has_multisig_partial_key_images() const;
1036 bool has_unknown_key_images() const;
1037 bool get_multisig_seed(epee::wipeable_string& seed, const epee::wipeable_string &passphrase = std::string(), bool raw = true) const;
1038 bool key_on_device() const { return get_device_type() != hw::device::device_type::SOFTWARE; }
1039 hw::device::device_type get_device_type() const { return m_key_device_type; }
1040 bool reconnect_device();
1041
1042 // locked & unlocked balance of given or current subaddress account
1043 uint64_t balance(uint32_t subaddr_index_major, bool strict) const;
1044 uint64_t unlocked_balance(uint32_t subaddr_index_major, bool strict, uint64_t *blocks_to_unlock = NULL, uint64_t *time_to_unlock = NULL);
1045 // locked & unlocked balance per subaddress of given or current subaddress account
1046 std::map<uint32_t, uint64_t> balance_per_subaddress(uint32_t subaddr_index_major, bool strict) const;
1047 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);
1048 // all locked & unlocked balances of all subaddress accounts
1049 uint64_t balance_all(bool strict) const;
1050 uint64_t unlocked_balance_all(bool strict, uint64_t *blocks_to_unlock = NULL, uint64_t *time_to_unlock = NULL);
1051 template<typename T>
1052 void transfer_selected(const std::vector<cryptonote::tx_destination_entry>& dsts, const std::vector<size_t>& selected_transfers, size_t fake_outputs_count,
1053 std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs, std::unordered_set<crypto::public_key> &valid_public_keys_cache,
1054 uint64_t unlock_time, uint64_t fee, const std::vector<uint8_t>& extra, T destination_split_strategy, const tx_dust_policy& dust_policy, cryptonote::transaction& tx, pending_tx &ptx, const bool use_view_tags);
1055 void transfer_selected_rct(std::vector<cryptonote::tx_destination_entry> dsts, const std::vector<size_t>& selected_transfers, size_t fake_outputs_count,
1056 std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs, std::unordered_set<crypto::public_key> &valid_public_keys_cache,
1057 uint64_t unlock_time, uint64_t fee, const std::vector<uint8_t>& extra, cryptonote::transaction& tx, pending_tx &ptx, const rct::RCTConfig &rct_config, const bool use_view_tags);
1058
1059 void commit_tx(pending_tx& ptx_vector);
1060 void commit_tx(std::vector<pending_tx>& ptx_vector);
1061 bool save_tx(const std::vector<pending_tx>& ptx_vector, const std::string &filename) const;
1062 std::string dump_tx_to_str(const std::vector<pending_tx> &ptx_vector) const;
1063 std::string save_multisig_tx(multisig_tx_set txs);
1064 bool save_multisig_tx(const multisig_tx_set &txs, const std::string &filename);
1065 std::string save_multisig_tx(const std::vector<pending_tx>& ptx_vector);
1066 bool save_multisig_tx(const std::vector<pending_tx>& ptx_vector, const std::string &filename);
1067 multisig_tx_set make_multisig_tx_set(const std::vector<pending_tx>& ptx_vector) const;
1068 // load unsigned tx from file and sign it. Takes confirmation callback as argument. Used by the cli wallet
1069 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);
1070 // sign unsigned tx. Takes unsigned_tx_set as argument. Used by GUI
1071 bool sign_tx(unsigned_tx_set &exported_txs, const std::string &signed_filename, std::vector<wallet2::pending_tx> &ptx, bool export_raw = false);
1072 bool sign_tx(unsigned_tx_set &exported_txs, std::vector<wallet2::pending_tx> &ptx, signed_tx_set &signed_txs);
1073 std::string sign_tx_dump_to_str(unsigned_tx_set &exported_txs, std::vector<wallet2::pending_tx> &ptx, signed_tx_set &signed_txes);
1074 // load unsigned_tx_set from file.
1075 bool load_unsigned_tx(const std::string &unsigned_filename, unsigned_tx_set &exported_txs) const;
1076 bool parse_unsigned_tx_from_str(const std::string &unsigned_tx_st, unsigned_tx_set &exported_txs) const;
1077 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);
1078 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);
1079 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); // pass subaddr_indices by value on purpose
1080 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);
1081 std::vector<wallet2::pending_tx> create_transactions_single(const crypto::key_image &ki, 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);
1082 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, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t>& extra);
1083 bool sanity_check(const std::vector<wallet2::pending_tx> &ptx_vector, std::vector<cryptonote::tx_destination_entry> dsts) const;
1084 void cold_tx_aux_import(const std::vector<pending_tx>& ptx, const std::vector<std::string>& tx_device_aux);
1085 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);
1086 uint64_t cold_key_image_sync(uint64_t &spent, uint64_t &unspent);
1087 void device_show_address(uint32_t account_index, uint32_t address_index, const boost::optional<crypto::hash8> &payment_id);
1088 bool parse_multisig_tx_from_str(std::string multisig_tx_st, multisig_tx_set &exported_txs) const;
1089 bool load_multisig_tx(cryptonote::blobdata blob, multisig_tx_set &exported_txs, std::function<bool(const multisig_tx_set&)> accept_func = NULL);
1090 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);
1091 bool sign_multisig_tx_from_file(const std::string &filename, std::vector<crypto::hash> &txids, std::function<bool(const multisig_tx_set&)> accept_func);
1092 bool sign_multisig_tx(multisig_tx_set &exported_txs, std::vector<crypto::hash> &txids);
1093 bool sign_multisig_tx_to_file(multisig_tx_set &exported_txs, const std::string &filename, std::vector<crypto::hash> &txids);
1094 std::vector<pending_tx> create_unmixable_sweep_transactions();
1095 void discard_unmixable_outputs();
1096 bool check_connection(uint32_t *version = NULL, bool *ssl = NULL, uint32_t timeout = 200000, bool *wallet_is_outdated = NULL, bool *daemon_is_outdated = NULL);
1097 bool check_version(uint32_t *version, bool *wallet_is_outdated, bool *daemon_is_outdated);
1098 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);
1099 void get_transfers(wallet2::transfer_container& incoming_transfers) const;
1100 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;
1101 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;
1102 void get_payments_out(std::list<std::pair<crypto::hash,wallet2::confirmed_transfer_details>>& confirmed_payments,
1103 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;
1104 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;
1105 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;
1106
1107 uint64_t get_blockchain_current_height() const { return m_light_wallet_blockchain_height ? m_light_wallet_blockchain_height : m_blockchain.size(); }
1108 void rescan_spent();
1109 void rescan_blockchain(bool hard, bool refresh = true, bool keep_key_images = false);
1110 bool is_transfer_unlocked(const transfer_details& td);
1111 bool is_transfer_unlocked(uint64_t unlock_time, uint64_t block_height);
1112
1113 uint64_t get_last_block_reward() const { return m_last_block_reward; }
1114 uint64_t get_device_last_key_image_sync() const { return m_device_last_key_image_sync; }
1115
1116 std::vector<cryptonote::public_node> get_public_nodes(bool white_only = true);
1117
1118 template <class t_archive>
1119 inline void serialize(t_archive &a, const unsigned int ver)
1120 {
1121 uint64_t dummy_refresh_height = 0; // moved to keys file
1122 if(ver < 5)
1123 return;
1124 if (ver < 19)
1125 {
1126 std::vector<crypto::hash> blockchain;
1127 a & blockchain;
1128 m_blockchain.clear();
1129 for (const auto &b: blockchain)
1130 {
1131 m_blockchain.push_back(b);
1132 }
1133 }
1134 else
1135 {
1136 a & m_blockchain;
1137 }
1138 a & m_transfers;
1139 a & m_account_public_address;
1140 a & m_key_images.parent();
1141 if(ver < 6)
1142 return;
1143 a & m_unconfirmed_txs.parent();
1144 if(ver < 7)
1145 return;
1146 a & m_payments.parent();
1147 if(ver < 8)
1148 return;
1149 a & m_tx_keys.parent();
1150 if(ver < 9)
1151 return;
1152 a & m_confirmed_txs.parent();
1153 if(ver < 11)
1154 return;
1155 a & dummy_refresh_height;
1156 if(ver < 12)
1157 return;
1158 a & m_tx_notes.parent();
1159 if(ver < 13)
1160 return;
1161 if (ver < 17)
1162 {
1163 // we're loading an old version, where m_unconfirmed_payments was a std::map
1164 std::unordered_map<crypto::hash, payment_details> m;
1165 a & m;
1166 m_unconfirmed_payments.clear();
1167 for (std::unordered_map<crypto::hash, payment_details>::const_iterator i = m.begin(); i != m.end(); ++i)
1168 m_unconfirmed_payments.insert(std::make_pair(i->first, pool_payment_details{i->second, false}));
1169 }
1170 if(ver < 14)
1171 return;
1172 if(ver < 15)
1173 {
1174 // we're loading an older wallet without a pubkey map, rebuild it
1175 m_pub_keys.clear();
1176 for (size_t i = 0; i < m_transfers.size(); ++i)
1177 {
1178 const transfer_details &td = m_transfers[i];
1179 m_pub_keys.emplace(td.get_public_key(), i);
1180 }
1181 return;
1182 }
1183 a & m_pub_keys.parent();
1184 if(ver < 16)
1185 return;
1186 a & m_address_book;
1187 if(ver < 17)
1188 return;
1189 if (ver < 22)
1190 {
1191 // we're loading an old version, where m_unconfirmed_payments payload was payment_details
1192 std::unordered_multimap<crypto::hash, payment_details> m;
1193 a & m;
1194 m_unconfirmed_payments.clear();
1195 for (const auto &i: m)
1196 m_unconfirmed_payments.insert(std::make_pair(i.first, pool_payment_details{i.second, false}));
1197 }
1198 if(ver < 18)
1199 return;
1200 a & m_scanned_pool_txs[0];
1201 a & m_scanned_pool_txs[1];
1202 if (ver < 20)
1203 return;
1204 a & m_subaddresses.parent();
1205 std::unordered_map<cryptonote::subaddress_index, crypto::public_key> dummy_subaddresses_inv;
1206 a & dummy_subaddresses_inv;
1207 a & m_subaddress_labels;
1208 a & m_additional_tx_keys.parent();
1209 if(ver < 21)
1210 return;
1211 a & m_attributes.parent();
1212 if(ver < 22)
1213 return;
1214 a & m_unconfirmed_payments.parent();
1215 if(ver < 23)
1216 return;
1217 a & (std::pair<std::map<std::string, std::string>, std::vector<std::string>>&)m_account_tags;
1218 if(ver < 24)
1219 return;
1220 a & m_ring_history_saved;
1221 if(ver < 25)
1222 return;
1223 a & m_last_block_reward;
1224 if(ver < 26)
1225 return;
1226 a & m_tx_device.parent();
1227 if(ver < 27)
1228 return;
1229 a & m_device_last_key_image_sync;
1230 if(ver < 28)
1231 return;
1232 a & m_cold_key_images.parent();
1233 if(ver < 29)
1234 return;
1235 a & m_rpc_client_secret_key;
1236 if(ver < 30)
1237 {
1238 m_has_ever_refreshed_from_node = false;
1239 return;
1240 }
1241 a & m_has_ever_refreshed_from_node;
1242 }
1243
1245 MAGIC_FIELD("monero wallet cache")
1246 VERSION_FIELD(1)
1247 FIELD(m_blockchain)
1248 FIELD(m_transfers)
1249 FIELD(m_account_public_address)
1250 FIELD(m_key_images)
1251 FIELD(m_unconfirmed_txs)
1252 FIELD(m_payments)
1253 FIELD(m_tx_keys)
1254 FIELD(m_confirmed_txs)
1255 FIELD(m_tx_notes)
1256 FIELD(m_unconfirmed_payments)
1257 FIELD(m_pub_keys)
1258 FIELD(m_address_book)
1259 FIELD(m_scanned_pool_txs[0])
1260 FIELD(m_scanned_pool_txs[1])
1261 FIELD(m_subaddresses)
1262 FIELD(m_subaddress_labels)
1263 FIELD(m_additional_tx_keys)
1264 FIELD(m_attributes)
1265 FIELD(m_account_tags)
1266 FIELD(m_ring_history_saved)
1267 FIELD(m_last_block_reward)
1268 FIELD(m_tx_device)
1269 FIELD(m_device_last_key_image_sync)
1270 FIELD(m_cold_key_images)
1271 FIELD(m_rpc_client_secret_key)
1273 {
1274 m_has_ever_refreshed_from_node = false;
1275 return true;
1276 }
1277 FIELD(m_has_ever_refreshed_from_node)
1279
1280
1286 static void wallet_exists(const std::string& file_path, bool& keys_file_exists, bool& wallet_file_exists);
1292 static bool wallet_valid_path_format(const std::string& file_path);
1293 static bool parse_long_payment_id(const std::string& payment_id_str, crypto::hash& payment_id);
1294 static bool parse_short_payment_id(const std::string& payment_id_str, crypto::hash8& payment_id);
1295 static bool parse_payment_id(const std::string& payment_id_str, crypto::hash& payment_id);
1296
1297 bool always_confirm_transfers() const { return m_always_confirm_transfers; }
1298 void always_confirm_transfers(bool always) { m_always_confirm_transfers = always; }
1299 bool print_ring_members() const { return m_print_ring_members; }
1300 void print_ring_members(bool value) { m_print_ring_members = value; }
1301 bool store_tx_info() const { return m_store_tx_info; }
1302 void store_tx_info(bool store) { m_store_tx_info = store; }
1303 uint32_t default_mixin() const { return m_default_mixin; }
1304 void default_mixin(uint32_t m) { m_default_mixin = m; }
1305 uint32_t get_default_priority() const { return m_default_priority; }
1306 void set_default_priority(uint32_t p) { m_default_priority = p; }
1307 bool auto_refresh() const { return m_auto_refresh; }
1308 void auto_refresh(bool r) { m_auto_refresh = r; }
1309 AskPasswordType ask_password() const { return m_ask_password; }
1310 void ask_password(AskPasswordType ask) { m_ask_password = ask; }
1311 void set_min_output_count(uint32_t count) { m_min_output_count = count; }
1312 uint32_t get_min_output_count() const { return m_min_output_count; }
1313 void set_min_output_value(uint64_t value) { m_min_output_value = value; }
1314 uint64_t get_min_output_value() const { return m_min_output_value; }
1315 void merge_destinations(bool merge) { m_merge_destinations = merge; }
1316 bool merge_destinations() const { return m_merge_destinations; }
1317 bool confirm_backlog() const { return m_confirm_backlog; }
1318 void confirm_backlog(bool always) { m_confirm_backlog = always; }
1319 void set_confirm_backlog_threshold(uint32_t threshold) { m_confirm_backlog_threshold = threshold; };
1320 uint32_t get_confirm_backlog_threshold() const { return m_confirm_backlog_threshold; };
1321 bool confirm_export_overwrite() const { return m_confirm_export_overwrite; }
1322 void confirm_export_overwrite(bool always) { m_confirm_export_overwrite = always; }
1323 bool auto_low_priority() const { return m_auto_low_priority; }
1324 void auto_low_priority(bool value) { m_auto_low_priority = value; }
1325 bool segregate_pre_fork_outputs() const { return m_segregate_pre_fork_outputs; }
1326 void segregate_pre_fork_outputs(bool value) { m_segregate_pre_fork_outputs = value; }
1327 bool key_reuse_mitigation2() const { return m_key_reuse_mitigation2; }
1328 void key_reuse_mitigation2(bool value) { m_key_reuse_mitigation2 = value; }
1329 uint64_t segregation_height() const { return m_segregation_height; }
1330 void segregation_height(uint64_t height) { m_segregation_height = height; }
1331 bool ignore_fractional_outputs() const { return m_ignore_fractional_outputs; }
1332 void ignore_fractional_outputs(bool value) { m_ignore_fractional_outputs = value; }
1333 bool confirm_non_default_ring_size() const { return m_confirm_non_default_ring_size; }
1334 void confirm_non_default_ring_size(bool always) { m_confirm_non_default_ring_size = always; }
1335 uint64_t ignore_outputs_above() const { return m_ignore_outputs_above; }
1336 void ignore_outputs_above(uint64_t value) { m_ignore_outputs_above = value; }
1337 uint64_t ignore_outputs_below() const { return m_ignore_outputs_below; }
1338 void ignore_outputs_below(uint64_t value) { m_ignore_outputs_below = value; }
1339 bool track_uses() const { return m_track_uses; }
1340 void track_uses(bool value) { m_track_uses = value; }
1341 bool show_wallet_name_when_locked() const { return m_show_wallet_name_when_locked; }
1342 void show_wallet_name_when_locked(bool value) { m_show_wallet_name_when_locked = value; }
1343 BackgroundMiningSetupType setup_background_mining() const { return m_setup_background_mining; }
1344 void setup_background_mining(BackgroundMiningSetupType value) { m_setup_background_mining = value; }
1345 uint32_t inactivity_lock_timeout() const { return m_inactivity_lock_timeout; }
1346 void inactivity_lock_timeout(uint32_t seconds) { m_inactivity_lock_timeout = seconds; }
1347 const std::string & device_name() const { return m_device_name; }
1348 void device_name(const std::string & device_name) { m_device_name = device_name; }
1349 const std::string & device_derivation_path() const { return m_device_derivation_path; }
1350 void device_derivation_path(const std::string &device_derivation_path) { m_device_derivation_path = device_derivation_path; }
1351 const ExportFormat & export_format() const { return m_export_format; }
1352 inline void set_export_format(const ExportFormat& export_format) { m_export_format = export_format; }
1353 bool load_deprecated_formats() const { return m_load_deprecated_formats; }
1354 void load_deprecated_formats(bool load) { m_load_deprecated_formats = load; }
1355 bool persistent_rpc_client_id() const { return m_persistent_rpc_client_id; }
1356 void persistent_rpc_client_id(bool persistent) { m_persistent_rpc_client_id = persistent; }
1357 void auto_mine_for_rpc_payment_threshold(float threshold) { m_auto_mine_for_rpc_payment_threshold = threshold; }
1358 float auto_mine_for_rpc_payment_threshold() const { return m_auto_mine_for_rpc_payment_threshold; }
1359 crypto::secret_key get_rpc_client_secret_key() const { return m_rpc_client_secret_key; }
1360 void set_rpc_client_secret_key(const crypto::secret_key &key) { m_rpc_client_secret_key = key; m_node_rpc_proxy.set_client_secret_key(key); }
1361 uint64_t credits_target() const { return m_credits_target; }
1362 void credits_target(uint64_t threshold) { m_credits_target = threshold; }
1363 bool is_multisig_enabled() const { return m_enable_multisig; }
1364 void enable_multisig(bool enable) { m_enable_multisig = enable; }
1365 bool is_mismatched_daemon_version_allowed() const { return m_allow_mismatched_daemon_version; }
1366 void allow_mismatched_daemon_version(bool allow_mismatch) { m_allow_mismatched_daemon_version = allow_mismatch; }
1367
1368 bool get_tx_key_cached(const crypto::hash &txid, crypto::secret_key &tx_key, std::vector<crypto::secret_key> &additional_tx_keys) const;
1369 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);
1370 bool get_tx_key(const crypto::hash &txid, crypto::secret_key &tx_key, std::vector<crypto::secret_key> &additional_tx_keys);
1371 void check_tx_key(const crypto::hash &txid, const crypto::secret_key &tx_key, const std::vector<crypto::secret_key> &additional_tx_keys, const cryptonote::account_public_address &address, uint64_t &received, bool &in_pool, uint64_t &confirmations);
1372 void check_tx_key_helper(const crypto::hash &txid, const crypto::key_derivation &derivation, const std::vector<crypto::key_derivation> &additional_derivations, const cryptonote::account_public_address &address, uint64_t &received, bool &in_pool, uint64_t &confirmations);
1373 void check_tx_key_helper(const cryptonote::transaction &tx, const crypto::key_derivation &derivation, const std::vector<crypto::key_derivation> &additional_derivations, const cryptonote::account_public_address &address, uint64_t &received) const;
1374 bool is_out_to_acc(const cryptonote::account_public_address &address, const crypto::public_key& out_key, const crypto::key_derivation &derivation, const std::vector<crypto::key_derivation> &additional_derivations, const size_t output_index, const boost::optional<crypto::view_tag> &view_tag_opt, crypto::key_derivation &found_derivation) const;
1375 std::string get_tx_proof(const crypto::hash &txid, const cryptonote::account_public_address &address, bool is_subaddress, const std::string &message);
1376 std::string get_tx_proof(const cryptonote::transaction &tx, const crypto::secret_key &tx_key, const std::vector<crypto::secret_key> &additional_tx_keys, const cryptonote::account_public_address &address, bool is_subaddress, const std::string &message) const;
1377 bool check_tx_proof(const crypto::hash &txid, const cryptonote::account_public_address &address, bool is_subaddress, const std::string &message, const std::string &sig_str, uint64_t &received, bool &in_pool, uint64_t &confirmations);
1378 bool check_tx_proof(const cryptonote::transaction &tx, const cryptonote::account_public_address &address, bool is_subaddress, const std::string &message, const std::string &sig_str, uint64_t &received) const;
1379
1380 std::string get_spend_proof(const crypto::hash &txid, const std::string &message);
1381 bool check_spend_proof(const crypto::hash &txid, const std::string &message, const std::string &sig_str);
1382
1383 void scan_tx(const std::vector<crypto::hash> &txids);
1384
1392 std::string get_reserve_proof(const boost::optional<std::pair<uint32_t, uint64_t>> &account_minreserve, const std::string &message);
1402 bool check_reserve_proof(const cryptonote::account_public_address &address, const std::string &message, const std::string &sig_str, uint64_t &total, uint64_t &spent);
1403
1407 std::vector<address_book_row> get_address_book() const { return m_address_book; }
1408 bool add_address_book_row(const cryptonote::account_public_address &address, const crypto::hash8 *payment_id, const std::string &description, bool is_subaddress);
1409 bool set_address_book_row(size_t row_id, const cryptonote::account_public_address &address, const crypto::hash8 *payment_id, const std::string &description, bool is_subaddress);
1410 bool delete_address_book_row(std::size_t row_id);
1411
1412 uint64_t get_num_rct_outputs();
1413 size_t get_num_transfer_details() const { return m_transfers.size(); }
1414 const transfer_details &get_transfer_details(size_t idx) const;
1415
1416 uint8_t get_current_hard_fork();
1417 void get_hard_fork_info(uint8_t version, uint64_t &earliest_height);
1418 bool use_fork_rules(uint8_t version, int64_t early_blocks = 0);
1419 int get_fee_algorithm();
1420
1421 std::string get_wallet_file() const;
1422 std::string get_keys_file() const;
1423 std::string get_daemon_address() const;
1424 const boost::optional<epee::net_utils::http::login>& get_daemon_login() const { return m_daemon_login; }
1425 uint64_t get_daemon_blockchain_height(std::string& err);
1426 uint64_t get_daemon_blockchain_target_height(std::string& err);
1427 uint64_t get_daemon_adjusted_time();
1428
1432 uint64_t get_approximate_blockchain_height() const;
1433 uint64_t estimate_blockchain_height();
1434 std::vector<size_t> select_available_outputs_from_histogram(uint64_t count, bool atleast, bool unlocked, bool allow_rct);
1435 std::vector<size_t> select_available_outputs(const std::function<bool(const transfer_details &td)> &f);
1436 std::vector<size_t> select_available_unmixable_outputs();
1437 std::vector<size_t> select_available_mixable_outputs();
1438
1439 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;
1440 size_t pop_best_value(std::vector<size_t> &unused_dust_indices, const std::vector<size_t>& selected_transfers, bool smallest = false) const;
1441
1442 void set_tx_note(const crypto::hash &txid, const std::string &note);
1443 std::string get_tx_note(const crypto::hash &txid) const;
1444
1445 void set_tx_device_aux(const crypto::hash &txid, const std::string &aux);
1446 std::string get_tx_device_aux(const crypto::hash &txid) const;
1447
1448 void set_description(const std::string &description);
1449 std::string get_description() const;
1450
1455 const std::pair<serializable_map<std::string, std::string>, std::vector<std::string>>& get_account_tags();
1461 void set_account_tag(const std::set<uint32_t> &account_indices, const std::string& tag);
1467 void set_account_tag_description(const std::string& tag, const std::string& description);
1468
1469 enum message_signature_type_t { sign_with_spend_key, sign_with_view_key };
1470 std::string sign(const std::string &data, message_signature_type_t signature_type, cryptonote::subaddress_index index = {0, 0}) const;
1471 struct message_signature_result_t { bool valid; unsigned version; bool old; message_signature_type_t type; };
1472 message_signature_result_t verify(const std::string &data, const cryptonote::account_public_address &address, const std::string &signature) const;
1473
1480 std::string sign_multisig_participant(const std::string& data) const;
1488 bool verify_with_public_key(const std::string &data, const crypto::public_key &public_key, const std::string &signature) const;
1489
1490 // Import/Export wallet data
1491 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;
1492 std::string export_outputs_to_str(bool all = false, uint32_t start = 0, uint32_t count = 0xffffffff) const;
1493 size_t import_outputs(const std::tuple<uint64_t, uint64_t, std::vector<tools::wallet2::exported_transfer_details>> &outputs);
1494 size_t import_outputs(const std::tuple<uint64_t, uint64_t, std::vector<tools::wallet2::transfer_details>> &outputs);
1495 size_t import_outputs_from_str(const std::string &outputs_st);
1496 payment_container export_payments() const;
1497 void import_payments(const payment_container &payments);
1498 void import_payments_out(const std::list<std::pair<crypto::hash,wallet2::confirmed_transfer_details>> &confirmed_payments);
1499 std::tuple<size_t, crypto::hash, std::vector<crypto::hash>> export_blockchain() const;
1500 void import_blockchain(const std::tuple<size_t, crypto::hash, std::vector<crypto::hash>> &bc);
1501 bool export_key_images(const std::string &filename, bool all = false) const;
1502 std::pair<uint64_t, std::vector<std::pair<crypto::key_image, crypto::signature>>> export_key_images(bool all = false) const;
1503 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);
1504 uint64_t import_key_images(const std::string &filename, uint64_t &spent, uint64_t &unspent);
1505 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);
1506 bool import_key_images(signed_tx_set & signed_tx, size_t offset=0, bool only_selected_transfers=false);
1508
1509 void update_pool_state(std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> &process_txs, bool refreshed = false);
1510 void process_pool_state(const std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> &txs);
1511 void remove_obsolete_pool_txs(const std::vector<crypto::hash> &tx_hashes);
1512
1513 std::string encrypt(const char *plaintext, size_t len, const crypto::secret_key &skey, bool authenticated = true) const;
1514 std::string encrypt(const epee::span<char> &span, const crypto::secret_key &skey, bool authenticated = true) const;
1515 std::string encrypt(const std::string &plaintext, const crypto::secret_key &skey, bool authenticated = true) const;
1516 std::string encrypt(const epee::wipeable_string &plaintext, const crypto::secret_key &skey, bool authenticated = true) const;
1517 std::string encrypt_with_view_secret_key(const std::string &plaintext, bool authenticated = true) const;
1518 template<typename T=std::string> T decrypt(const std::string &ciphertext, const crypto::secret_key &skey, bool authenticated = true) const;
1519 std::string decrypt_with_view_secret_key(const std::string &ciphertext, bool authenticated = true) const;
1520
1521 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;
1522 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);
1523
1524 uint64_t get_blockchain_height_by_date(uint16_t year, uint8_t month, uint8_t day); // 1<=month<=12, 1<=day<=31
1525
1526 bool is_synced();
1527
1528 std::vector<std::pair<uint64_t, uint64_t>> estimate_backlog(const std::vector<std::pair<double, double>> &fee_levels);
1529 std::vector<std::pair<uint64_t, uint64_t>> estimate_backlog(uint64_t min_tx_weight, uint64_t max_tx_weight, const std::vector<uint64_t> &fees);
1530
1531 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) const;
1532 uint64_t get_fee_multiplier(uint32_t priority, int fee_algorithm = -1);
1533 uint64_t get_base_fee(uint32_t priority);
1534 uint64_t get_base_fee();
1535 uint64_t get_fee_quantization_mask();
1536 uint64_t get_min_ring_size();
1537 uint64_t get_max_ring_size();
1538 uint64_t adjust_mixin(uint64_t mixin);
1539
1540 uint32_t adjust_priority(uint32_t priority);
1541
1542 bool is_unattended() const { return m_unattended; }
1543
1544 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);
1545
1546 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);
1547 bool daemon_requires_payment();
1548 bool make_rpc_payment(uint32_t nonce, uint32_t cookie, uint64_t &credits, uint64_t &balance);
1549 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);
1550 template<typename T> void handle_payment_changes(const T &res, std::true_type) {
1552 m_rpc_payment_state.credits = res.credits;
1553 if (res.top_hash != m_rpc_payment_state.top_hash)
1554 {
1555 m_rpc_payment_state.top_hash = res.top_hash;
1556 m_rpc_payment_state.stale = true;
1557 }
1558 }
1559 template<typename T> void handle_payment_changes(const T &res, std::false_type) {}
1560
1561 // Light wallet specific functions
1562 // fetch unspent outs from lw node and store in m_transfers
1563 void light_wallet_get_unspent_outs();
1564 // fetch txs and store in m_payments
1565 void light_wallet_get_address_txs();
1566 // get_address_info
1567 bool light_wallet_get_address_info(tools::COMMAND_RPC_GET_ADDRESS_INFO::response &response);
1568 // Login. new_address is true if address hasn't been used on lw node before.
1569 bool light_wallet_login(bool &new_address);
1570 // Send an import request to lw node. returns info about import fee, address and payment_id
1571 bool light_wallet_import_wallet_request(tools::COMMAND_RPC_IMPORT_WALLET_REQUEST::response &response);
1572 // get random outputs from light wallet server
1573 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);
1574 // Parse rct string
1575 bool light_wallet_parse_rct_str(const std::string& rct_string, const crypto::public_key& tx_pub_key, uint64_t internal_output_index, rct::key& decrypted_mask, rct::key& rct_commit, bool decrypt) const;
1576 // check if key image is ours
1577 bool light_wallet_key_image_is_ours(const crypto::key_image& key_image, const crypto::public_key& tx_public_key, uint64_t out_index);
1578
1579 /*
1580 * "attributes" are a mechanism to store an arbitrary number of string values
1581 * on the level of the wallet as a whole, identified by keys. Their introduction,
1582 * technically the unordered map m_attributes stored as part of a wallet file,
1583 * led to a new wallet file version, but now new singular pieces of info may be added
1584 * without the need for a new version.
1585 *
1586 * The first and so far only value stored as such an attribute is the description.
1587 * It's stored under the standard key ATTRIBUTE_DESCRIPTION (see method set_description).
1588 *
1589 * The mechanism is open to all clients and allows them to use it for storing basically any
1590 * single string values in a wallet. To avoid the problem that different clients possibly
1591 * overwrite or misunderstand each other's attributes, a two-part key scheme is
1592 * proposed: <client name>.<value name>
1593 */
1594 const char* const ATTRIBUTE_DESCRIPTION = "wallet2.description";
1595 void set_attribute(const std::string &key, const std::string &value);
1596 bool get_attribute(const std::string &key, std::string &value) const;
1597
1598 crypto::public_key get_multisig_signer_public_key() const;
1599 crypto::public_key get_multisig_signing_public_key(size_t idx) const;
1600 crypto::public_key get_multisig_signing_public_key(const crypto::secret_key &skey) const;
1601
1602 template<class t_request, class t_response>
1603 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")
1604 {
1605 if (m_offline) return false;
1606 boost::lock_guard<boost::recursive_mutex> lock(m_daemon_rpc_mutex);
1607 return epee::net_utils::invoke_http_json(uri, req, res, *m_http_client, timeout, http_method);
1608 }
1609 template<class t_request, class t_response>
1610 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")
1611 {
1612 if (m_offline) return false;
1613 boost::lock_guard<boost::recursive_mutex> lock(m_daemon_rpc_mutex);
1614 return epee::net_utils::invoke_http_bin(uri, req, res, *m_http_client, timeout, http_method);
1615 }
1616 template<class t_request, class t_response>
1617 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")
1618 {
1619 if (m_offline) return false;
1620 boost::lock_guard<boost::recursive_mutex> lock(m_daemon_rpc_mutex);
1621 return epee::net_utils::invoke_http_json_rpc(uri, method_name, req, res, *m_http_client, timeout, http_method, req_id);
1622 }
1623
1624 bool set_ring_database(const std::string &filename);
1625 const std::string get_ring_database() const { return m_ring_database; }
1626 bool get_ring(const crypto::key_image &key_image, std::vector<uint64_t> &outs);
1627 bool get_rings(const crypto::hash &txid, std::vector<std::pair<crypto::key_image, std::vector<uint64_t>>> &outs);
1628 bool get_rings(const crypto::chacha_key &key, const std::vector<crypto::key_image> &key_images, std::vector<std::vector<uint64_t>> &outs);
1629 bool set_ring(const crypto::key_image &key_image, const std::vector<uint64_t> &outs, bool relative);
1630 bool set_rings(const std::vector<std::pair<crypto::key_image, std::vector<uint64_t>>> &rings, bool relative);
1631 bool unset_ring(const std::vector<crypto::key_image> &key_images);
1632 bool unset_ring(const crypto::hash &txid);
1633 bool find_and_save_rings(bool force = true);
1634
1635 bool blackball_output(const std::pair<uint64_t, uint64_t> &output);
1636 bool set_blackballed_outputs(const std::vector<std::pair<uint64_t, uint64_t>> &outputs, bool add = false);
1637 bool unblackball_output(const std::pair<uint64_t, uint64_t> &output);
1638 bool is_output_blackballed(const std::pair<uint64_t, uint64_t> &output) const;
1639
1640 void freeze(size_t idx);
1641 void thaw(size_t idx);
1642 bool frozen(size_t idx) const;
1643 void freeze(const crypto::key_image &ki);
1644 void thaw(const crypto::key_image &ki);
1645 bool frozen(const crypto::key_image &ki) const;
1646 bool frozen(const transfer_details &td) const;
1647
1648 bool save_to_file(const std::string& path_to_file, const std::string& binary, bool is_printable = false) const;
1649 static bool load_from_file(const std::string& path_to_file, std::string& target_str, size_t max_size = 1000000000);
1650
1651 uint64_t get_bytes_sent() const;
1652 uint64_t get_bytes_received() const;
1653
1654 // MMS -------------------------------------------------------------------------------------------------
1655 mms::message_store& get_message_store() { return m_message_store; };
1656 const mms::message_store& get_message_store() const { return m_message_store; };
1657 mms::multisig_wallet_state get_multisig_wallet_state() const;
1658
1659 bool lock_keys_file();
1660 bool unlock_keys_file();
1661 bool is_keys_file_locked() const;
1662
1663 void change_password(const std::string &filename, const epee::wipeable_string &original_password, const epee::wipeable_string &new_password);
1664
1665 void set_tx_notify(const std::shared_ptr<tools::Notify> &notify) { m_tx_notify = notify; }
1666
1667 bool is_tx_spendtime_unlocked(uint64_t unlock_time, uint64_t block_height);
1668 void hash_m_transfer(const transfer_details & transfer, crypto::hash &hash) const;
1669 uint64_t hash_m_transfers(boost::optional<uint64_t> transfer_height, crypto::hash &hash) const;
1670 void finish_rescan_bc_keep_key_images(uint64_t transfer_height, const crypto::hash &hash);
1671 void enable_dns(bool enable) { m_use_dns = enable; }
1672 void set_offline(bool offline = true);
1673 bool is_offline() const { return m_offline; }
1674
1675 uint64_t credits() const { return m_rpc_payment_state.credits; }
1676 void credit_report(uint64_t &expected_spent, uint64_t &discrepancy) const { expected_spent = m_rpc_payment_state.expected_spent; discrepancy = m_rpc_payment_state.discrepancy; }
1677
1678 static std::string get_default_daemon_address() { CRITICAL_REGION_LOCAL(default_daemon_address_lock); return default_daemon_address; }
1679
1680 private:
1688 bool store_keys(const std::string& keys_file_name, const epee::wipeable_string& password, bool watch_only = false);
1694 bool load_keys(const std::string& keys_file_name, const epee::wipeable_string& password);
1700 bool load_keys_buf(const std::string& keys_buf, const epee::wipeable_string& password);
1701 bool load_keys_buf(const std::string& keys_buf, const epee::wipeable_string& password, boost::optional<crypto::chacha_key>& keys_to_encrypt);
1702 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);
1703 bool should_skip_block(const cryptonote::block &b, uint64_t height) const;
1704 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::map<std::pair<uint64_t, uint64_t>, size_t> *output_tracker_cache = NULL);
1705 void detach_blockchain(uint64_t height, std::map<std::pair<uint64_t, uint64_t>, size_t> *output_tracker_cache = NULL);
1706 void get_short_chain_history(std::list<crypto::hash>& ids, uint64_t granularity = 1) const;
1707 bool clear();
1708 void clear_soft(bool keep_key_images=false);
1709 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, uint64_t &current_height);
1710 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);
1711 void fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, bool force = false);
1712 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 &last, bool &error, std::exception_ptr &exception);
1713 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);
1714 uint64_t select_transfers(uint64_t needed_money, std::vector<size_t> unused_transfers_indices, std::vector<size_t>& selected_transfers) const;
1715 bool prepare_file_names(const std::string& file_path);
1716 void process_unconfirmed(const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t height);
1717 void process_outgoing(const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t height, uint64_t ts, uint64_t spent, uint64_t received, uint32_t subaddr_account, const std::set<uint32_t>& subaddr_indices);
1718 void add_unconfirmed_tx(const cryptonote::transaction& tx, uint64_t amount_in, const std::vector<cryptonote::tx_destination_entry> &dests, const crypto::hash &payment_id, uint64_t change_amount, uint32_t subaddr_account, const std::set<uint32_t>& subaddr_indices);
1719 void generate_genesis(cryptonote::block& b) const;
1720 void check_genesis(const crypto::hash& genesis_hash) const; //throws
1721 bool generate_chacha_key_from_secret_keys(crypto::chacha_key &key) const;
1722 void generate_chacha_key_from_password(const epee::wipeable_string &pass, crypto::chacha_key &key) const;
1723 crypto::hash get_payment_id(const pending_tx &ptx) const;
1724 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;
1725 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;
1726 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;
1727 void parse_block_round(const cryptonote::blobdata &blob, cryptonote::block &bl, crypto::hash &bl_id, bool &error) const;
1728 uint64_t get_upper_transaction_weight_limit();
1729 std::vector<uint64_t> get_unspent_amounts_vector(bool strict);
1730 uint64_t get_dynamic_base_fee_estimate();
1731 float get_output_relatedness(const transfer_details &td0, const transfer_details &td1) const;
1732 std::vector<size_t> pick_preferred_rct_inputs(uint64_t needed_money, uint32_t subaddr_account, const std::set<uint32_t> &subaddr_indices);
1733 void set_spent(size_t idx, uint64_t height);
1734 void set_unspent(size_t idx);
1735 bool is_spent(const transfer_details &td, bool strict = true) const;
1736 bool is_spent(size_t idx, bool strict = true) const;
1737 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);
1738 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);
1739 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, std::unordered_set<crypto::public_key> &valid_public_keys_cache) const;
1740 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;
1741 std::vector<size_t> get_only_rct(const std::vector<size_t> &unused_dust_indices, const std::vector<size_t> &unused_transfers_indices) const;
1742 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_money_got_in_outs, std::vector<size_t> &outs, bool pool);
1743 void trim_hashchain();
1744 crypto::key_image get_multisig_composite_key_image(size_t n) const;
1745 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;
1746 rct::multisig_kLRki get_multisig_kLRki(size_t n, const rct::key &k) const;
1747 void get_multisig_k(size_t idx, const std::unordered_set<rct::key> &used_L, rct::key &nonce);
1748 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);
1749 bool add_rings(const crypto::chacha_key &key, const cryptonote::transaction_prefix &tx);
1750 bool add_rings(const cryptonote::transaction_prefix &tx);
1751 bool remove_rings(const cryptonote::transaction_prefix &tx);
1752 bool get_ring(const crypto::chacha_key &key, const crypto::key_image &key_image, std::vector<uint64_t> &outs);
1753 crypto::chacha_key get_ringdb_key();
1754 void setup_keys(const epee::wipeable_string &password);
1755 size_t get_transfer_details(const crypto::key_image &ki) const;
1756
1757 void register_devices();
1758 hw::device& lookup_device(const std::string & device_descriptor);
1759
1760 bool get_rct_distribution(uint64_t &start_height, std::vector<uint64_t> &distribution);
1761
1762 uint64_t get_segregation_fork_height() const;
1763
1764 void cache_tx_data(const cryptonote::transaction& tx, const crypto::hash &txid, tx_cache_data &tx_cache_data) const;
1765 std::shared_ptr<std::map<std::pair<uint64_t, uint64_t>, size_t>> create_output_tracker_cache() const;
1766
1767 void init_type(hw::device::device_type device_type);
1768 void setup_new_blockchain();
1769 void create_keys_file(const std::string &wallet_, bool watch_only, const epee::wipeable_string &password, bool create_address_file);
1770
1771 wallet_device_callback * get_device_callback();
1772 void on_device_button_request(uint64_t code);
1773 void on_device_button_pressed();
1774 boost::optional<epee::wipeable_string> on_device_pin_request();
1775 boost::optional<epee::wipeable_string> on_device_passphrase_request(bool & on_device);
1776 void on_device_progress(const hw::device_progress& event);
1777
1778 std::string get_rpc_status(const std::string &s) const;
1779 void throw_on_rpc_response_error(bool r, const epee::json_rpc::error &error, const std::string &status, const char *method) const;
1780
1781 std::string get_client_signature() const;
1782 void check_rpc_cost(const char *call, uint64_t post_call_credits, uint64_t pre_credits, double expected_cost);
1783
1784 bool should_expand(const cryptonote::subaddress_index &index) const;
1785 bool spends_one_of_ours(const cryptonote::transaction &tx) const;
1786
1788 boost::optional<epee::net_utils::http::login> m_daemon_login;
1789 std::string m_daemon_address;
1790 std::string m_wallet_file;
1791 std::string m_keys_file;
1792 std::string m_mms_file;
1793 const std::unique_ptr<epee::net_utils::http::abstract_http_client> m_http_client;
1801
1808 std::vector<std::vector<std::string>> m_subaddress_labels;
1811 std::vector<tools::wallet2::address_book_row> m_address_book;
1812 std::pair<serializable_map<std::string, std::string>, std::vector<std::string>> m_account_tags;
1813 uint64_t m_upper_transaction_weight_limit; //TODO: auto-calc this value or request from daemon, now use some fixed value
1814 const std::vector<std::vector<tools::wallet2::multisig_info>> *m_multisig_rescan_info;
1815 const std::vector<std::vector<rct::key>> *m_multisig_rescan_k;
1817
1818 std::atomic<bool> m_run;
1819
1820 boost::recursive_mutex m_daemon_rpc_mutex;
1821
1827 std::string seed_language;
1832 std::vector<crypto::public_key> m_multisig_signers;
1833 //in case of general M/N multisig wallet we should perform N - M + 1 key exchange rounds and remember how many rounds are passed.
1835 std::vector<crypto::public_key> m_multisig_derivations;
1845 // If m_refresh_from_block_height is explicitly set to zero we need this to differentiate it from the case that
1846 // m_refresh_from_block_height was defaulted to zero.*/
1872 std::unordered_set<crypto::hash> m_scanned_pool_txs[2];
1873 size_t m_subaddress_lookahead_major, m_subaddress_lookahead_minor;
1874 std::string m_device_name;
1885
1886 // Aux transaction data from device
1888
1889 // Light wallet
1890 bool m_light_wallet; /* sends view key to daemon for scanning */
1893 uint64_t m_light_wallet_per_kb_fee = FEE_PER_KB;
1897 // Light wallet info needed to populate m_payment requires 2 separate api calls (get_address_txs and get_unspent_outs)
1898 // We save the info from the first call in m_light_wallet_address_txs for easier lookup.
1899 std::unordered_map<crypto::hash, address_tx> m_light_wallet_address_txs;
1900 // store calculated key image for faster lookup
1902
1903 std::string m_ring_database;
1905 std::unique_ptr<ringdb> m_ringdb;
1906 boost::optional<crypto::chacha_key> m_ringdb_key;
1907
1909 std::unique_ptr<tools::file_locker> m_keys_file_locker;
1910
1915
1916 crypto::chacha_key m_cache_key;
1917 std::shared_ptr<wallet_keys_unlocker> m_encrypt_keys_after_refresh;
1918
1921
1922 std::shared_ptr<tools::Notify> m_tx_notify;
1923 std::unique_ptr<wallet_device_callback> m_device_callback;
1924
1927
1929
1930 static boost::mutex default_daemon_address_lock;
1931 static std::string default_daemon_address;
1932 };
1933}
1935BOOST_CLASS_VERSION(tools::wallet2::transfer_details, 12)
1936BOOST_CLASS_VERSION(tools::wallet2::multisig_info, 1)
1937BOOST_CLASS_VERSION(tools::wallet2::multisig_info::LR, 0)
1938BOOST_CLASS_VERSION(tools::wallet2::multisig_tx_set, 1)
1939BOOST_CLASS_VERSION(tools::wallet2::payment_details, 5)
1940BOOST_CLASS_VERSION(tools::wallet2::pool_payment_details, 1)
1941BOOST_CLASS_VERSION(tools::wallet2::unconfirmed_transfer_details, 8)
1942BOOST_CLASS_VERSION(tools::wallet2::confirmed_transfer_details, 6)
1943BOOST_CLASS_VERSION(tools::wallet2::address_book_row, 18)
1944BOOST_CLASS_VERSION(tools::wallet2::reserve_proof_entry, 0)
1946BOOST_CLASS_VERSION(tools::wallet2::signed_tx_set, 1)
1947BOOST_CLASS_VERSION(tools::wallet2::tx_construction_data, 4)
1948BOOST_CLASS_VERSION(tools::wallet2::pending_tx, 3)
1949BOOST_CLASS_VERSION(tools::wallet2::multisig_sig, 1)
1950
1951namespace boost
1952{
1953 namespace serialization
1954 {
1955 template<class Archive, class F, class S, class T>
1956 inline void serialize(
1957 Archive & ar,
1958 std::tuple<F, S, T> & t,
1959 const unsigned int /* file_version */
1960 ){
1961 ar & boost::serialization::make_nvp("f", std::get<0>(t));
1962 ar & boost::serialization::make_nvp("s", std::get<1>(t));
1963 ar & boost::serialization::make_nvp("t", std::get<2>(t));
1964 }
1965
1966 template <class Archive>
1967 inline typename 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)
1968 {
1969 }
1970 template <class Archive>
1971 inline typename 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)
1972 {
1973 if (ver < 1)
1974 {
1975 x.m_mask = rct::identity();
1976 x.m_amount = x.m_tx.vout[x.m_internal_output_index].amount;
1977 }
1978 if (ver < 2)
1979 {
1980 x.m_spent_height = 0;
1981 }
1982 if (ver < 4)
1983 {
1984 x.m_rct = x.m_tx.vout[x.m_internal_output_index].amount == 0;
1985 }
1986 if (ver < 6)
1987 {
1988 x.m_key_image_known = true;
1989 }
1990 if (ver < 7)
1991 {
1992 x.m_pk_index = 0;
1993 }
1994 if (ver < 8)
1995 {
1996 x.m_subaddr_index = {};
1997 }
1998 if (ver < 9)
1999 {
2000 x.m_key_image_partial = false;
2001 x.m_multisig_k.clear();
2002 x.m_multisig_info.clear();
2003 }
2004 if (ver < 10)
2005 {
2006 x.m_key_image_request = false;
2007 }
2008 if (ver < 12)
2009 {
2010 x.m_frozen = false;
2011 }
2012 }
2013
2014 template <class Archive>
2015 inline void serialize(Archive &a, tools::wallet2::transfer_details &x, const boost::serialization::version_type ver)
2016 {
2017 a & x.m_block_height;
2020 if (ver < 3)
2021 {
2023 a & tx;
2026 }
2027 else
2028 {
2029 a & x.m_tx;
2030 }
2031 a & x.m_spent;
2032 a & x.m_key_image;
2033 if (ver < 1)
2034 {
2035 // ensure mask and amount are set
2037 return;
2038 }
2039 a & x.m_mask;
2040 a & x.m_amount;
2041 if (ver < 2)
2042 {
2044 return;
2045 }
2046 a & x.m_spent_height;
2047 if (ver < 3)
2048 {
2050 return;
2051 }
2052 a & x.m_txid;
2053 if (ver < 4)
2054 {
2056 return;
2057 }
2058 a & x.m_rct;
2059 if (ver < 5)
2060 {
2062 return;
2063 }
2064 if (ver < 6)
2065 {
2066 // v5 did not properly initialize
2067 uint8_t u;
2068 a & u;
2069 x.m_key_image_known = true;
2070 return;
2071 }
2072 a & x.m_key_image_known;
2073 if (ver < 7)
2074 {
2076 return;
2077 }
2078 a & x.m_pk_index;
2079 if (ver < 8)
2080 {
2082 return;
2083 }
2084 a & x.m_subaddr_index;
2085 if (ver < 9)
2086 {
2088 return;
2089 }
2090 a & x.m_multisig_info;
2091 a & x.m_multisig_k;
2093 if (ver < 10)
2094 {
2096 return;
2097 }
2099 if (ver < 11)
2100 {
2102 return;
2103 }
2104 a & x.m_uses;
2105 if (ver < 12)
2106 {
2108 return;
2109 }
2110 a & x.m_frozen;
2111 }
2112
2113 template <class Archive>
2114 inline void serialize(Archive &a, tools::wallet2::multisig_info::LR &x, const boost::serialization::version_type ver)
2115 {
2116 a & x.m_L;
2117 a & x.m_R;
2118 }
2119
2120 template <class Archive>
2121 inline void serialize(Archive &a, tools::wallet2::multisig_info &x, const boost::serialization::version_type ver)
2122 {
2123 a & x.m_signer;
2124 a & x.m_LR;
2126 }
2127
2128 template <class Archive>
2129 inline void serialize(Archive &a, tools::wallet2::multisig_tx_set &x, const boost::serialization::version_type ver)
2130 {
2131 a & x.m_ptx;
2132 a & x.m_signers;
2133 }
2134
2135 template <class Archive>
2136 inline void serialize(Archive &a, tools::wallet2::unconfirmed_transfer_details &x, const boost::serialization::version_type ver)
2137 {
2138 a & x.m_change;
2139 a & x.m_sent_time;
2140 if (ver < 5)
2141 {
2143 a & tx;
2145 }
2146 else
2147 {
2148 a & x.m_tx;
2149 }
2150 if (ver < 1)
2151 return;
2152 a & x.m_dests;
2153 a & x.m_payment_id;
2154 if (ver < 2)
2155 return;
2156 a & x.m_state;
2157 if (ver < 3)
2158 return;
2159 a & x.m_timestamp;
2160 if (ver < 4)
2161 return;
2162 a & x.m_amount_in;
2163 a & x.m_amount_out;
2164 if (ver < 6)
2165 {
2166 // v<6 may not have change accumulated in m_amount_out, which is a pain,
2167 // as it's readily understood to be sum of outputs.
2168 // We convert it to include change from v6
2169 if (!typename Archive::is_saving() && x.m_change != (uint64_t)-1)
2170 x.m_amount_out += x.m_change;
2171 }
2172 if (ver < 7)
2173 {
2174 x.m_subaddr_account = 0;
2175 return;
2176 }
2177 a & x.m_subaddr_account;
2178 a & x.m_subaddr_indices;
2179 if (ver < 8)
2180 return;
2181 a & x.m_rings;
2182 }
2183
2184 template <class Archive>
2185 inline void serialize(Archive &a, tools::wallet2::confirmed_transfer_details &x, const boost::serialization::version_type ver)
2186 {
2187 a & x.m_amount_in;
2188 a & x.m_amount_out;
2189 a & x.m_change;
2190 a & x.m_block_height;
2191 if (ver < 1)
2192 return;
2193 a & x.m_dests;
2194 a & x.m_payment_id;
2195 if (ver < 2)
2196 return;
2197 a & x.m_timestamp;
2198 if (ver < 3)
2199 {
2200 // v<3 may not have change accumulated in m_amount_out, which is a pain,
2201 // as it's readily understood to be sum of outputs. Whether it got added
2202 // or not depends on whether it came from a unconfirmed_transfer_details
2203 // (not included) or not (included). We can't reliably tell here, so we
2204 // check whether either yields a "negative" fee, or use the other if so.
2205 // We convert it to include change from v3
2206 if (!typename Archive::is_saving() && x.m_change != (uint64_t)-1)
2207 {
2208 if (x.m_amount_in > (x.m_amount_out + x.m_change))
2209 x.m_amount_out += x.m_change;
2210 }
2211 }
2212 if (ver < 4)
2213 {
2214 if (!typename Archive::is_saving())
2215 x.m_unlock_time = 0;
2216 return;
2217 }
2218 a & x.m_unlock_time;
2219 if (ver < 5)
2220 {
2221 x.m_subaddr_account = 0;
2222 return;
2223 }
2224 a & x.m_subaddr_account;
2225 a & x.m_subaddr_indices;
2226 if (ver < 6)
2227 return;
2228 a & x.m_rings;
2229 }
2230
2231 template <class Archive>
2232 inline void serialize(Archive& a, tools::wallet2::payment_details& x, const boost::serialization::version_type ver)
2233 {
2234 a & x.m_tx_hash;
2235 a & x.m_amount;
2236 a & x.m_block_height;
2237 a & x.m_unlock_time;
2238 if (ver < 1)
2239 return;
2240 a & x.m_timestamp;
2241 if (ver < 2)
2242 {
2243 x.m_coinbase = false;
2244 x.m_subaddr_index = {};
2245 return;
2246 }
2247 a & x.m_subaddr_index;
2248 if (ver < 3)
2249 {
2250 x.m_coinbase = false;
2251 x.m_fee = 0;
2252 return;
2253 }
2254 a & x.m_fee;
2255 if (ver < 4)
2256 {
2257 x.m_coinbase = false;
2258 return;
2259 }
2260 a & x.m_coinbase;
2261 if (ver < 5)
2262 return;
2263 a & x.m_amounts;
2264 }
2265
2266 template <class Archive>
2267 inline void serialize(Archive& a, tools::wallet2::pool_payment_details& x, const boost::serialization::version_type ver)
2268 {
2269 a & x.m_pd;
2271 }
2272
2273 template <class Archive>
2274 inline void serialize(Archive& a, tools::wallet2::address_book_row& x, const boost::serialization::version_type ver)
2275 {
2276 a & x.m_address;
2277 if (ver < 18)
2278 {
2279 crypto::hash payment_id;
2280 a & payment_id;
2281 x.m_has_payment_id = !(payment_id == crypto::null_hash);
2282 if (x.m_has_payment_id)
2283 {
2284 bool is_long = false;
2285 for (int i = 8; i < 32; ++i)
2286 is_long |= payment_id.data[i];
2287 if (is_long)
2288 {
2289 MWARNING("Long payment ID ignored on address book load");
2291 x.m_has_payment_id = false;
2292 }
2293 else
2294 memcpy(x.m_payment_id.data, payment_id.data, 8);
2295 }
2296 }
2297 a & x.m_description;
2298 if (ver < 17)
2299 {
2300 x.m_is_subaddress = false;
2301 return;
2302 }
2303 a & x.m_is_subaddress;
2304 if (ver < 18)
2305 return;
2306 a & x.m_has_payment_id;
2307 if (x.m_has_payment_id)
2308 a & x.m_payment_id;
2309 }
2310
2311 template <class Archive>
2312 inline void serialize(Archive& a, tools::wallet2::reserve_proof_entry& x, const boost::serialization::version_type ver)
2313 {
2314 a & x.txid;
2315 a & x.index_in_tx;
2316 a & x.shared_secret;
2317 a & x.key_image;
2318 a & x.shared_secret_sig;
2319 a & x.key_image_sig;
2320 }
2321
2322 template <class Archive>
2323 inline void serialize(Archive &a, tools::wallet2::unsigned_tx_set &x, const boost::serialization::version_type ver)
2324 {
2325 a & x.txes;
2326 if (ver == 0)
2327 {
2328 // load old version
2329 std::pair<size_t, tools::wallet2::transfer_container> old_transfers;
2330 a & old_transfers;
2331 std::get<0>(x.transfers) = std::get<0>(old_transfers);
2332 std::get<1>(x.transfers) = std::get<0>(old_transfers) + std::get<1>(old_transfers).size();
2333 std::get<2>(x.transfers) = std::get<1>(old_transfers);
2334 return;
2335 }
2336 throw std::runtime_error("Boost serialization not supported for newest unsigned_tx_set");
2337 }
2338
2339 template <class Archive>
2340 inline void serialize(Archive &a, tools::wallet2::signed_tx_set &x, const boost::serialization::version_type ver)
2341 {
2342 a & x.ptx;
2343 a & x.key_images;
2344 if (ver < 1)
2345 return;
2346 a & x.tx_key_images.parent();
2347 }
2348
2349 template <class Archive>
2350 inline void serialize(Archive &a, tools::wallet2::tx_construction_data &x, const boost::serialization::version_type ver)
2351 {
2352 a & x.sources;
2353 a & x.change_dts;
2354 a & x.splitted_dsts;
2355 if (ver < 2)
2356 {
2357 // load list to vector
2358 std::list<size_t> selected_transfers;
2359 a & selected_transfers;
2360 x.selected_transfers.clear();
2361 x.selected_transfers.reserve(selected_transfers.size());
2362 for (size_t t: selected_transfers)
2363 x.selected_transfers.push_back(t);
2364 }
2365 a & x.extra;
2366 a & x.unlock_time;
2367 a & x.use_rct;
2368 a & x.dests;
2369 if (ver < 1)
2370 {
2371 x.subaddr_account = 0;
2372 return;
2373 }
2374 a & x.subaddr_account;
2375 a & x.subaddr_indices;
2376 if (ver < 2)
2377 {
2378 if (!typename Archive::is_saving())
2380 return;
2381 }
2383 if (ver < 3)
2384 {
2385 if (!typename Archive::is_saving())
2387 return;
2388 }
2389 if (ver < 4)
2390 {
2391 bool use_bulletproofs = x.rct_config.range_proof_type != rct::RangeProofBorromean;
2392 a & use_bulletproofs;
2393 if (!typename Archive::is_saving())
2394 x.rct_config = { use_bulletproofs ? rct::RangeProofBulletproof : rct::RangeProofBorromean, 0 };
2395 return;
2396 }
2397 a & x.rct_config;
2398 }
2399
2400 template <class Archive>
2401 inline void serialize(Archive &a, tools::wallet2::multisig_sig &x, const boost::serialization::version_type ver)
2402 {
2403 a & x.sigs;
2404 a & x.ignore;
2405 a & x.used_L;
2406 a & x.signing_keys;
2407 a & x.msout;
2408 if (ver < 1)
2409 return;
2410 a & x.total_alpha_G;
2411 a & x.total_alpha_H;
2412 a & x.c_0;
2413 a & x.s;
2414 }
2415
2416 template <class Archive>
2417 inline void serialize(Archive &a, tools::wallet2::pending_tx &x, const boost::serialization::version_type ver)
2418 {
2419 a & x.tx;
2420 a & x.dust;
2421 a & x.fee;
2422 a & x.dust_added_to_fee;
2423 a & x.change_dts;
2424 if (ver < 2)
2425 {
2426 // load list to vector
2427 std::list<size_t> selected_transfers;
2428 a & selected_transfers;
2429 x.selected_transfers.clear();
2430 x.selected_transfers.reserve(selected_transfers.size());
2431 for (size_t t: selected_transfers)
2432 x.selected_transfers.push_back(t);
2433 }
2434 a & x.key_images;
2435 a & x.tx_key;
2436 a & x.dests;
2437 a & x.construction_data;
2438 if (ver < 1)
2439 return;
2441 if (ver < 2)
2442 return;
2444 if (ver < 3)
2445 return;
2446 a & x.multisig_sigs;
2447 }
2448 }
2449}
2450
2451namespace tools
2452{
2453
2454 namespace detail
2455 {
2456 //----------------------------------------------------------------------------------------------------
2457 inline void digit_split_strategy(const std::vector<cryptonote::tx_destination_entry>& dsts,
2458 const cryptonote::tx_destination_entry& change_dst, uint64_t dust_threshold,
2459 std::vector<cryptonote::tx_destination_entry>& splitted_dsts, std::vector<cryptonote::tx_destination_entry> &dust_dsts)
2460 {
2461 splitted_dsts.clear();
2462 dust_dsts.clear();
2463
2464 for(auto& de: dsts)
2465 {
2467 [&](uint64_t chunk) { splitted_dsts.push_back(cryptonote::tx_destination_entry(chunk, de.addr, de.is_subaddress)); },
2468 [&](uint64_t a_dust) { splitted_dsts.push_back(cryptonote::tx_destination_entry(a_dust, de.addr, de.is_subaddress)); } );
2469 }
2470
2472 [&](uint64_t chunk) {
2473 if (chunk <= dust_threshold)
2474 dust_dsts.push_back(cryptonote::tx_destination_entry(chunk, change_dst.addr, false));
2475 else
2476 splitted_dsts.push_back(cryptonote::tx_destination_entry(chunk, change_dst.addr, false));
2477 },
2478 [&](uint64_t a_dust) { dust_dsts.push_back(cryptonote::tx_destination_entry(a_dust, change_dst.addr, false)); } );
2479 }
2480 //----------------------------------------------------------------------------------------------------
2481 inline void null_split_strategy(const std::vector<cryptonote::tx_destination_entry>& dsts,
2482 const cryptonote::tx_destination_entry& change_dst, uint64_t dust_threshold,
2483 std::vector<cryptonote::tx_destination_entry>& splitted_dsts, std::vector<cryptonote::tx_destination_entry> &dust_dsts)
2484 {
2485 splitted_dsts = dsts;
2486
2487 dust_dsts.clear();
2488 uint64_t change = change_dst.amount;
2489
2490 if (0 != change)
2491 {
2492 splitted_dsts.push_back(cryptonote::tx_destination_entry(change, change_dst.addr, false));
2493 }
2494 }
2495 //----------------------------------------------------------------------------------------------------
2497 {
2498 std::string indexes;
2499 std::for_each(src.outputs.begin(), src.outputs.end(), [&](const cryptonote::tx_source_entry::output_entry& s_e) { indexes += boost::to_string(s_e.first) + " "; });
2500 LOG_PRINT_L0("amount=" << cryptonote::print_money(src.amount) << ", real_output=" <<src.real_output << ", real_output_in_tx_index=" << src.real_output_in_tx_index << ", indexes: " << indexes);
2501 }
2502 //----------------------------------------------------------------------------------------------------
2503 }
2504 //----------------------------------------------------------------------------------------------------
2505}
#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
Definition: account.h:74
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
Definition: net_ssl.h:76
Non-owning sequence of data. Does not deep copy.
Definition: span.h:55
Definition: wipeable_string.h:41
Definition: device.hpp:71
Definition: device.hpp:87
device_type
Definition: device.hpp:104
@ SOFTWARE
Definition: device.hpp:105
Definition: device.hpp:77
Definition: message_store.h:268
Definition: http.h:46
Definition: containers.h:49
std::unordered_map< K, V > & parent()
Definition: containers.h:52
Definition: containers.h:71
Definition: node_rpc_proxy.h:43
Definition: wallet2.h:99
const std::vector< uint64_t > & rct_offsets
Definition: wallet2.h:116
uint64_t num_rct_outputs
Definition: wallet2.h:118
double average_output_time
Definition: wallet2.h:119
const uint64_t * end
Definition: wallet2.h:117
std::gamma_distribution< double > gamma
Definition: wallet2.h:115
struct tools::gamma_picker::gamma_engine engine
const uint64_t * begin
Definition: wallet2.h:117
uint64_t pick()
Definition: wallet2.cpp:1016
Definition: wallet2.h:190
void crop(size_t height)
Definition: wallet2.h:201
crypto::hash & operator[](size_t idx)
Definition: wallet2.h:200
void clear()
Definition: wallet2.h:202
bool is_in_bounds(size_t idx) const
Definition: wallet2.h:198
size_t offset() const
Definition: wallet2.h:195
size_t m_offset
Definition: wallet2.h:223
void trim(size_t height)
Definition: wallet2.h:204
void push_back(const crypto::hash &hash)
Definition: wallet2.h:197
bool empty() const
Definition: wallet2.h:203
const crypto::hash & operator[](size_t idx) const
Definition: wallet2.h:199
hashchain()
Definition: wallet2.h:192
void serialize(t_archive &a, const unsigned int ver)
Definition: wallet2.h:208
void refill(const crypto::hash &hash)
Definition: wallet2.h:205
crypto::hash m_genesis
Definition: wallet2.h:224
std::deque< crypto::hash > m_blockchain
Definition: wallet2.h:225
size_t size() const
Definition: wallet2.h:194
const crypto::hash & genesis() const
Definition: wallet2.h:196
Definition: wallet2.h:137
virtual boost::optional< epee::wipeable_string > on_device_passphrase_request(bool &on_device)
Definition: wallet2.h:155
virtual void on_money_spent(uint64_t height, const crypto::hash &txid, const cryptonote::transaction &in_tx, uint64_t amount, const cryptonote::transaction &spend_tx, const cryptonote::subaddress_index &subaddr_index)
Definition: wallet2.h:143
virtual boost::optional< epee::wipeable_string > on_device_pin_request()
Definition: wallet2.h:154
virtual void on_device_button_pressed()
Definition: wallet2.h:153
virtual boost::optional< epee::wipeable_string > on_get_password(const char *reason)
Definition: wallet2.h:145
virtual void on_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction &tx, uint64_t amount, uint64_t burnt, const cryptonote::subaddress_index &subaddr_index, bool is_change, uint64_t unlock_time)
Definition: wallet2.h:141
virtual void on_pool_tx_removed(const crypto::hash &txid)
Definition: wallet2.h:158
virtual void on_lw_unconfirmed_money_received(uint64_t height, const crypto::hash &txid, uint64_t amount)
Definition: wallet2.h:149
virtual void on_device_button_request(uint64_t code)
Definition: wallet2.h:152
virtual void on_lw_money_spent(uint64_t height, const crypto::hash &txid, uint64_t amount)
Definition: wallet2.h:150
virtual void on_unconfirmed_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction &tx, uint64_t amount, const cryptonote::subaddress_index &subaddr_index)
Definition: wallet2.h:142
virtual void on_new_block(uint64_t height, const cryptonote::block &block)
Definition: wallet2.h:140
virtual ~i_wallet2_callback()
Definition: wallet2.h:159
virtual void on_skip_transaction(uint64_t height, const crypto::hash &txid, const cryptonote::transaction &tx)
Definition: wallet2.h:144
virtual void on_lw_money_received(uint64_t height, const crypto::hash &txid, uint64_t amount)
Definition: wallet2.h:148
virtual void on_lw_new_block(uint64_t height)
Definition: wallet2.h:147
virtual void on_device_progress(const hw::device_progress &event)
Definition: wallet2.h:156
Definition: password.h:41
Definition: wallet2.h:230
uint64_t m_segregation_height
Definition: wallet2.h:1860
transfer_container m_transfers
Definition: wallet2.h:1802
bool m_confirm_non_default_ring_size
Definition: wallet2.h:1848
BackgroundMiningSetupType m_setup_background_mining
Definition: wallet2.h:1867
const mms::message_store & get_message_store() const
Definition: wallet2.h:1656
void allow_mismatched_daemon_version(bool allow_mismatch)
Definition: wallet2.h:1366
cryptonote::account_base m_account
Definition: wallet2.h:1787
void load_deprecated_formats(bool load)
Definition: wallet2.h:1354
NodeRPCProxy m_node_rpc_proxy
Definition: wallet2.h:1871
uint32_t get_confirm_backlog_threshold() const
Definition: wallet2.h:1320
void max_reorg_depth(uint64_t depth)
Definition: wallet2.h:955
bool segregate_pre_fork_outputs() const
Definition: wallet2.h:1325
void auto_mine_for_rpc_payment_threshold(float threshold)
Definition: wallet2.h:1357
void auto_refresh(bool r)
Definition: wallet2.h:1308
void key_reuse_mitigation2(bool value)
Definition: wallet2.h:1328
void ignore_outputs_below(uint64_t value)
Definition: wallet2.h:1338
bool m_merge_destinations
Definition: wallet2.h:1853
bool is_unattended() const
Definition: wallet2.h:1542
const std::vector< std::vector< rct::key > > * m_multisig_rescan_k
Definition: wallet2.h:1815
bool m_explicit_refresh_from_block_height
Definition: wallet2.h:1847
bool watch_only() const
Definition: wallet2.h:1033
boost::optional< epee::net_utils::http::login > m_daemon_login
Definition: wallet2.h:1788
std::string m_device_derivation_path
Definition: wallet2.h:1875
boost::optional< crypto::chacha_key > m_ringdb_key
Definition: wallet2.h:1906
void set_rpc_client_secret_key(const crypto::secret_key &key)
Definition: wallet2.h:1360
void set_trusted_daemon(bool trusted)
Definition: wallet2.h:976
bool m_confirm_backlog
Definition: wallet2.h:1854
bool merge_destinations() const
Definition: wallet2.h:1316
void always_confirm_transfers(bool always)
Definition: wallet2.h:1298
void inactivity_lock_timeout(uint32_t seconds)
Definition: wallet2.h:1346
bool load_deprecated_formats() const
Definition: wallet2.h:1353
const std::vector< std::vector< tools::wallet2::multisig_info > > * m_multisig_rescan_info
Definition: wallet2.h:1814
bool m_original_keys_available
Definition: wallet2.h:1912
void default_mixin(uint32_t m)
Definition: wallet2.h:1304
serializable_unordered_map< std::string, std::string > m_attributes
Definition: wallet2.h:1810
hw::device::device_type m_key_device_type
Definition: wallet2.h:1824
const boost::optional< epee::net_utils::http::login > & get_daemon_login() const
Definition: wallet2.h:1424
uint64_t m_last_block_reward
Definition: wallet2.h:1908
void track_uses(bool value)
Definition: wallet2.h:1340
void set_default_priority(uint32_t p)
Definition: wallet2.h:1306
std::string seed_language
Definition: wallet2.h:1827
bool m_ignore_fractional_outputs
Definition: wallet2.h:1861
bool m_print_ring_members
Definition: wallet2.h:1837
void enable_dns(bool enable)
Definition: wallet2.h:1671
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")
Definition: wallet2.h:1603
void callback(i_wallet2_callback *callback)
Definition: wallet2.h:973
serializable_unordered_map< crypto::public_key, size_t > m_pub_keys
Definition: wallet2.h:1805
void merge_destinations(bool merge)
Definition: wallet2.h:1315
uint32_t m_multisig_rounds_passed
Definition: wallet2.h:1834
void set_tx_notify(const std::shared_ptr< tools::Notify > &notify)
Definition: wallet2.h:1665
std::vector< tools::wallet2::address_book_row > m_address_book
Definition: wallet2.h:1811
bool m_load_deprecated_formats
Definition: wallet2.h:1926
bool m_track_uses
Definition: wallet2.h:1864
uint64_t m_light_wallet_unlocked_balance
Definition: wallet2.h:1896
bool m_key_reuse_mitigation2
Definition: wallet2.h:1859
uint32_t m_multisig_threshold
Definition: wallet2.h:1831
std::atomic< bool > m_run
Definition: wallet2.h:1818
uint64_t get_min_output_value() const
Definition: wallet2.h:1314
uint32_t m_min_output_count
Definition: wallet2.h:1851
void explicit_refresh_from_block_height(bool expl)
Definition: wallet2.h:952
serializable_unordered_map< crypto::public_key, serializable_map< uint64_t, crypto::key_image > > m_key_image_cache
Definition: wallet2.h:1901
uint64_t segregation_height() const
Definition: wallet2.h:1329
uint64_t m_ignore_outputs_above
Definition: wallet2.h:1862
bool ignore_fractional_outputs() const
Definition: wallet2.h:1331
message_signature_type_t
Definition: wallet2.h:1469
void set_export_format(const ExportFormat &export_format)
Definition: wallet2.h:1352
uint64_t m_device_last_key_image_sync
Definition: wallet2.h:1876
std::pair< serializable_map< std::string, std::string >, std::vector< std::string > > m_account_tags
Definition: wallet2.h:1812
void ask_password(AskPasswordType ask)
Definition: wallet2.h:1310
bool m_unattended
Definition: wallet2.h:1919
BackgroundMiningSetupType setup_background_mining() const
Definition: wallet2.h:1343
serializable_unordered_map< crypto::hash, std::vector< crypto::secret_key > > m_additional_tx_keys
Definition: wallet2.h:1800
crypto::secret_key m_original_view_secret_key
Definition: wallet2.h:1914
uint64_t m_ignore_outputs_below
Definition: wallet2.h:1863
serializable_unordered_map< crypto::hash, crypto::secret_key > m_tx_keys
Definition: wallet2.h:1798
std::tuple< uint64_t, crypto::public_key, rct::key > get_outs_entry
Definition: wallet2.h:792
std::string m_daemon_address
Definition: wallet2.h:1789
size_t get_num_subaddress_accounts() const
Definition: wallet2.h:1011
std::string m_wallet_file
Definition: wallet2.h:1790
payment_container m_payments
Definition: wallet2.h:1803
serializable_unordered_map< crypto::hash, std::string > m_tx_notes
Definition: wallet2.h:1809
hashchain m_blockchain
Definition: wallet2.h:1794
void device_name(const std::string &device_name)
Definition: wallet2.h:1348
void ignore_outputs_above(uint64_t value)
Definition: wallet2.h:1336
const std::string & device_derivation_path() const
Definition: wallet2.h:1349
bool confirm_backlog() const
Definition: wallet2.h:1317
bool m_segregate_pre_fork_outputs
Definition: wallet2.h:1858
static std::string get_default_daemon_address()
Definition: wallet2.h:1678
AskPasswordType
Definition: wallet2.h:245
bool m_allow_mismatched_daemon_version
Definition: wallet2.h:1884
void set_min_output_count(uint32_t count)
Definition: wallet2.h:1311
cryptonote::account_base & get_account()
Definition: wallet2.h:941
void setup_background_mining(BackgroundMiningSetupType value)
Definition: wallet2.h:1344
const cryptonote::account_base & get_account() const
Definition: wallet2.h:942
uint64_t m_credits_target
Definition: wallet2.h:1882
std::string m_device_name
Definition: wallet2.h:1874
bool confirm_non_default_ring_size() const
Definition: wallet2.h:1333
void show_wallet_name_when_locked(bool value)
Definition: wallet2.h:1342
std::vector< std::vector< std::string > > m_subaddress_labels
Definition: wallet2.h:1808
void set_light_wallet(bool light_wallet)
Definition: wallet2.h:988
static std::string default_daemon_address
Definition: wallet2.h:1931
std::pair< size_t, size_t > get_subaddress_lookahead() const
Definition: wallet2.h:1019
size_t get_num_transfer_details() const
Definition: wallet2.h:1413
uint64_t ignore_outputs_above() const
Definition: wallet2.h:1335
bool m_light_wallet_connected
Definition: wallet2.h:1894
cryptonote::account_public_address m_original_address
Definition: wallet2.h:1913
void set_refresh_from_block_height(uint64_t height)
Definition: wallet2.h:949
bool persistent_rpc_client_id() const
Definition: wallet2.h:1355
bool print_ring_members() const
Definition: wallet2.h:1299
cryptonote::account_public_address m_account_public_address
Definition: wallet2.h:1806
uint64_t m_kdf_rounds
Definition: wallet2.h:1826
crypto::secret_key m_rpc_client_secret_key
Definition: wallet2.h:1880
std::shared_ptr< tools::Notify > m_tx_notify
Definition: wallet2.h:1922
void handle_payment_changes(const T &res, std::true_type)
Definition: wallet2.h:1550
AskPasswordType ask_password() const
Definition: wallet2.h:1309
uint64_t m_light_wallet_scanned_block_height
Definition: wallet2.h:1891
uint64_t m_light_wallet_blockchain_height
Definition: wallet2.h:1892
void device_derivation_path(const std::string &device_derivation_path)
Definition: wallet2.h:1350
bool is_multisig_enabled() const
Definition: wallet2.h:1363
std::vector< transfer_details > transfer_container
Definition: wallet2.h:598
bool m_enable_multisig
Definition: wallet2.h:1883
void confirm_non_default_ring_size(bool always)
Definition: wallet2.h:1334
uint64_t get_light_wallet_blockchain_height() const
Definition: wallet2.h:990
std::shared_ptr< wallet_keys_unlocker > m_encrypt_keys_after_refresh
Definition: wallet2.h:1917
bool m_is_initialized
Definition: wallet2.h:1870
bool track_uses() const
Definition: wallet2.h:1339
std::string m_ring_database
Definition: wallet2.h:1903
boost::recursive_mutex m_daemon_rpc_mutex
Definition: wallet2.h:1820
bool is_old_file_format
Definition: wallet2.h:1828
void credits_target(uint64_t threshold)
Definition: wallet2.h:1362
bool m_multisig
Definition: wallet2.h:1830
std::unique_ptr< tools::file_locker > m_keys_file_locker
Definition: wallet2.h:1909
std::unique_ptr< ringdb > m_ringdb
Definition: wallet2.h:1905
bool show_wallet_name_when_locked() const
Definition: wallet2.h:1341
uint64_t get_last_block_reward() const
Definition: wallet2.h:1113
RefreshType
Definition: wallet2.h:238
@ RefreshFull
Definition: wallet2.h:239
@ RefreshOptimizeCoinbase
Definition: wallet2.h:240
@ RefreshNoCoinbase
Definition: wallet2.h:241
cryptonote::checkpoints m_checkpoints
Definition: wallet2.h:1799
void confirm_backlog(bool always)
Definition: wallet2.h:1318
void stop()
Definition: wallet2.h:970
void set_refresh_type(RefreshType refresh_type)
Definition: wallet2.h:1029
serializable_unordered_multimap< crypto::hash, pool_payment_details > m_unconfirmed_payments
Definition: wallet2.h:1797
bool m_show_wallet_name_when_locked
Definition: wallet2.h:1865
const std::string get_ring_database() const
Definition: wallet2.h:1625
RefreshType m_refresh_type
Definition: wallet2.h:1841
uint64_t ignore_outputs_below() const
Definition: wallet2.h:1337
bool m_trusted_daemon
Definition: wallet2.h:1822
uint32_t m_default_mixin
Definition: wallet2.h:1839
bool key_reuse_mitigation2() const
Definition: wallet2.h:1327
uint64_t credits() const
Definition: wallet2.h:1675
bool m_offline
Definition: wallet2.h:1878
std::unique_ptr< wallet_device_callback > m_device_callback
Definition: wallet2.h:1923
uint64_t m_min_output_value
Definition: wallet2.h:1852
void persistent_rpc_client_id(bool persistent)
Definition: wallet2.h:1356
void auto_low_priority(bool value)
Definition: wallet2.h:1324
const std::unique_ptr< epee::net_utils::http::abstract_http_client > m_http_client
Definition: wallet2.h:1793
uint32_t get_default_priority() const
Definition: wallet2.h:1305
uint64_t m_light_wallet_balance
Definition: wallet2.h:1895
std::string m_mms_file
Definition: wallet2.h:1792
uint64_t get_device_last_key_image_sync() const
Definition: wallet2.h:1114
uint64_t m_upper_transaction_weight_limit
Definition: wallet2.h:1813
uint32_t get_min_output_count() const
Definition: wallet2.h:1312
bool m_confirm_export_overwrite
Definition: wallet2.h:1856
bool m_has_ever_refreshed_from_node
Definition: wallet2.h:1928
uint32_t m_default_priority
Definition: wallet2.h:1840
void enable_multisig(bool enable)
Definition: wallet2.h:1364
uint32_t m_confirm_backlog_threshold
Definition: wallet2.h:1855
void handle_payment_changes(const T &res, std::false_type)
Definition: wallet2.h:1559
serializable_unordered_map< crypto::public_key, cryptonote::subaddress_index > m_subaddresses
Definition: wallet2.h:1807
bool m_first_refresh_done
Definition: wallet2.h:1843
size_t get_num_subaddresses(uint32_t index_major) const
Definition: wallet2.h:1012
std::vector< address_book_row > get_address_book() const
GUI Address book get/store.
Definition: wallet2.h:1407
cryptonote::network_type m_nettype
Definition: wallet2.h:1825
uint64_t get_blockchain_current_height() const
Definition: wallet2.h:1107
mms::message_store m_message_store
Definition: wallet2.h:1911
crypto::chacha_key m_cache_key
Definition: wallet2.h:1916
bool store_tx_info() const
Definition: wallet2.h:1301
void serialize(t_archive &a, const unsigned int ver)
Definition: wallet2.h:1119
std::vector< crypto::public_key > m_multisig_signers
Definition: wallet2.h:1832
std::unordered_map< crypto::hash, address_tx > m_light_wallet_address_txs
Definition: wallet2.h:1899
uint64_t max_reorg_depth() const
Definition: wallet2.h:956
std::vector< crypto::public_key > m_multisig_derivations
Definition: wallet2.h:1835
bool m_light_wallet
Definition: wallet2.h:1890
serializable_unordered_map< crypto::hash, unconfirmed_transfer_details > m_unconfirmed_txs
Definition: wallet2.h:1795
RefreshType get_refresh_type() const
Definition: wallet2.h:1030
size_t m_subaddress_lookahead_major
Definition: wallet2.h:1873
float m_auto_mine_for_rpc_payment_threshold
Definition: wallet2.h:1869
AskPasswordType m_ask_password
Definition: wallet2.h:1849
uint64_t get_refresh_from_block_height() const
Definition: wallet2.h:950
BackgroundMiningSetupType
Definition: wallet2.h:251
bool key_on_device() const
Definition: wallet2.h:1038
ExportFormat
Definition: wallet2.h:257
@ Ascii
Definition: wallet2.h:259
rpc_payment_state_t m_rpc_payment_state
Definition: wallet2.h:1881
mms::message_store & get_message_store()
Definition: wallet2.h:1655
void confirm_export_overwrite(bool always)
Definition: wallet2.h:1322
uint32_t m_rpc_version
Definition: wallet2.h:1879
bool m_use_dns
Definition: wallet2.h:1877
bool auto_refresh() const
Definition: wallet2.h:1307
serializable_unordered_map< crypto::hash, std::string > m_tx_device
Definition: wallet2.h:1887
bool is_trusted_daemon() const
Definition: wallet2.h:975
uint32_t m_inactivity_lock_timeout
Definition: wallet2.h:1866
void segregation_height(uint64_t height)
Definition: wallet2.h:1330
static boost::mutex default_daemon_address_lock
Definition: wallet2.h:1930
bool explicit_refresh_from_block_height() const
Definition: wallet2.h:953
bool confirm_export_overwrite() const
Definition: wallet2.h:1321
void segregate_pre_fork_outputs(bool value)
Definition: wallet2.h:1326
void store_tx_info(bool store)
Definition: wallet2.h:1302
uint64_t credits_target() const
Definition: wallet2.h:1361
hw::device::device_type get_device_type() const
Definition: wallet2.h:1039
void set_confirm_backlog_threshold(uint32_t threshold)
Definition: wallet2.h:1319
uint64_t m_max_reorg_depth
Definition: wallet2.h:1850
serializable_unordered_map< crypto::public_key, crypto::key_image > m_cold_key_images
Definition: wallet2.h:1816
std::vector< uint64_t > amounts_container
Definition: wallet2.h:424
bool m_devices_registered
Definition: wallet2.h:1920
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")
Definition: wallet2.h:1610
i_wallet2_callback * m_callback
Definition: wallet2.h:1823
bool auto_low_priority() const
Definition: wallet2.h:1323
const ExportFormat & export_format() const
Definition: wallet2.h:1351
bool m_store_tx_info
Definition: wallet2.h:1838
i_wallet2_callback * callback() const
Definition: wallet2.h:972
serializable_unordered_map< crypto::key_image, size_t > m_key_images
Definition: wallet2.h:1804
serializable_unordered_multimap< crypto::hash, payment_details > payment_container
Definition: wallet2.h:599
void print_ring_members(bool value)
Definition: wallet2.h:1300
void credit_report(uint64_t &expected_spent, uint64_t &discrepancy) const
Definition: wallet2.h:1676
uint64_t m_refresh_from_block_height
Definition: wallet2.h:1844
bool m_auto_refresh
Definition: wallet2.h:1842
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")
Definition: wallet2.h:1617
std::string get_address_as_str() const
Definition: wallet2.h:1008
bool m_ring_history_saved
Definition: wallet2.h:1904
bool m_persistent_rpc_client_id
Definition: wallet2.h:1868
uint32_t default_mixin() const
Definition: wallet2.h:1303
std::vector< crypto::public_key > get_subaddress_spend_public_keys(uint32_t account, uint32_t begin, uint32_t end) const
bool m_watch_only
Definition: wallet2.h:1829
bool is_offline() const
Definition: wallet2.h:1673
uint64_t get_light_wallet_scanned_block_height() const
Definition: wallet2.h:989
void set_min_output_value(uint64_t value)
Definition: wallet2.h:1313
cryptonote::network_type nettype() const
Definition: wallet2.h:1032
float auto_mine_for_rpc_payment_threshold() const
Definition: wallet2.h:1358
serializable_unordered_map< crypto::hash, confirmed_transfer_details > m_confirmed_txs
Definition: wallet2.h:1796
bool light_wallet() const
Checks if light wallet. A light wallet sends view key to a server where the blockchain is scanned.
Definition: wallet2.h:987
std::string m_keys_file
Definition: wallet2.h:1791
ExportFormat m_export_format
Definition: wallet2.h:1925
bool m_auto_low_priority
Definition: wallet2.h:1857
cryptonote::account_public_address get_address() const
Definition: wallet2.h:1003
uint32_t inactivity_lock_timeout() const
Definition: wallet2.h:1345
crypto::secret_key get_rpc_client_secret_key() const
Definition: wallet2.h:1359
bool m_always_confirm_transfers
Definition: wallet2.h:1836
bool is_mismatched_daemon_version_allowed() const
Definition: wallet2.h:1365
void ignore_fractional_outputs(bool value)
Definition: wallet2.h:1332
const std::string & device_name() const
Definition: wallet2.h:1347
Definition: wallet2.h:163
boost::optional< epee::wipeable_string > on_passphrase_request(bool &on_device) override
Definition: wallet2.cpp:1138
void on_button_pressed() override
Definition: wallet2.cpp:1125
wallet2 * wallet
Definition: wallet2.h:172
void on_button_request(uint64_t code=0) override
Definition: wallet2.cpp:1119
wallet_device_callback(wallet2 *wallet)
Definition: wallet2.h:165
void on_progress(const hw::device_progress &event) override
Definition: wallet2.cpp:1147
boost::optional< epee::wipeable_string > on_pin_request() override
Definition: wallet2.cpp:1131
Definition: wallet2.h:123
crypto::chacha_key key
Definition: wallet2.h:131
static boost::mutex lockers_lock
Definition: wallet2.h:132
static unsigned int lockers
Definition: wallet2.h:133
bool locked
Definition: wallet2.h:130
~wallet_keys_unlocker()
Definition: wallet2.cpp:1097
wallet2 & w
Definition: wallet2.h:129
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:69
const char * method_name
Definition: daemon_handler.cpp:55
handler_function * call
Definition: daemon_handler.cpp:56
conn start()
void * memcpy(void *a, const void *b, size_t c)
Definition: glibc_compat.cpp:16
int * count
Definition: gmock_stress_test.cc:176
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:38
static MDB_envinfo info
Definition: mdb_load.c:37
static int version
Definition: mdb_load.c:29
static int flags
Definition: mdb_load.c:31
uint32_t address
Definition: getifaddr.c:269
Definition: blockchain.py:1
Definition: blocks.cpp:13
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:1967
Definition: portable_binary_archive.hpp:29
crypto namespace.
Definition: crypto.cpp:60
static constexpr crypto::hash8 null_hash8
Definition: hash.h:93
POD_CLASS signature
Definition: crypto.h:98
const crypto::secret_key null_skey
Definition: crypto.cpp:75
POD_CLASS hash8
Definition: hash.h:51
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:92
POD_CLASS key_image
Definition: crypto.h:95
POD_CLASS hash
Definition: hash.h:48
network_type
Definition: cryptonote_config.h:289
@ MAINNET
Definition: cryptonote_config.h:290
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:216
std::string print_money(uint64_t amount, unsigned int decimal_point)
Definition: cryptonote_format_utils.cpp:1166
crypto::hash get_transaction_hash(const transaction &t)
Definition: cryptonote_format_utils.cpp:1259
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
Definition: mining.py:1
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:299
@ RangeProofBulletproof
Definition: rctTypes.h:299
key identity()
Definition: rctOps.h:73
Definition: binary_utils.h:36
Definition: enums.h:68
void print_source_entry(const cryptonote::tx_source_entry &src)
Definition: wallet2.h:2496
void digit_split_strategy(const std::vector< cryptonote::tx_destination_entry > &dsts, const cryptonote::tx_destination_entry &change_dst, uint64_t dust_threshold, std::vector< cryptonote::tx_destination_entry > &splitted_dsts, std::vector< cryptonote::tx_destination_entry > &dust_dsts)
Definition: wallet2.h:2457
void null_split_strategy(const std::vector< cryptonote::tx_destination_entry > &dsts, const cryptonote::tx_destination_entry &change_dst, uint64_t dust_threshold, std::vector< cryptonote::tx_destination_entry > &splitted_dsts, std::vector< cryptonote::tx_destination_entry > &dust_dsts)
Definition: wallet2.h:2481
Various Tools.
Definition: apply_permutation.h:40
static const std::chrono::seconds rpc_timeout
Definition: node_rpc_proxy.cpp:54
Definition: transfer.py:1
Definition: uri.py:1
Definition: wallet.py:1
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:884
#define BEGIN_SERIALIZE_OBJECT()
begins the environment of the DSL \detailed for described the serialization of an object
Definition: serialization.h:184
#define FIELD(f)
tags the field with the variable name and then serializes it
Definition: serialization.h:237
#define FIELD_N(t, f)
serializes a field f tagged t
Definition: serialization.h:226
#define VERSION_FIELD(v)
Definition: serialization.h:288
#define MAGIC_FIELD(m)
Definition: serialization.h:277
#define END_SERIALIZE()
self-explanatory
Definition: serialization.h:208
#define VARINT_FIELD(f)
tags and serializes the varint f
Definition: serialization.h:257
static const unsigned char iv[64]
Definition: sha512-hash.c:13
if(!cryptonote::get_account_address_from_str_or_url(info, cryptonote::TESTNET, "9uVsvEryzpN8WH2t1WWhFFCG5tS8cBNdmJYNRuckLENFimfauV5pZKeS1P2CbxGkSDTUPHXWwiYE5ZGSXDAGbaZgDxobqDN"))
Definition: signature.cpp:53
#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
#define true
Definition: stdbool.h:36
#define false
Definition: stdbool.h:37
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: argon2_core.h:74
Definition: core_rpc_server_commands_defs.h:191
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: misc_language.h:104
Definition: minixmlvalid.c:15
Definition: message_store.h:242
Definition: chaingen.h:294
Definition: rctTypes.h:300
RangeProofType range_proof_type
Definition: rctTypes.h:301
Definition: rctTypes.h:79
Definition: rctTypes.h:105
Definition: rctTypes.h:114
Definition: rctTypes.h:595
Definition: wallet_errors.h:163
Definition: wallet2.h:107
static constexpr result_type min()
Definition: wallet2.h:109
result_type operator()()
Definition: wallet2.h:111
uint64_t result_type
Definition: wallet2.h:108
static constexpr result_type max()
Definition: wallet2.h:110
Definition: wallet_rpc_helpers.h:50
Definition: wallet2.h:176
bool add_to_fee
Definition: wallet2.h:178
cryptonote::account_public_address addr_for_dust
Definition: wallet2.h:179
tx_dust_policy(uint64_t a_dust_threshold=0, bool an_add_to_fee=true, cryptonote::account_public_address an_addr_for_dust=cryptonote::account_public_address())
Definition: wallet2.h:181
uint64_t dust_threshold
Definition: wallet2.h:177
Definition: wallet2.h:755
bool m_is_subaddress
Definition: wallet2.h:759
crypto::hash8 m_payment_id
Definition: wallet2.h:757
bool m_has_payment_id
Definition: wallet2.h:760
std::string m_description
Definition: wallet2.h:758
cryptonote::account_public_address m_address
Definition: wallet2.h:756
Definition: wallet2.h:452
bool m_incoming
Definition: wallet2.h:454
bool m_mempool
Definition: wallet2.h:453
Definition: wallet2.h:743
crypto::chacha_iv iv
Definition: wallet2.h:744
std::string cache_data
Definition: wallet2.h:745
uint64_t m_amount_out
Definition: wallet2.h:506
std::vector< std::pair< crypto::key_image, std::vector< uint64_t > > > m_rings
Definition: wallet2.h:515
uint64_t m_block_height
Definition: wallet2.h:508
uint64_t m_change
Definition: wallet2.h:507
uint32_t m_subaddr_account
Definition: wallet2.h:513
uint64_t m_amount_in
Definition: wallet2.h:505
confirmed_transfer_details(const unconfirmed_transfer_details &utd, uint64_t height)
Definition: wallet2.h:518
crypto::hash m_payment_id
Definition: wallet2.h:510
confirmed_transfer_details()
Definition: wallet2.h:517
uint64_t m_timestamp
Definition: wallet2.h:511
std::set< uint32_t > m_subaddr_indices
Definition: wallet2.h:514
std::vector< cryptonote::tx_destination_entry > m_dests
Definition: wallet2.h:509
cryptonote::transaction_prefix m_tx
Definition: wallet2.h:504
uint64_t m_unlock_time
Definition: wallet2.h:512
uint8_t m_key_image_request
Definition: wallet2.h:398
uint32_t m_subaddr_index_minor
Definition: wallet2.h:406
uint64_t m_internal_output_index
Definition: wallet2.h:387
uint32_t m_subaddr_index_major
Definition: wallet2.h:405
uint64_t m_global_output_index
Definition: wallet2.h:388
uint8_t m_key_image_partial
Definition: wallet2.h:399
crypto::public_key m_pubkey
Definition: wallet2.h:386
uint8_t m_frozen
Definition: wallet2.h:395
crypto::public_key m_tx_pubkey
Definition: wallet2.h:389
uint8_t m_key_image_known
Definition: wallet2.h:397
uint8_t m_rct
Definition: wallet2.h:396
uint8_t flags
Definition: wallet2.h:401
uint8_t m_spent
Definition: wallet2.h:394
uint64_t m_amount
Definition: wallet2.h:403
std::vector< crypto::public_key > m_additional_tx_keys
Definition: wallet2.h:404
Definition: wallet2.h:804
std::vector< boost::optional< cryptonote::subaddress_receive_info > > received
Definition: wallet2.h:807
crypto::public_key pkey
Definition: wallet2.h:805
crypto::key_derivation derivation
Definition: wallet2.h:806
Definition: wallet2.h:732
std::string account_data
Definition: wallet2.h:734
crypto::chacha_iv iv
Definition: wallet2.h:733
bool old
Definition: wallet2.h:1471
Definition: wallet2.h:292
rct::key m_R
Definition: wallet2.h:294
rct::key m_L
Definition: wallet2.h:293
Definition: wallet2.h:290
crypto::public_key m_signer
Definition: wallet2.h:302
std::vector< crypto::key_image > m_partial_key_images
Definition: wallet2.h:304
std::vector< LR > m_LR
Definition: wallet2.h:303
Definition: wallet2.h:602
std::unordered_set< crypto::public_key > ignore
Definition: wallet2.h:604
rct::keyM total_alpha_H
Definition: wallet2.h:610
rct::multisig_out msout
Definition: wallet2.h:607
rct::rctSig sigs
Definition: wallet2.h:603
rct::keyV c_0
Definition: wallet2.h:611
rct::keyM total_alpha_G
Definition: wallet2.h:609
std::unordered_set< crypto::public_key > signing_keys
Definition: wallet2.h:606
rct::keyV s
Definition: wallet2.h:612
std::unordered_set< rct::key > used_L
Definition: wallet2.h:605
Definition: wallet2.h:721
std::unordered_set< crypto::public_key > m_signers
Definition: wallet2.h:723
std::vector< pending_tx > m_ptx
Definition: wallet2.h:722
Definition: wallet2.h:795
bool error
Definition: wallet2.h:800
cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices o_indices
Definition: wallet2.h:799
cryptonote::block block
Definition: wallet2.h:797
std::vector< cryptonote::transaction > txes
Definition: wallet2.h:798
crypto::hash hash
Definition: wallet2.h:796
Definition: wallet2.h:426
bool m_coinbase
Definition: wallet2.h:434
amounts_container m_amounts
Definition: wallet2.h:429
crypto::hash m_tx_hash
Definition: wallet2.h:427
uint64_t m_fee
Definition: wallet2.h:430
uint64_t m_timestamp
Definition: wallet2.h:433
uint64_t m_unlock_time
Definition: wallet2.h:432
uint64_t m_amount
Definition: wallet2.h:428
uint64_t m_block_height
Definition: wallet2.h:431
cryptonote::subaddress_index m_subaddr_index
Definition: wallet2.h:435
Definition: wallet2.h:634
tx_construction_data construction_data
Definition: wallet2.h:647
std::vector< size_t > selected_transfers
Definition: wallet2.h:639
crypto::secret_key multisig_tx_key_entropy
Definition: wallet2.h:645
bool dust_added_to_fee
Definition: wallet2.h:637
crypto::secret_key tx_key
Definition: wallet2.h:641
std::vector< cryptonote::tx_destination_entry > dests
Definition: wallet2.h:643
std::vector< multisig_sig > multisig_sigs
Definition: wallet2.h:644
cryptonote::transaction tx
Definition: wallet2.h:635
std::vector< crypto::secret_key > additional_tx_keys
Definition: wallet2.h:642
std::string key_images
Definition: wallet2.h:640
uint64_t fee
Definition: wallet2.h:636
cryptonote::tx_destination_entry change_dts
Definition: wallet2.h:638
uint64_t dust
Definition: wallet2.h:636
Definition: wallet2.h:458
bool m_double_spend_seen
Definition: wallet2.h:460
payment_details m_pd
Definition: wallet2.h:459
Definition: wallet2.h:773
crypto::public_key shared_secret
Definition: wallet2.h:776
crypto::signature key_image_sig
Definition: wallet2.h:779
crypto::signature shared_secret_sig
Definition: wallet2.h:778
uint64_t index_in_tx
Definition: wallet2.h:775
crypto::key_image key_image
Definition: wallet2.h:777
crypto::hash txid
Definition: wallet2.h:774
Definition: wallet2.h:707
serializable_unordered_map< crypto::public_key, crypto::key_image > tx_key_images
Definition: wallet2.h:710
std::vector< crypto::key_image > key_images
Definition: wallet2.h:709
std::vector< pending_tx > ptx
Definition: wallet2.h:708
Definition: wallet2.h:327
uint64_t m_amount
Definition: wallet2.h:338
bool m_key_image_request
Definition: wallet2.h:341
bool m_frozen
Definition: wallet2.h:334
rct::key m_mask
Definition: wallet2.h:337
uint64_t m_pk_index
Definition: wallet2.h:342
bool m_spent
Definition: wallet2.h:333
uint64_t m_global_output_index
Definition: wallet2.h:332
crypto::key_image m_key_image
Definition: wallet2.h:336
uint64_t amount() const
Definition: wallet2.h:350
std::vector< std::pair< uint64_t, crypto::hash > > m_uses
Definition: wallet2.h:347
std::vector< multisig_info > m_multisig_info
Definition: wallet2.h:346
uint64_t m_internal_output_index
Definition: wallet2.h:331
cryptonote::subaddress_index m_subaddr_index
Definition: wallet2.h:343
uint64_t m_spent_height
Definition: wallet2.h:335
uint64_t m_block_height
Definition: wallet2.h:328
crypto::hash m_txid
Definition: wallet2.h:330
const crypto::public_key get_public_key() const
Definition: wallet2.h:351
bool m_rct
Definition: wallet2.h:339
cryptonote::transaction_prefix m_tx
Definition: wallet2.h:329
bool is_rct() const
Definition: wallet2.h:349
bool m_key_image_partial
Definition: wallet2.h:344
bool m_key_image_known
Definition: wallet2.h:340
std::vector< rct::key > m_multisig_k
Definition: wallet2.h:345
Definition: wallet2.h:811
std::vector< cryptonote::tx_extra_field > tx_extra_fields
Definition: wallet2.h:812
std::vector< is_out_data > primary
Definition: wallet2.h:813
bool empty() const
Definition: wallet2.h:816
std::vector< is_out_data > additional
Definition: wallet2.h:814
Definition: wallet2.h:540
construction_flags_
Definition: wallet2.h:555
std::vector< uint8_t > extra
Definition: wallet2.h:545
std::vector< cryptonote::tx_source_entry > sources
Definition: wallet2.h:541
uint8_t construction_flags
Definition: wallet2.h:562
std::vector< cryptonote::tx_destination_entry > splitted_dsts
Definition: wallet2.h:543
rct::RCTConfig rct_config
Definition: wallet2.h:548
std::vector< cryptonote::tx_destination_entry > dests
Definition: wallet2.h:550
uint64_t unlock_time
Definition: wallet2.h:546
bool use_view_tags
Definition: wallet2.h:549
std::vector< size_t > selected_transfers
Definition: wallet2.h:544
std::set< uint32_t > subaddr_indices
Definition: wallet2.h:552
uint32_t subaddr_account
Definition: wallet2.h:551
bool use_rct
Definition: wallet2.h:547
cryptonote::tx_destination_entry change_dts
Definition: wallet2.h:542
Definition: wallet2.h:314
boost::optional< cryptonote::subaddress_receive_info > received
Definition: wallet2.h:321
uint64_t amount
Definition: wallet2.h:318
rct::key mask
Definition: wallet2.h:317
cryptonote::keypair in_ephemeral
Definition: wallet2.h:315
uint64_t money_transfered
Definition: wallet2.h:319
tx_scan_info_t()
Definition: wallet2.h:323
bool error
Definition: wallet2.h:320
crypto::key_image ki
Definition: wallet2.h:316
uint32_t m_subaddr_account
Definition: wallet2.h:480
time_t m_sent_time
Definition: wallet2.h:475
uint64_t m_amount_out
Definition: wallet2.h:473
uint64_t m_timestamp
Definition: wallet2.h:479
enum tools::wallet2::unconfirmed_transfer_details::@97 m_state
crypto::hash m_payment_id
Definition: wallet2.h:477
cryptonote::transaction_prefix m_tx
Definition: wallet2.h:471
std::vector< std::pair< crypto::key_image, std::vector< uint64_t > > > m_rings
Definition: wallet2.h:482
std::vector< cryptonote::tx_destination_entry > m_dests
Definition: wallet2.h:476
uint64_t m_amount_in
Definition: wallet2.h:472
std::set< uint32_t > m_subaddr_indices
Definition: wallet2.h:481
uint64_t m_change
Definition: wallet2.h:474
Definition: wallet2.h:675
std::vector< tx_construction_data > txes
Definition: wallet2.h:676
std::tuple< uint64_t, uint64_t, wallet2::transfer_container > transfers
Definition: wallet2.h:677
std::tuple< uint64_t, uint64_t, std::vector< wallet2::exported_transfer_details > > new_transfers
Definition: wallet2.h:678
Definition: serialization.cpp:879
#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
randomx_cache * cache
Definition: tests.cpp:19
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:412
static std::string get_payment_id(const std::vector< uint8_t > &tx_extra)
Definition: trezor_tests.cpp:472
std::vector< cryptonote::tx_extra_field > tx_extra_fields
Definition: tx-extra.cpp:38
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:965
#define T(x)