diff options
author | Riccardo Spagni <ric@spagni.net> | 2018-04-28 16:54:37 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2018-04-28 16:54:37 +0200 |
commit | 35299644b20048264329bb36a235eb7c28fa1718 (patch) | |
tree | 5c17149a1c9019693961a999f129f9aeb1306282 | |
parent | Merge pull request #3670 (diff) | |
parent | import_multisig_info: fix sanity check crash in detach_blockchain (diff) | |
download | monero-35299644b20048264329bb36a235eb7c28fa1718.tar.xz |
Merge pull request #3650
5bd7f760 import_multisig_info: fix sanity check crash in detach_blockchain (Mikhail Mitkevichl)
-rw-r--r-- | src/wallet/wallet2.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index c26aecb14..c9934af68 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -2421,7 +2421,7 @@ void wallet2::detach_blockchain(uint64_t height) // size 1 2 3 4 5 6 7 8 9 // block 0 1 2 3 4 5 6 7 8 // C - THROW_WALLET_EXCEPTION_IF(height <= m_checkpoints.get_max_height() && m_blockchain.size() > m_checkpoints.get_max_height(), + THROW_WALLET_EXCEPTION_IF(height < m_blockchain.offset() && m_blockchain.size() > m_blockchain.offset(), error::wallet_internal_error, "Daemon claims reorg below last checkpoint"); size_t transfers_detached = 0; @@ -3875,6 +3875,11 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass void wallet2::trim_hashchain() { uint64_t height = m_checkpoints.get_max_height(); + + for (const transfer_details &td: m_transfers) + if (td.m_block_height < height) + height = td.m_block_height; + if (!m_blockchain.empty() && m_blockchain.size() == m_blockchain.offset()) { MINFO("Fixing empty hashchain"); |