aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet/wallet2.h')
-rw-r--r--src/wallet/wallet2.h26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
index ffe9ad0e5..b04a920ce 100644
--- a/src/wallet/wallet2.h
+++ b/src/wallet/wallet2.h
@@ -120,6 +120,7 @@ namespace tools
cryptonote::tx_destination_entry change_dts;
std::list<transfer_container::iterator> selected_transfers;
std::string key_images;
+ crypto::secret_key tx_key;
};
struct keys_file_data
@@ -133,6 +134,17 @@ namespace tools
END_SERIALIZE()
};
+ struct cache_file_data
+ {
+ crypto::chacha8_iv iv;
+ std::string cache_data;
+
+ BEGIN_SERIALIZE_OBJECT()
+ FIELD(iv)
+ FIELD(cache_data)
+ END_SERIALIZE()
+ };
+
/*!
* \brief Generates a wallet or restores one.
* \param wallet_ Name of wallet file
@@ -251,6 +263,9 @@ namespace tools
if(ver < 7)
return;
a & m_payments;
+ if(ver < 8)
+ return;
+ a & m_tx_keys;
}
/*!
@@ -278,6 +293,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 get_tx_key(const crypto::hash &txid, crypto::secret_key &tx_key) const;
+
private:
/*!
* \brief Stores wallet information to wallet file.
@@ -307,6 +324,7 @@ namespace tools
void add_unconfirmed_tx(const cryptonote::transaction& tx, 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;
cryptonote::account_base m_account;
std::string m_daemon_address;
@@ -316,6 +334,7 @@ namespace tools
std::vector<crypto::hash> m_blockchain;
std::atomic<uint64_t> m_local_bc_height; //temporary workaround
std::unordered_map<crypto::hash, unconfirmed_transfer_details> m_unconfirmed_txs;
+ std::unordered_map<crypto::hash, crypto::secret_key> m_tx_keys;
transfer_container m_transfers;
payment_container m_payments;
@@ -334,7 +353,7 @@ namespace tools
bool m_always_confirm_transfers;
};
}
-BOOST_CLASS_VERSION(tools::wallet2, 7)
+BOOST_CLASS_VERSION(tools::wallet2, 8)
namespace boost
{
@@ -565,7 +584,8 @@ namespace tools
splitted_dsts.push_back(cryptonote::tx_destination_entry(dust, dust_policy.addr_for_dust));
}
- bool r = cryptonote::construct_tx(m_account.get_keys(), sources, splitted_dsts, extra, tx, unlock_time);
+ crypto::secret_key tx_key;
+ bool r = cryptonote::construct_tx(m_account.get_keys(), sources, splitted_dsts, extra, tx, unlock_time, tx_key);
THROW_WALLET_EXCEPTION_IF(!r, error::tx_not_constructed, sources, splitted_dsts, unlock_time, m_testnet);
THROW_WALLET_EXCEPTION_IF(m_upper_transaction_size_limit <= get_object_blobsize(tx), error::tx_too_big, tx, m_upper_transaction_size_limit);
@@ -584,7 +604,7 @@ namespace tools
ptx.tx = tx;
ptx.change_dts = change_dts;
ptx.selected_transfers = selected_transfers;
-
+ ptx.tx_key = tx_key;
}