From fa1d62434843866d242bff9f9c55cb838a4f0d83 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Thu, 11 Jan 2024 18:47:54 +0100 Subject: scripted-diff: return error(...); ==> error(...); return false; This is needed for the next commit. -BEGIN VERIFY SCRIPT- # Separate sed invocations to replace one-line, and two-line error(...) calls sed -i --regexp-extended 's!( +)return (error\(.*\);)!\1\2\n\1return false;!g' $( git grep -l 'return error(' ) sed -i --null-data --regexp-extended 's!( +)return (error\([^\n]*\n[^\n]*\);)!\1\2\n\1return false;!g' $( git grep -l 'return error(' ) -END VERIFY SCRIPT- --- src/index/txindex.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/index/txindex.cpp') diff --git a/src/index/txindex.cpp b/src/index/txindex.cpp index 4983926e68..b95e1362df 100644 --- a/src/index/txindex.cpp +++ b/src/index/txindex.cpp @@ -81,20 +81,24 @@ bool TxIndex::FindTx(const uint256& tx_hash, uint256& block_hash, CTransactionRe AutoFile file{m_chainstate->m_blockman.OpenBlockFile(postx, true)}; if (file.IsNull()) { - return error("%s: OpenBlockFile failed", __func__); + error("%s: OpenBlockFile failed", __func__); + return false; } CBlockHeader header; try { file >> header; if (fseek(file.Get(), postx.nTxOffset, SEEK_CUR)) { - return error("%s: fseek(...) failed", __func__); + error("%s: fseek(...) failed", __func__); + return false; } file >> TX_WITH_WITNESS(tx); } catch (const std::exception& e) { - return error("%s: Deserialize or I/O error - %s", __func__, e.what()); + error("%s: Deserialize or I/O error - %s", __func__, e.what()); + return false; } if (tx->GetHash() != tx_hash) { - return error("%s: txid mismatch", __func__); + error("%s: txid mismatch", __func__); + return false; } block_hash = header.GetHash(); return true; -- cgit v1.2.3