refactor: Add missing {} around error() calls

This is required for the next commit to be correct.
This commit is contained in:
MarcoFalke 2024-01-11 18:34:56 +01:00
parent 4a903741b0
commit fa9a5e80ab
No known key found for this signature in database
4 changed files with 21 additions and 9 deletions

View File

@ -159,7 +159,9 @@ bool BlockFilterIndex::ReadFilterFromDisk(const FlatFilePos& pos, const uint256&
std::vector<uint8_t> encoded_filter;
try {
filein >> block_hash >> encoded_filter;
if (Hash(encoded_filter) != hash) return error("Checksum mismatch in filter decode.");
if (Hash(encoded_filter) != hash) {
return error("Checksum mismatch in filter decode.");
}
filter = BlockFilter(GetFilterType(), block_hash, std::move(encoded_filter), /*skip_decode_check=*/true);
}
catch (const std::exception& e) {

View File

@ -364,8 +364,9 @@ bool Socks5(const std::string& strDest, uint16_t port, const ProxyCredentials* a
// Perform username/password authentication (as described in RFC1929)
std::vector<uint8_t> vAuth;
vAuth.push_back(0x01); // Current (and only) version of user/pass subnegotiation
if (auth->username.size() > 255 || auth->password.size() > 255)
if (auth->username.size() > 255 || auth->password.size() > 255) {
return error("Proxy username or password too long");
}
vAuth.push_back(auth->username.size());
vAuth.insert(vAuth.end(), auth->username.begin(), auth->username.end());
vAuth.push_back(auth->password.size());
@ -429,7 +430,9 @@ bool Socks5(const std::string& strDest, uint16_t port, const ProxyCredentials* a
recvr = InterruptibleRecv(pchRet3, nRecv, g_socks5_recv_timeout, sock);
break;
}
default: return error("Error: malformed proxy response");
default: {
return error("Error: malformed proxy response");
}
}
if (recvr != IntrRecvError::OK) {
return error("Error reading from proxy");

View File

@ -157,8 +157,9 @@ bool FillableSigningProvider::GetKey(const CKeyID &address, CKey &keyOut) const
bool FillableSigningProvider::AddCScript(const CScript& redeemScript)
{
if (redeemScript.size() > MAX_SCRIPT_ELEMENT_SIZE)
if (redeemScript.size() > MAX_SCRIPT_ELEMENT_SIZE) {
return error("FillableSigningProvider::AddCScript(): redeemScripts > %i bytes are invalid", MAX_SCRIPT_ELEMENT_SIZE);
}
LOCK(cs_KeyStore);
mapScripts[CScriptID(redeemScript)] = redeemScript;

View File

@ -2830,8 +2830,9 @@ bool Chainstate::DisconnectTip(BlockValidationState& state, DisconnectedBlockTra
{
CCoinsViewCache view(&CoinsTip());
assert(view.GetBestBlock() == pindexDelete->GetBlockHash());
if (DisconnectBlock(block, pindexDelete, view) != DISCONNECT_OK)
if (DisconnectBlock(block, pindexDelete, view) != DISCONNECT_OK) {
return error("DisconnectTip(): DisconnectBlock %s failed", pindexDelete->GetBlockHash().ToString());
}
bool flushed = view.Flush();
assert(flushed);
}
@ -4358,12 +4359,15 @@ bool TestBlockValidity(BlockValidationState& state,
indexDummy.phashBlock = &block_hash;
// NOTE: CheckBlockHeader is called by CheckBlock
if (!ContextualCheckBlockHeader(block, state, chainstate.m_blockman, chainstate.m_chainman, pindexPrev))
if (!ContextualCheckBlockHeader(block, state, chainstate.m_blockman, chainstate.m_chainman, pindexPrev)) {
return error("%s: Consensus::ContextualCheckBlockHeader: %s", __func__, state.ToString());
if (!CheckBlock(block, state, chainparams.GetConsensus(), fCheckPOW, fCheckMerkleRoot))
}
if (!CheckBlock(block, state, chainparams.GetConsensus(), fCheckPOW, fCheckMerkleRoot)) {
return error("%s: Consensus::CheckBlock: %s", __func__, state.ToString());
if (!ContextualCheckBlock(block, state, chainstate.m_chainman, pindexPrev))
}
if (!ContextualCheckBlock(block, state, chainstate.m_chainman, pindexPrev)) {
return error("%s: Consensus::ContextualCheckBlock: %s", __func__, state.ToString());
}
if (!chainstate.ConnectBlock(block, state, &indexDummy, viewNew, true)) {
return false;
}
@ -4591,7 +4595,9 @@ bool Chainstate::ReplayBlocks()
std::vector<uint256> hashHeads = db.GetHeadBlocks();
if (hashHeads.empty()) return true; // We're already in a consistent state.
if (hashHeads.size() != 2) return error("ReplayBlocks(): unknown inconsistent state");
if (hashHeads.size() != 2) {
return error("ReplayBlocks(): unknown inconsistent state");
}
m_chainman.GetNotifications().progress(_("Replaying blocks…"), 0, false);
LogPrintf("Replaying blocks\n");