diff options
author | landergate <landergate@landergate.com> | 2017-09-27 14:17:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-27 14:17:48 +0300 |
commit | 180a848cbeba64c563bb0f09318b875e2b80a236 (patch) | |
tree | 4cc58dee445f602fec36b9b52620eaf25a436054 /src/wallet/wallet2.cpp | |
parent | Merge pull request #2533 (diff) | |
download | monero-180a848cbeba64c563bb0f09318b875e2b80a236.tar.xz |
wallet2: Missing underflow check on low heights
Lack of it results in `m_refresh_from_block_height` being < 0 (18446744...) on low heights, which blocks `process_new_blockchain_entry` and never process coins on heights less than blocks_per_month.
Follow-up to #2258
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r-- | src/wallet/wallet2.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 8daf26292..4ad8ea2c1 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -2209,7 +2209,7 @@ crypto::secret_key wallet2::generate(const std::string& wallet_, const std::stri // Set blockchain height calculated from current date/time uint64_t approx_blockchain_height = get_approximate_blockchain_height(); if(approx_blockchain_height > 0) { - m_refresh_from_block_height = approx_blockchain_height - blocks_per_month; + m_refresh_from_block_height = approx_blockchain_height >= blocks_per_month ? approx_blockchain_height - blocks_per_month : 0; } } bool r = store_keys(m_keys_file, password, false); |