Skip to content

Commit 6a82526

Browse files
committed
wallet2: add tree-sync sanity check
Reported by hacksandhops
1 parent cca5425 commit 6a82526

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/wallet/wallet2.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3914,6 +3914,7 @@ void wallet2::pull_and_parse_next_blocks(bool check_pool, uint64_t &blocks_start
39143914
const std::size_t expected_sync_end_height = m_blockchain.size();
39153915
THROW_WALLET_EXCEPTION_IF(blocks_start_height >= expected_sync_end_height, error::wallet_internal_error, "expected higher synced height than first returned block");
39163916
const std::size_t grow_tree_n_blocks = expected_sync_end_height - blocks_start_height;
3917+
THROW_WALLET_EXCEPTION_IF(grow_tree_n_blocks > parsed_blocks.size(), error::wallet_internal_error, "daemon returned fewer blocks than needed to grow the tree to the synced height");
39173918
const std::vector<parsed_block> blocks_slice(parsed_blocks.begin(), parsed_blocks.begin() + grow_tree_n_blocks);
39183919

39193920
const TreeSyncStartParams tree_sync_start_params{

0 commit comments

Comments
 (0)