aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2024-01-11 18:34:56 +0100
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2024-03-11 13:49:25 +0100
commitfa9a5e80ab86c997102a1c3d4ba017bbe86641d5 (patch)
tree2ff82dc65e56b1b130a3c812b9230d4ffdc6d1df
parent4a903741b0bc128745b1096586329456d1f1c447 (diff)
downloadbitcoin-fa9a5e80ab86c997102a1c3d4ba017bbe86641d5.tar.xz
refactor: Add missing {} around error() calls
This is required for the next commit to be correct.
-rw-r--r--src/index/blockfilterindex.cpp4
-rw-r--r--src/netbase.cpp7
-rw-r--r--src/script/signingprovider.cpp3
-rw-r--r--src/validation.cpp16
4 files changed, 21 insertions, 9 deletions
diff --git a/src/index/blockfilterindex.cpp b/src/index/blockfilterindex.cpp
index 58f777b326..226d9a178e 100644
--- a/src/index/blockfilterindex.cpp
+++ b/src/index/blockfilterindex.cpp
@@ -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) {
diff --git a/src/netbase.cpp b/src/netbase.cpp
index 9fbd9f7dea..9fe4e0f1b6 100644
--- a/src/netbase.cpp
+++ b/src/netbase.cpp
@@ -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");
diff --git a/src/script/signingprovider.cpp b/src/script/signingprovider.cpp
index ff02ab5a12..bdbe932a44 100644
--- a/src/script/signingprovider.cpp
+++ b/src/script/signingprovider.cpp
@@ -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;
diff --git a/src/validation.cpp b/src/validation.cpp
index c15e660499..84941f894f 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -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");