aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-08-04 12:37:39 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-08-22 09:57:39 +0000
commit5b6bcca32a8b6e5a926888131af5c42203af055f (patch)
tree5bb23f2962221b297302df35cec172a0b5127c4d
parentMerge pull request #4191 (diff)
downloadmonero-5b6bcca32a8b6e5a926888131af5c42203af055f.tar.xz
wallet2: fix checking the wrong vector when adding hashes
The two vectors should be the same size anyway, so add an assert to catch any case where they aren't
Diffstat (limited to '')
-rw-r--r--src/wallet/wallet2.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 9deaad09b..7ef49c27d 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -1976,9 +1976,11 @@ void wallet2::pull_and_parse_next_blocks(uint64_t start_height, uint64_t &blocks
{
drop_from_short_history(short_chain_history, 3);
+ THROW_WALLET_EXCEPTION_IF(prev_blocks.size() != prev_parsed_blocks.size(), error::wallet_internal_error, "size mismatch");
+
// prepend the last 3 blocks, should be enough to guard against a block or two's reorg
std::vector<parsed_block>::const_reverse_iterator i = prev_parsed_blocks.rbegin();
- for (size_t n = 0; n < std::min((size_t)3, prev_blocks.size()); ++n)
+ for (size_t n = 0; n < std::min((size_t)3, prev_parsed_blocks.size()); ++n)
{
short_chain_history.push_front(i->hash);
++i;