From c017fff2ec9667d0d9675704eddf9cfd76803212 Mon Sep 17 00:00:00 2001 From: selsta Date: Sat, 19 Sep 2026 20:39:06 +0200 Subject: [PATCH] wallet2: validate block hash when repairing empty hashchain (cherry picked from commit ef7bdda92af255270a61e4ea4c6c7fe098a70dd0) --- src/wallet/wallet2.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index f40902823..a5f76604f 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -6828,7 +6828,8 @@ void wallet2::trim_hashchain() if (m_node_rpc_proxy.get_block_header_by_height(m_blockchain.size() - 1, block_header)) throw std::runtime_error("Failed to request block header by height"); crypto::hash hash; - epee::string_tools::hex_to_pod(block_header.hash, hash); + THROW_WALLET_EXCEPTION_IF(!epee::string_tools::hex_to_pod(block_header.hash, hash), + error::wallet_internal_error, "Daemon returned an invalid block hash"); m_blockchain.refill(hash); } catch(...)