1
0
Fork 0
forked from lthn/blockchain

added safety code for GUI

This commit is contained in:
crypro.zoidberg 2019-04-04 19:49:16 +02:00
parent 04baa73b0a
commit 4bdc4865f7
3 changed files with 240 additions and 22 deletions

View file

@ -98,7 +98,7 @@ namespace currency
//cut the last timestamp word from restore_dats
std::list<std::string> words;
boost::split(words, restore_data_, boost::is_space());
CHECK_AND_ASSERT_THROW_MES(words.size() == BRAINWALLET_DEFAULT_WORDS_COUNT, "Words count missmatch: " << words.size());
CHECK_AND_ASSERT_MES(words.size() == BRAINWALLET_DEFAULT_WORDS_COUNT, false, "Words count missmatch: " << words.size());
std::string timestamp_word = words.back();
words.erase(--words.end());

View file

@ -1212,7 +1212,7 @@ namespace currency
//---------------------------------------------------------------
std::string get_word_from_timstamp(uint64_t timestamp)
{
uint64_t date_offset = timestamp ? timestamp - WALLET_BRAIN_DATE_OFFSET : 0;
uint64_t date_offset = timestamp > WALLET_BRAIN_DATE_OFFSET ? timestamp - WALLET_BRAIN_DATE_OFFSET : 0;
uint64_t weeks_count = date_offset / WALLET_BRAIN_DATE_QUANTUM;
CHECK_AND_ASSERT_THROW_MES(weeks_count < std::numeric_limits<uint32_t>::max(), "internal error: unable to converto to uint32, val = " << weeks_count);
uint32_t weeks_count_32 = static_cast<uint32_t>(weeks_count);

File diff suppressed because it is too large Load diff