aboutsummaryrefslogtreecommitdiff
path: root/src/node
diff options
context:
space:
mode:
authorpablomartin4btc <pablomartin4btc@gmail.com>2023-10-18 20:17:42 -0300
committerpablomartin4btc <pablomartin4btc@gmail.com>2023-10-24 23:39:10 -0300
commit4a5be10b928d4ed33d223972537c1cb79163e79c (patch)
tree885b96b28319f58cda99aca9fbddb97e18d69045 /src/node
parentd53400e75e2a4573229dba7f1a0da88eb936811c (diff)
downloadbitcoin-4a5be10b928d4ed33d223972537c1cb79163e79c.tar.xz
assumeutxo, blockstorage: prevent core dump on invalid hash
Diffstat (limited to 'src/node')
-rw-r--r--src/node/blockstorage.cpp7
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)};