aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-09-02 11:29:53 +0200
committerRiccardo Spagni <ric@spagni.net>2017-09-02 11:29:53 +0200
commit2560948f6936faa28e93603f6156f183d2762662 (patch)
tree26fa88bc6c3f05e397532cf88a484d8963d5b809 /src/wallet
parentMerge pull request #2329 (diff)
parentwallet2: account for huge testnet reorgs for estimating height (diff)
downloadmonero-2560948f6936faa28e93603f6156f183d2762662.tar.xz
Merge pull request #2342
2e338ca5 wallet2: account for huge testnet reorgs for estimating height (moneromooo-monero)
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet2.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 4f21e3e77..4feef21ed 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -5098,6 +5098,9 @@ uint64_t wallet2::get_approximate_blockchain_height() const
const int seconds_per_block = DIFFICULTY_TARGET_V2;
// Calculated blockchain height
uint64_t approx_blockchain_height = fork_block + (time(NULL) - fork_time)/seconds_per_block;
+ // testnet got some huge rollbacks, so the estimation is way off
+ if (m_testnet && approx_blockchain_height > 105000)
+ approx_blockchain_height -= 105000;
LOG_PRINT_L2("Calculated blockchain height: " << approx_blockchain_height);
return approx_blockchain_height;
}