diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-11-22 19:03:10 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-11-22 19:03:10 +0000 |
commit | 9b945f52111cdb22fb17e7fe5cba223ebb8be2af (patch) | |
tree | 23062b088392cf70a66464b5e04d2b42603558ad /src/wallet | |
parent | wallet: speedup refresh from daemon (diff) | |
download | monero-9b945f52111cdb22fb17e7fe5cba223ebb8be2af.tar.xz |
wallet: make the refresh optimizations selectable via command line
Take the opportunity to add a no-coinbase case too, for even faster
sync when an address is known to never have mined to.
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/wallet2.cpp | 6 | ||||
-rw-r--r-- | src/wallet/wallet2.h | 17 |
2 files changed, 20 insertions, 3 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 9f9dcb999..a6ac860c7 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -204,7 +204,11 @@ void wallet2::process_new_transaction(const cryptonote::transaction& tx, uint64_ tx_pub_key = pub_key_field.pub_key; bool r = true; int threads; - if (miner_tx) + if (miner_tx && m_refresh_type == RefreshNoCoinbase) + { + // assume coinbase isn't for us + } + else if (miner_tx && m_refresh_type == RefreshOptimizeCoinbase) { for (size_t i = 0; i < tx.vout.size(); ++i) { diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 03a368445..e036020b8 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -79,9 +79,18 @@ namespace tools class wallet2 { - wallet2(const wallet2&) : m_run(true), m_callback(0), m_testnet(false), m_always_confirm_transfers (false), m_store_tx_info(true), 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_info(true), m_default_mixin(0) {} + enum RefreshType { + RefreshFull, + RefreshOptimizeCoinbase, + RefreshNoCoinbase, + }; + + private: + wallet2(const wallet2&) : m_run(true), m_callback(0), m_testnet(false), m_always_confirm_transfers (false), m_store_tx_info(true), m_default_mixin(0), m_refresh_type(RefreshOptimizeCoinbase) {} + + 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_info(true), m_default_mixin(0), m_refresh_type(RefreshOptimizeCoinbase) {} struct transfer_details { uint64_t m_block_height; @@ -234,6 +243,9 @@ namespace tools void refresh(uint64_t start_height, uint64_t & blocks_fetched, bool& received_money); bool refresh(uint64_t & blocks_fetched, bool& received_money, bool& ok); + void set_refresh_type(RefreshType refresh_type) { m_refresh_type = refresh_type; } + RefreshType get_refresh_type(RefreshType refresh_type) const { return m_refresh_type; } + bool testnet() const { return m_testnet; } bool restricted() const { return m_restricted; } bool watch_only() const { return m_watch_only; } @@ -384,6 +396,7 @@ namespace tools bool m_always_confirm_transfers; bool m_store_tx_info; /*!< request txkey to be returned in RPC, and store in the wallet cache file */ uint32_t m_default_mixin; + RefreshType m_refresh_type; }; } BOOST_CLASS_VERSION(tools::wallet2, 10) |