aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorkenshi84 <kenshi84@protonmail.ch>2017-01-27 21:26:52 +0900
committerkenshi84 <kenshi84@protonmail.ch>2017-02-03 09:38:12 +0900
commitf97526e641a96ce7525673704ade98b3b3ee19d3 (patch)
tree1227175dd50323b1df4bb023c4fce079a078062a /src/wallet
parentMerge pull request #1622 (diff)
downloadmonero-f97526e641a96ce7525673704ade98b3b3ee19d3.tar.xz
simplewallet: option to always ask password for any crytical operations
Diffstat (limited to '')
-rw-r--r--src/wallet/wallet2.cpp6
-rw-r--r--src/wallet/wallet2.h7
2 files changed, 11 insertions, 2 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 4348b8a62..e73691d6e 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -1859,6 +1859,9 @@ bool wallet2::store_keys(const std::string& keys_file_name, const std::string& p
value2.SetInt(m_confirm_missing_payment_id ? 1 :0);
json.AddMember("confirm_missing_payment_id", value2, json.GetAllocator());
+ value2.SetInt(m_ask_password ? 1 :0);
+ json.AddMember("ask_password", value2, json.GetAllocator());
+
// Serialize the JSON object
rapidjson::StringBuffer buffer;
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
@@ -1926,6 +1929,7 @@ bool wallet2::load_keys(const std::string& keys_file_name, const std::string& pa
m_auto_refresh = true;
m_refresh_type = RefreshType::RefreshDefault;
m_confirm_missing_payment_id = true;
+ m_ask_password = true;
}
else
{
@@ -1986,6 +1990,8 @@ bool wallet2::load_keys(const std::string& keys_file_name, const std::string& pa
m_refresh_from_block_height = field_refresh_height;
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, confirm_missing_payment_id, int, Int, false, true);
m_confirm_missing_payment_id = field_confirm_missing_payment_id;
+ GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, ask_password, int, Int, false, true);
+ m_ask_password = field_ask_password;
}
const cryptonote::account_keys& keys = m_account.get_keys();
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
index 629011800..1f3e5b4a5 100644
--- a/src/wallet/wallet2.h
+++ b/src/wallet/wallet2.h
@@ -104,7 +104,7 @@ namespace tools
};
private:
- wallet2(const wallet2&) : m_run(true), m_callback(0), m_testnet(false), m_always_confirm_transfers(true), m_print_ring_members(false), m_store_tx_info(true), m_default_mixin(0), m_default_priority(0), m_refresh_type(RefreshOptimizeCoinbase), m_auto_refresh(true), m_refresh_from_block_height(0), m_confirm_missing_payment_id(true), m_node_rpc_proxy(m_http_client, m_daemon_rpc_mutex) {}
+ wallet2(const wallet2&) : m_run(true), m_callback(0), m_testnet(false), m_always_confirm_transfers(true), m_print_ring_members(false), m_store_tx_info(true), m_default_mixin(0), m_default_priority(0), m_refresh_type(RefreshOptimizeCoinbase), m_auto_refresh(true), m_refresh_from_block_height(0), m_confirm_missing_payment_id(true), m_ask_password(true), m_node_rpc_proxy(m_http_client, m_daemon_rpc_mutex) {}
public:
static const char* tr(const char* str);// { return i18n_translate(str, "cryptonote::simple_wallet"); }
@@ -125,7 +125,7 @@ namespace tools
//! Uses stdin and stdout. Returns a wallet2 and password for wallet with no file if no errors.
static std::pair<std::unique_ptr<wallet2>, password_container> make_new(const boost::program_options::variables_map& vm);
- wallet2(bool testnet = false, bool restricted = false) : m_run(true), m_callback(0), m_testnet(testnet), m_always_confirm_transfers(true), m_print_ring_members(false), m_store_tx_info(true), m_default_mixin(0), m_default_priority(0), m_refresh_type(RefreshOptimizeCoinbase), m_auto_refresh(true), m_refresh_from_block_height(0), m_confirm_missing_payment_id(true), m_restricted(restricted), is_old_file_format(false), m_node_rpc_proxy(m_http_client, m_daemon_rpc_mutex) {}
+ wallet2(bool testnet = false, bool restricted = false) : m_run(true), m_callback(0), m_testnet(testnet), m_always_confirm_transfers(true), m_print_ring_members(false), m_store_tx_info(true), m_default_mixin(0), m_default_priority(0), m_refresh_type(RefreshOptimizeCoinbase), m_auto_refresh(true), m_refresh_from_block_height(0), m_confirm_missing_payment_id(true), m_ask_password(true), m_restricted(restricted), is_old_file_format(false), m_node_rpc_proxy(m_http_client, m_daemon_rpc_mutex) {}
struct transfer_details
{
uint64_t m_block_height;
@@ -506,6 +506,8 @@ namespace tools
void auto_refresh(bool r) { m_auto_refresh = r; }
bool confirm_missing_payment_id() const { return m_confirm_missing_payment_id; }
void confirm_missing_payment_id(bool always) { m_confirm_missing_payment_id = always; }
+ bool ask_password() const { return m_ask_password; }
+ void ask_password(bool always) { m_ask_password = always; }
bool get_tx_key(const crypto::hash &txid, crypto::secret_key &tx_key) const;
@@ -656,6 +658,7 @@ namespace tools
bool m_auto_refresh;
uint64_t m_refresh_from_block_height;
bool m_confirm_missing_payment_id;
+ bool m_ask_password;
NodeRPCProxy m_node_rpc_proxy;
};
}