diff options
author | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2024-01-11 18:47:54 +0100 |
---|---|---|
committer | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2024-03-11 13:49:25 +0100 |
commit | fa1d62434843866d242bff9f9c55cb838a4f0d83 (patch) | |
tree | 4e3700eee74471773d83528593a6c0a68525544a /src/index/txindex.cpp | |
parent | fa9a5e80ab86c997102a1c3d4ba017bbe86641d5 (diff) |
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-
Diffstat (limited to 'src/index/txindex.cpp')
-rw-r--r-- | src/index/txindex.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
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; |