Merge pull request #2542

180a848c wallet2: Missing underflow check on low heights (landergate)
This commit is contained in:
Riccardo Spagni 2017-10-06 23:00:24 +04:00
commit 09ccd07bbc
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
1 changed files with 1 additions and 1 deletions

View File

@ -2228,7 +2228,7 @@ crypto::secret_key wallet2::generate(const std::string& wallet_, const std::stri
// Set blockchain height calculated from current date/time // Set blockchain height calculated from current date/time
uint64_t approx_blockchain_height = get_approximate_blockchain_height(); uint64_t approx_blockchain_height = get_approximate_blockchain_height();
if(approx_blockchain_height > 0) { 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); bool r = store_keys(m_keys_file, password, false);