diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-07-18 22:03:35 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-07-18 22:11:53 +0100 |
commit | 8fe180ab80fc16418fadd05ca9aaf6e7d7d8aefa (patch) | |
tree | cec813a84484b331178a5f95791faafe4e945e3c /src/wallet | |
parent | Merge pull request #345 (diff) | |
download | monero-8fe180ab80fc16418fadd05ca9aaf6e7d7d8aefa.tar.xz |
wallet: add boolean to always confirm transactions with the user
This can be useful if you want to be given a veto over the tx fee,
or if you want to see what a tx fee would be without actually sending.
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/wallet2.cpp | 5 | ||||
-rw-r--r-- | src/wallet/wallet2.h | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 63205f429..ea8509019 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -502,6 +502,9 @@ bool wallet2::store_keys(const std::string& keys_file_name, const std::string& p value2.SetInt(watch_only ? 1 :0); // WTF ? JSON has different true and false types, and not boolean ?? json.AddMember("watch_only", value2, json.GetAllocator()); + value2.SetInt(m_always_confirm_transfers ? 1 :0); + json.AddMember("always_confirm_transfers", value2, json.GetAllocator()); + // Serialize the JSON object rapidjson::StringBuffer buffer; rapidjson::Writer<rapidjson::StringBuffer> writer(buffer); @@ -562,6 +565,7 @@ void wallet2::load_keys(const std::string& keys_file_name, const std::string& pa { is_old_file_format = true; m_watch_only = false; + m_always_confirm_transfers = false; } else { @@ -580,6 +584,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); } const cryptonote::account_keys& keys = m_account.get_keys(); diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index cae21463e..ff9c6567f 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -80,7 +80,7 @@ namespace tools class wallet2 { - wallet2(const wallet2&) : m_run(true), m_callback(0), m_testnet(false) {}; + wallet2(const wallet2&) : m_run(true), m_callback(0), m_testnet(false), m_always_confirm_transfers (false) {}; public: wallet2(bool testnet = false, bool restricted = false) : m_run(true), m_callback(0), m_testnet(testnet), m_restricted(restricted), is_old_file_format(false) {}; struct transfer_details @@ -266,6 +266,10 @@ namespace tools static std::vector<std::string> addresses_from_url(const std::string& url, bool& dnssec_valid); static std::string address_from_txt_record(const std::string& s); + + bool always_confirm_transfers() const { return m_always_confirm_transfers; } + void always_confirm_transfers(bool always) { m_always_confirm_transfers = always; } + private: /*! * \brief Stores wallet information to wallet file. @@ -319,6 +323,7 @@ namespace tools std::string seed_language; /*!< Language of the mnemonics (seed). */ bool is_old_file_format; /*!< Whether the wallet file is of an old file format */ bool m_watch_only; /*!< no spend key */ + bool m_always_confirm_transfers; }; } BOOST_CLASS_VERSION(tools::wallet2, 7) |