diff options
author | Riccardo Spagni <ric@spagni.net> | 2018-01-27 17:24:34 -0800 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2018-01-27 17:24:34 -0800 |
commit | e1ba5b95c180410118e28587986f5a61eb460900 (patch) | |
tree | 73032f09c93038a3a0a5434422b472ce80af0739 /src/wallet | |
parent | Merge pull request #3114 (diff) | |
parent | simplewallet: check file overwrite when exporting stuff (diff) | |
download | monero-e1ba5b95c180410118e28587986f5a61eb460900.tar.xz |
Merge pull request #3118
ca336c62 simplewallet: check file overwrite when exporting stuff (stoffu)
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/wallet2.cpp | 7 | ||||
-rw-r--r-- | src/wallet/wallet2.h | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 3a7dad925..f022c739c 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -611,6 +611,7 @@ wallet2::wallet2(bool testnet, bool restricted): m_merge_destinations(false), m_confirm_backlog(true), m_confirm_backlog_threshold(0), + m_confirm_export_overwrite(true), m_is_initialized(false), m_restricted(restricted), is_old_file_format(false), @@ -2443,6 +2444,9 @@ bool wallet2::store_keys(const std::string& keys_file_name, const epee::wipeable value2.SetUint(m_confirm_backlog_threshold); json.AddMember("confirm_backlog_threshold", value2, json.GetAllocator()); + value2.SetInt(m_confirm_export_overwrite ? 1 :0); + json.AddMember("confirm_export_overwrite", value2, json.GetAllocator()); + value2.SetInt(m_testnet ? 1 :0); json.AddMember("testnet", value2, json.GetAllocator()); @@ -2524,6 +2528,7 @@ bool wallet2::load_keys(const std::string& keys_file_name, const epee::wipeable_ m_merge_destinations = false; m_confirm_backlog = true; m_confirm_backlog_threshold = 0; + m_confirm_export_overwrite = true; } else if(json.IsObject()) { @@ -2623,6 +2628,8 @@ bool wallet2::load_keys(const std::string& keys_file_name, const epee::wipeable_ m_confirm_backlog = field_confirm_backlog; GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, confirm_backlog_threshold, uint32_t, Uint, false, 0); m_confirm_backlog_threshold = field_confirm_backlog_threshold; + GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, confirm_export_overwrite, int, Int, false, true); + m_confirm_export_overwrite = field_confirm_export_overwrite; GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, testnet, int, Int, false, m_testnet); // Wallet is being opened with testnet flag, but is saved as a mainnet wallet THROW_WALLET_EXCEPTION_IF(m_testnet && !field_testnet, error::wallet_internal_error, "Mainnet wallet can not be opened as testnet wallet"); diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 4bcdfa025..efcc21c47 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -838,6 +838,8 @@ namespace tools void confirm_backlog(bool always) { m_confirm_backlog = always; } void set_confirm_backlog_threshold(uint32_t threshold) { m_confirm_backlog_threshold = threshold; }; uint32_t get_confirm_backlog_threshold() const { return m_confirm_backlog_threshold; }; + bool confirm_export_overwrite() const { return m_confirm_export_overwrite; } + void confirm_export_overwrite(bool always) { m_confirm_export_overwrite = always; } bool get_tx_key(const crypto::hash &txid, crypto::secret_key &tx_key, std::vector<crypto::secret_key> &additional_tx_keys) const; 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); @@ -1120,6 +1122,7 @@ namespace tools bool m_merge_destinations; bool m_confirm_backlog; uint32_t m_confirm_backlog_threshold; + bool m_confirm_export_overwrite; bool m_is_initialized; NodeRPCProxy m_node_rpc_proxy; std::unordered_set<crypto::hash> m_scanned_pool_txs[2]; |