From d91eb8c7b43fc73b9333de800500f217e370cc4b Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 19 Aug 2015 20:59:44 +0100 Subject: wallet: only return tx keys via RPC if requested To get the tx keys returned via RPC, set the "get_tx_key" or "get_tx_keys" request field to true (defaults to false). --- src/wallet/wallet2.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/wallet/wallet2.cpp') diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 80f7f4ba1..12f69e6fe 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -540,6 +540,9 @@ bool wallet2::store_keys(const std::string& keys_file_name, const std::string& p value2.SetInt(m_always_confirm_transfers ? 1 :0); json.AddMember("always_confirm_transfers", value2, json.GetAllocator()); + value2.SetInt(m_store_tx_keys ? 1 :0); + json.AddMember("store_tx_keys", value2, json.GetAllocator()); + // Serialize the JSON object rapidjson::StringBuffer buffer; rapidjson::Writer writer(buffer); @@ -620,6 +623,7 @@ void wallet2::load_keys(const std::string& keys_file_name, const std::string& pa m_watch_only = false; } m_always_confirm_transfers = json.HasMember("always_confirm_transfers") && (json["always_confirm_transfers"].GetInt() != 0); + m_store_tx_keys = json.HasMember("store_tx_keys") && (json["store_tx_keys"].GetInt() != 0); } const cryptonote::account_keys& keys = m_account.get_keys(); @@ -1325,7 +1329,8 @@ void wallet2::commit_tx(pending_tx& ptx) txid = get_transaction_hash(ptx.tx); add_unconfirmed_tx(ptx.tx, ptx.change_dts.amount); - m_tx_keys.insert(std::make_pair(txid, ptx.tx_key)); + if (store_tx_keys()) + m_tx_keys.insert(std::make_pair(txid, ptx.tx_key)); LOG_PRINT_L2("transaction " << txid << " generated ok and sent to daemon, key_images: [" << ptx.key_images << "]"); @@ -1578,7 +1583,7 @@ void wallet2::transfer_selected(const std::vector