Skip to content

Commit fa9a5e8

Browse files
author
MarcoFalke
committed
refactor: Add missing {} around error() calls
This is required for the next commit to be correct.
1 parent 4a90374 commit fa9a5e8

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

src/index/blockfilterindex.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ bool BlockFilterIndex::ReadFilterFromDisk(const FlatFilePos& pos, const uint256&
159159
std::vector<uint8_t> encoded_filter;
160160
try {
161161
filein >> block_hash >> encoded_filter;
162-
if (Hash(encoded_filter) != hash) return error("Checksum mismatch in filter decode.");
162+
if (Hash(encoded_filter) != hash) {
163+
return error("Checksum mismatch in filter decode.");
164+
}
163165
filter = BlockFilter(GetFilterType(), block_hash, std::move(encoded_filter), /*skip_decode_check=*/true);
164166
}
165167
catch (const std::exception& e) {

src/netbase.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,9 @@ bool Socks5(const std::string& strDest, uint16_t port, const ProxyCredentials* a
364364
// Perform username/password authentication (as described in RFC1929)
365365
std::vector<uint8_t> vAuth;
366366
vAuth.push_back(0x01); // Current (and only) version of user/pass subnegotiation
367-
if (auth->username.size() > 255 || auth->password.size() > 255)
367+
if (auth->username.size() > 255 || auth->password.size() > 255) {
368368
return error("Proxy username or password too long");
369+
}
369370
vAuth.push_back(auth->username.size());
370371
vAuth.insert(vAuth.end(), auth->username.begin(), auth->username.end());
371372
vAuth.push_back(auth->password.size());
@@ -429,7 +430,9 @@ bool Socks5(const std::string& strDest, uint16_t port, const ProxyCredentials* a
429430
recvr = InterruptibleRecv(pchRet3, nRecv, g_socks5_recv_timeout, sock);
430431
break;
431432
}
432-
default: return error("Error: malformed proxy response");
433+
default: {
434+
return error("Error: malformed proxy response");
435+
}
433436
}
434437
if (recvr != IntrRecvError::OK) {
435438
return error("Error reading from proxy");

src/script/signingprovider.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,9 @@ bool FillableSigningProvider::GetKey(const CKeyID &address, CKey &keyOut) const
157157

158158
bool FillableSigningProvider::AddCScript(const CScript& redeemScript)
159159
{
160-
if (redeemScript.size() > MAX_SCRIPT_ELEMENT_SIZE)
160+
if (redeemScript.size() > MAX_SCRIPT_ELEMENT_SIZE) {
161161
return error("FillableSigningProvider::AddCScript(): redeemScripts > %i bytes are invalid", MAX_SCRIPT_ELEMENT_SIZE);
162+
}
162163

163164
LOCK(cs_KeyStore);
164165
mapScripts[CScriptID(redeemScript)] = redeemScript;

src/validation.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2830,8 +2830,9 @@ bool Chainstate::DisconnectTip(BlockValidationState& state, DisconnectedBlockTra
28302830
{
28312831
CCoinsViewCache view(&CoinsTip());
28322832
assert(view.GetBestBlock() == pindexDelete->GetBlockHash());
2833-
if (DisconnectBlock(block, pindexDelete, view) != DISCONNECT_OK)
2833+
if (DisconnectBlock(block, pindexDelete, view) != DISCONNECT_OK) {
28342834
return error("DisconnectTip(): DisconnectBlock %s failed", pindexDelete->GetBlockHash().ToString());
2835+
}
28352836
bool flushed = view.Flush();
28362837
assert(flushed);
28372838
}
@@ -4358,12 +4359,15 @@ bool TestBlockValidity(BlockValidationState& state,
43584359
indexDummy.phashBlock = &block_hash;
43594360

43604361
// NOTE: CheckBlockHeader is called by CheckBlock
4361-
if (!ContextualCheckBlockHeader(block, state, chainstate.m_blockman, chainstate.m_chainman, pindexPrev))
4362+
if (!ContextualCheckBlockHeader(block, state, chainstate.m_blockman, chainstate.m_chainman, pindexPrev)) {
43624363
return error("%s: Consensus::ContextualCheckBlockHeader: %s", __func__, state.ToString());
4363-
if (!CheckBlock(block, state, chainparams.GetConsensus(), fCheckPOW, fCheckMerkleRoot))
4364+
}
4365+
if (!CheckBlock(block, state, chainparams.GetConsensus(), fCheckPOW, fCheckMerkleRoot)) {
43644366
return error("%s: Consensus::CheckBlock: %s", __func__, state.ToString());
4365-
if (!ContextualCheckBlock(block, state, chainstate.m_chainman, pindexPrev))
4367+
}
4368+
if (!ContextualCheckBlock(block, state, chainstate.m_chainman, pindexPrev)) {
43664369
return error("%s: Consensus::ContextualCheckBlock: %s", __func__, state.ToString());
4370+
}
43674371
if (!chainstate.ConnectBlock(block, state, &indexDummy, viewNew, true)) {
43684372
return false;
43694373
}
@@ -4591,7 +4595,9 @@ bool Chainstate::ReplayBlocks()
45914595

45924596
std::vector<uint256> hashHeads = db.GetHeadBlocks();
45934597
if (hashHeads.empty()) return true; // We're already in a consistent state.
4594-
if (hashHeads.size() != 2) return error("ReplayBlocks(): unknown inconsistent state");
4598+
if (hashHeads.size() != 2) {
4599+
return error("ReplayBlocks(): unknown inconsistent state");
4600+
}
45954601

45964602
m_chainman.GetNotifications().progress(_("Replaying blocks…"), 0, false);
45974603
LogPrintf("Replaying blocks\n");

0 commit comments

Comments
 (0)