aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/wallet/wallet2.h42
1 files changed, 33 insertions, 9 deletions
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
index dbd305a02..8df6c757d 100644
--- a/src/wallet/wallet2.h
+++ b/src/wallet/wallet2.h
@@ -79,9 +79,9 @@ namespace tools
class wallet2
{
- wallet2(const wallet2&) : m_run(true), m_callback(0), m_testnet(false), m_always_confirm_transfers (false), m_store_tx_keys(false), m_default_mixin(0) {}
+ wallet2(const wallet2&) : m_run(true), m_callback(0), m_testnet(false), m_always_confirm_transfers (false), m_store_tx_info(true), m_default_mixin(0) {}
public:
- wallet2(bool testnet = false, bool restricted = false) : m_run(true), m_callback(0), m_testnet(testnet), m_restricted(restricted), is_old_file_format(false), m_store_tx_keys(false), m_default_mixin(0) {}
+ wallet2(bool testnet = false, bool restricted = false) : m_run(true), m_callback(0), m_testnet(testnet), m_restricted(restricted), is_old_file_format(false), m_store_tx_info(true), m_default_mixin(0) {}
struct transfer_details
{
uint64_t m_block_height;
@@ -107,6 +107,8 @@ namespace tools
cryptonote::transaction m_tx;
uint64_t m_change;
time_t m_sent_time;
+ std::vector<cryptonote::tx_destination_entry> m_dests;
+ crypto::hash m_payment_id;
};
struct confirmed_transfer_details
@@ -115,9 +117,12 @@ namespace tools
uint64_t m_amount_out;
uint64_t m_change;
uint64_t m_block_height;
- confirmed_transfer_details() {}
+ std::vector<cryptonote::tx_destination_entry> m_dests;
+ crypto::hash m_payment_id;
+
+ confirmed_transfer_details(): m_amount_in(0), m_amount_out(0), m_change((uint64_t)-1), m_block_height(0), m_payment_id(cryptonote::null_hash) {}
confirmed_transfer_details(const unconfirmed_transfer_details &utd, uint64_t height):
- m_amount_out(get_outs_money_amount(utd.m_tx)), m_change(utd.m_change), m_block_height(height) { get_inputs_money_amount(utd.m_tx, m_amount_in); }
+ m_amount_out(get_outs_money_amount(utd.m_tx)), m_change(utd.m_change), m_block_height(height), m_dests(utd.m_dests), m_payment_id(utd.m_payment_id) { get_inputs_money_amount(utd.m_tx, m_amount_in); }
};
typedef std::vector<transfer_details> transfer_container;
@@ -131,6 +136,7 @@ namespace tools
std::list<transfer_container::iterator> selected_transfers;
std::string key_images;
crypto::secret_key tx_key;
+ std::vector<cryptonote::tx_destination_entry> dests;
};
struct keys_file_data
@@ -308,8 +314,8 @@ namespace tools
bool always_confirm_transfers() const { return m_always_confirm_transfers; }
void always_confirm_transfers(bool always) { m_always_confirm_transfers = always; }
- bool store_tx_keys() const { return m_store_tx_keys; }
- void store_tx_keys(bool store) { m_store_tx_keys = store; }
+ bool store_tx_info() const { return m_store_tx_info; }
+ void store_tx_info(bool store) { m_store_tx_info = store; }
uint32_t default_mixin() const { return m_default_mixin; }
void default_mixin(uint32_t m) { m_default_mixin = m; }
@@ -341,10 +347,12 @@ namespace tools
uint64_t select_transfers(uint64_t needed_money, bool add_dust, uint64_t dust, std::list<transfer_container::iterator>& selected_transfers);
bool prepare_file_names(const std::string& file_path);
void process_unconfirmed(const cryptonote::transaction& tx, uint64_t height);
- void add_unconfirmed_tx(const cryptonote::transaction& tx, uint64_t change_amount);
+ void process_outgoing(const cryptonote::transaction& tx, uint64_t height, uint64_t spent, uint64_t received);
+ void add_unconfirmed_tx(const cryptonote::transaction& tx, const std::vector<cryptonote::tx_destination_entry> &dests, const crypto::hash &payment_id, uint64_t change_amount);
void generate_genesis(cryptonote::block& b);
void check_genesis(const crypto::hash& genesis_hash) const; //throws
bool generate_chacha8_key_from_secret_keys(crypto::chacha8_key &key) const;
+ crypto::hash get_payment_id(const pending_tx &ptx) const;
cryptonote::account_base m_account;
std::string m_daemon_address;
@@ -372,11 +380,11 @@ namespace tools
bool is_old_file_format; /*!< Whether the wallet file is of an old file format */
bool m_watch_only; /*!< no spend key */
bool m_always_confirm_transfers;
- bool m_store_tx_keys; /*!< request txkey to be returned in RPC, and store in the wallet cache file */
+ bool m_store_tx_info; /*!< request txkey to be returned in RPC, and store in the wallet cache file */
uint32_t m_default_mixin;
};
}
-BOOST_CLASS_VERSION(tools::wallet2, 9)
+BOOST_CLASS_VERSION(tools::wallet2, 10)
namespace boost
{
@@ -399,6 +407,10 @@ namespace boost
a & x.m_change;
a & x.m_sent_time;
a & x.m_tx;
+ if (ver < 9)
+ return;
+ a & x.m_dests;
+ a & x.m_payment_id;
}
template <class Archive>
@@ -408,6 +420,10 @@ namespace boost
a & x.m_amount_out;
a & x.m_change;
a & x.m_block_height;
+ if (ver < 9)
+ return;
+ a & x.m_dests;
+ a & x.m_payment_id;
}
template <class Archive>
@@ -418,6 +434,13 @@ namespace boost
a & x.m_block_height;
a & x.m_unlock_time;
}
+
+ template <class Archive>
+ inline void serialize(Archive& a, cryptonote::tx_destination_entry& x, const boost::serialization::version_type ver)
+ {
+ a & x.amount;
+ a & x.addr;
+ }
}
}
@@ -628,6 +651,7 @@ namespace tools
ptx.change_dts = change_dts;
ptx.selected_transfers = selected_transfers;
ptx.tx_key = tx_key;
+ ptx.dests = dsts;
}