Skip to content

Commit

Permalink
assumeutxo, blockstorage: prevent core dump on invalid hash
Browse files Browse the repository at this point in the history
Github-Pull: #28698
Rebased-from: 4a5be10
  • Loading branch information
pablomartin4btc authored and fanquake committed Oct 31, 2023
1 parent d3ebf6e commit b761a58
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/node/blockstorage.cpp
Expand Up @@ -387,7 +387,12 @@ bool BlockManager::LoadBlockIndex(const std::optional<uint256>& snapshot_blockha
}

if (snapshot_blockhash) {
const AssumeutxoData au_data = *Assert(GetParams().AssumeutxoForBlockhash(*snapshot_blockhash));
const std::optional<AssumeutxoData> maybe_au_data = GetParams().AssumeutxoForBlockhash(*snapshot_blockhash);
if (!maybe_au_data) {
m_opts.notifications.fatalError(strprintf("Assumeutxo data not found for the given blockhash '%s'.", snapshot_blockhash->ToString()));
return false;
}
const AssumeutxoData& au_data = *Assert(maybe_au_data);
m_snapshot_height = au_data.height;
CBlockIndex* base{LookupBlockIndex(*snapshot_blockhash)};

Expand Down

0 comments on commit b761a58

Please sign in to comment.