diff options
author | pablomartin4btc <pablomartin4btc@gmail.com> | 2023-10-18 20:17:42 -0300 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2023-10-31 17:07:52 +0000 |
commit | b761a58171f2a7b2249211840aeb203a37dc8b13 (patch) | |
tree | 84213b4903e85ac0b6bcf976555dfe5488627982 /src | |
parent | d3ebf6e9fcb8459695ea58cc2a551c0a7b1dd881 (diff) |
assumeutxo, blockstorage: prevent core dump on invalid hash
Github-Pull: #28698
Rebased-from: 4a5be10b928d4ed33d223972537c1cb79163e79c
Diffstat (limited to 'src')
-rw-r--r-- | src/node/blockstorage.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp index 53f616de23..058e524745 100644 --- a/src/node/blockstorage.cpp +++ b/src/node/blockstorage.cpp @@ -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)}; |