diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-06-26 06:54:53 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-06-26 06:58:31 +0100 |
commit | 32754784dbacf3e9f30d0aaab0f656c4df32744b (patch) | |
tree | 49dd0aa36c0c08338b76f4f11fa7a8c5c4b2ba3c /src | |
parent | Merge pull request #2111 (diff) | |
download | monero-32754784dbacf3e9f30d0aaab0f656c4df32744b.tar.xz |
wallet: fix refresh_from_height setting on new wallet
The previous patch was based on a wrong premise (that the
daemon height was 0 because the daemon calling code wasn't
yet initialized). In fact, current height approximation
was not setup for testnet. Fix this.
Diffstat (limited to 'src')
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 12 | ||||
-rw-r--r-- | src/wallet/wallet2.cpp | 5 |
2 files changed, 2 insertions, 15 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 4d53f063e..fa584b8a7 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -920,8 +920,6 @@ static bool might_be_partial_seed(std::string words) //---------------------------------------------------------------------------------------------------- bool simple_wallet::init(const boost::program_options::variables_map& vm) { - bool need_refresh_height = false; - if (!handle_command_line(vm)) return false; @@ -1119,8 +1117,6 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm) m_wallet_file = m_generate_new; bool r = new_wallet(vm, m_recovery_key, m_restore_deterministic_wallet, m_non_deterministic, old_language); CHECK_AND_ASSERT_MES(r, false, tr("account creation failed")); - if (!m_restore_deterministic_wallet) - need_refresh_height = true; } if (!m_restore_height && m_restoring) { @@ -1213,14 +1209,6 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm) m_http_client.set_server(m_wallet->get_daemon_address(), m_wallet->get_daemon_login()); m_wallet->callback(this); - if (need_refresh_height) - { - // for a totally new account, we don't care about older blocks. - MDEBUG("Calling daemon to set refresh height"); - std::string err; - m_wallet->set_refresh_from_block_height(get_daemon_blockchain_height(err)); - } - return true; } //---------------------------------------------------------------------------------------------------- diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index ee2b6055c..3cbe4cfe7 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -5010,11 +5010,10 @@ uint64_t wallet2::get_daemon_blockchain_target_height(string &err) uint64_t wallet2::get_approximate_blockchain_height() const { - if (m_testnet) return 0; // time of v2 fork - const time_t fork_time = 1458748658; + const time_t fork_time = m_testnet ? 1448285909 : 1458748658; // v2 fork block - const uint64_t fork_block = 1009827; + const uint64_t fork_block = m_testnet ? 624634 : 1009827; // avg seconds per block const int seconds_per_block = DIFFICULTY_TARGET_V2; // Calculated blockchain height |