Skip to content

Commit 4a5be10

Browse files
assumeutxo, blockstorage: prevent core dump on invalid hash
1 parent d53400e commit 4a5be10

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/node/blockstorage.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,12 @@ bool BlockManager::LoadBlockIndex(const std::optional<uint256>& snapshot_blockha
387387
}
388388

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

0 commit comments

Comments
 (0)