diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-10-30 21:16:51 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-10-30 21:16:51 +0000 |
commit | c7dc6ef8e8bc20404fce62de2987cf9f93b56c6d (patch) | |
tree | a92eaf7467203230f4addf396881228a600b19fc /src/wallet | |
parent | Merge pull request #465 (diff) | |
download | monero-c7dc6ef8e8bc20404fce62de2987cf9f93b56c6d.tar.xz |
simplewallet: add a set default-mixin command
The default default mixin is 4. It can now be changed per wallet.
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/wallet2.cpp | 5 | ||||
-rw-r--r-- | src/wallet/wallet2.h | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index a068dfbf3..834095539 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -543,6 +543,9 @@ bool wallet2::store_keys(const std::string& keys_file_name, const std::string& p value2.SetInt(m_store_tx_keys ? 1 :0); json.AddMember("store_tx_keys", value2, json.GetAllocator()); + value2.SetUint(m_default_mixin); + json.AddMember("default_mixin", value2, json.GetAllocator()); + // Serialize the JSON object rapidjson::StringBuffer buffer; rapidjson::Writer<rapidjson::StringBuffer> writer(buffer); @@ -604,6 +607,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; + m_default_mixin = 0; } else { @@ -624,6 +628,7 @@ void wallet2::load_keys(const std::string& keys_file_name, const std::string& pa } 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); + m_default_mixin = json.HasMember("default_mixin") ? json["default_mixin"].GetUint() : 0; } const cryptonote::account_keys& keys = m_account.get_keys(); diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 91c2cf094..c9732cdd6 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -79,9 +79,9 @@ namespace tools class wallet2 { - wallet2(const wallet2&) : m_run(true), m_callback(0), m_testnet(false), m_always_confirm_transfers (false), m_store_tx_keys(false) {}; + wallet2(const wallet2&) : m_run(true), m_callback(0), m_testnet(false), m_always_confirm_transfers (false), m_store_tx_keys(false), m_default_mixin(0) {} 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), m_store_tx_keys(false) {}; + wallet2(bool testnet = false, bool restricted = false) : m_run(true), m_callback(0), m_testnet(testnet), m_restricted(restricted), is_old_file_format(false), m_store_tx_keys(false), m_default_mixin(0) {} struct transfer_details { uint64_t m_block_height; @@ -293,6 +293,8 @@ namespace tools void always_confirm_transfers(bool always) { m_always_confirm_transfers = always; } bool store_tx_keys() const { return m_store_tx_keys; } void store_tx_keys(bool store) { m_store_tx_keys = store; } + uint32_t default_mixin() const { return m_default_mixin; } + void default_mixin(uint32_t m) { m_default_mixin = m; } bool get_tx_key(const crypto::hash &txid, crypto::secret_key &tx_key) const; @@ -353,6 +355,7 @@ namespace tools bool m_watch_only; /*!< no spend key */ bool m_always_confirm_transfers; bool m_store_tx_keys; /*!< request txkey to be returned in RPC, and store in the wallet cache file */ + uint32_t m_default_mixin; }; } BOOST_CLASS_VERSION(tools::wallet2, 8) |