aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.h
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-08-19 20:59:44 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-08-19 21:11:48 +0100
commit6c995710d8cdc8dbbb3da2d11dc8dfe335074ec9 (patch)
treead354dd1a0f409e9acfa8959d4faa382d4f94bd1 /src/wallet/wallet2.h
parentMerge pull request #379 (diff)
downloadmonero-6c995710d8cdc8dbbb3da2d11dc8dfe335074ec9.tar.xz
make tx keys available to the user
They are also stored in the cache file, to be retrieved using a new get_tx_key command.
Diffstat (limited to 'src/wallet/wallet2.h')
-rw-r--r--src/wallet/wallet2.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
index ffe9ad0e5..abda1c54a 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
@@ -251,6 +252,9 @@ namespace tools
if(ver < 7)
return;
a & m_payments;
+ if(ver < 8)
+ return;
+ a & m_tx_keys;
}
/*!
@@ -278,6 +282,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.
@@ -316,6 +322,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 +341,7 @@ namespace tools
bool m_always_confirm_transfers;
};
}
-BOOST_CLASS_VERSION(tools::wallet2, 7)
+BOOST_CLASS_VERSION(tools::wallet2, 8)
namespace boost
{
@@ -565,7 +572,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 +592,7 @@ namespace tools
ptx.tx = tx;
ptx.change_dts = change_dts;
ptx.selected_transfers = selected_transfers;
-
+ ptx.tx_key = tx_key;
}