Skip to content

Commit f7efd87

Browse files
committed
Change brace formatting
Suggested bitcoin/bitcoin#15288 (review)
1 parent a1df1b4 commit f7efd87

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

src/wallet/rpcdump.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,9 @@ UniValue importprivkey(const JSONRPCRequest& request)
157157
if (!request.params[2].isNull())
158158
fRescan = request.params[2].get_bool();
159159

160-
if (fRescan && pwallet->chain().getPruneMode())
160+
if (fRescan && pwallet->chain().getPruneMode()) {
161161
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode");
162+
}
162163

163164
if (fRescan && !reserver.reserve()) {
164165
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet is currently rescanning. Abort existing rescan or wait.");
@@ -313,8 +314,9 @@ UniValue importaddress(const JSONRPCRequest& request)
313314
if (!request.params[2].isNull())
314315
fRescan = request.params[2].get_bool();
315316

316-
if (fRescan && pwallet->chain().getPruneMode())
317+
if (fRescan && pwallet->chain().getPruneMode()) {
317318
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode");
319+
}
318320

319321
WalletRescanReserver reserver(pwallet);
320322
if (fRescan && !reserver.reserve()) {
@@ -501,8 +503,9 @@ UniValue importpubkey(const JSONRPCRequest& request)
501503
if (!request.params[2].isNull())
502504
fRescan = request.params[2].get_bool();
503505

504-
if (fRescan && pwallet->chain().getPruneMode())
506+
if (fRescan && pwallet->chain().getPruneMode()) {
505507
throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode");
508+
}
506509

507510
WalletRescanReserver reserver(pwallet);
508511
if (fRescan && !reserver.reserve()) {
@@ -562,8 +565,9 @@ UniValue importwallet(const JSONRPCRequest& request)
562565
},
563566
}.ToString());
564567

565-
if (pwallet->chain().getPruneMode())
568+
if (pwallet->chain().getPruneMode()) {
566569
throw JSONRPCError(RPC_WALLET_ERROR, "Importing wallets is disabled in pruned mode");
570+
}
567571

568572
WalletRescanReserver reserver(pwallet);
569573
if (!reserver.reserve()) {

src/wallet/rpcwallet.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -628,8 +628,9 @@ static UniValue getreceivedbyaddress(const JSONRPCRequest& request)
628628
CAmount nAmount = 0;
629629
for (const std::pair<const uint256, CWalletTx>& pairWtx : pwallet->mapWallet) {
630630
const CWalletTx& wtx = pairWtx.second;
631-
if (wtx.IsCoinBase() || !locked_chain->checkFinalTx(*wtx.tx))
631+
if (wtx.IsCoinBase() || !locked_chain->checkFinalTx(*wtx.tx)) {
632632
continue;
633+
}
633634

634635
for (const CTxOut& txout : wtx.tx->vout)
635636
if (txout.scriptPubKey == scriptPubKey)
@@ -693,8 +694,9 @@ static UniValue getreceivedbylabel(const JSONRPCRequest& request)
693694
CAmount nAmount = 0;
694695
for (const std::pair<const uint256, CWalletTx>& pairWtx : pwallet->mapWallet) {
695696
const CWalletTx& wtx = pairWtx.second;
696-
if (wtx.IsCoinBase() || !locked_chain->checkFinalTx(*wtx.tx))
697+
if (wtx.IsCoinBase() || !locked_chain->checkFinalTx(*wtx.tx)) {
697698
continue;
699+
}
698700

699701
for (const CTxOut& txout : wtx.tx->vout)
700702
{
@@ -1078,8 +1080,9 @@ static UniValue ListReceived(interfaces::Chain::Lock& locked_chain, CWallet * co
10781080
for (const std::pair<const uint256, CWalletTx>& pairWtx : pwallet->mapWallet) {
10791081
const CWalletTx& wtx = pairWtx.second;
10801082

1081-
if (wtx.IsCoinBase() || !locked_chain.checkFinalTx(*wtx.tx))
1083+
if (wtx.IsCoinBase() || !locked_chain.checkFinalTx(*wtx.tx)) {
10821084
continue;
1085+
}
10831086

10841087
int nDepth = wtx.GetDepthInMainChain(locked_chain);
10851088
if (nDepth < nMinDepth)
@@ -2690,8 +2693,9 @@ static UniValue resendwallettransactions(const JSONRPCRequest& request)
26902693
}.ToString()
26912694
);
26922695

2693-
if (!pwallet->chain().p2pEnabled())
2696+
if (!pwallet->chain().p2pEnabled()) {
26942697
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
2698+
}
26952699

26962700
auto locked_chain = pwallet->chain().lock();
26972701
LOCK(pwallet->cs_wallet);

src/wallet/wallet.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2073,8 +2073,9 @@ bool CWalletTx::InMempool() const
20732073
bool CWalletTx::IsTrusted(interfaces::Chain::Lock& locked_chain) const
20742074
{
20752075
// Quick answer in most cases
2076-
if (!locked_chain.checkFinalTx(*tx))
2076+
if (!locked_chain.checkFinalTx(*tx)) {
20772077
return false;
2078+
}
20782079
int nDepth = GetDepthInMainChain(locked_chain);
20792080
if (nDepth >= 1)
20802081
return true;
@@ -2129,8 +2130,9 @@ std::vector<uint256> CWallet::ResendWalletTransactionsBefore(interfaces::Chain::
21292130
for (const std::pair<const unsigned int, CWalletTx*>& item : mapSorted)
21302131
{
21312132
CWalletTx& wtx = *item.second;
2132-
if (wtx.RelayWalletTransaction(locked_chain))
2133+
if (wtx.RelayWalletTransaction(locked_chain)) {
21332134
result.push_back(wtx.GetHash());
2135+
}
21342136
}
21352137
return result;
21362138
}
@@ -2319,8 +2321,9 @@ void CWallet::AvailableCoins(interfaces::Chain::Lock& locked_chain, std::vector<
23192321
const uint256& wtxid = entry.first;
23202322
const CWalletTx* pcoin = &entry.second;
23212323

2322-
if (!locked_chain.checkFinalTx(*pcoin->tx))
2324+
if (!locked_chain.checkFinalTx(*pcoin->tx)) {
23232325
continue;
2326+
}
23242327

23252328
if (pcoin->IsImmatureCoinBase(locked_chain))
23262329
continue;
@@ -4331,8 +4334,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
43314334
//We can't rescan beyond non-pruned blocks, stop and throw an error
43324335
//this might happen if a user uses an old wallet within a pruned node
43334336
// or if he ran -disablewallet for a longer time, then decided to re-enable
4334-
if (chain.getPruneMode())
4335-
{
4337+
if (chain.getPruneMode()) {
43364338
int block_height = *tip_height;
43374339
while (block_height > 0 && locked_chain->haveBlockOnDisk(block_height - 1) && rescan_height != block_height) {
43384340
--block_height;

0 commit comments

Comments
 (0)