Skip to content

Commit 30f30c0

Browse files
committed
Add braces to submitblock per current style.
1 parent 4f15ea1 commit 30f30c0

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/rpc/mining.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ class submitblock_StateCatcher : public CValidationInterface
720720

721721
UniValue submitblock(const JSONRPCRequest& request)
722722
{
723-
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
723+
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
724724
throw std::runtime_error(
725725
"submitblock \"hexdata\" ( \"jsonparametersobject\" )\n"
726726
"\nAttempts to submit new block to network.\n"
@@ -738,11 +738,13 @@ UniValue submitblock(const JSONRPCRequest& request)
738738
+ HelpExampleCli("submitblock", "\"mydata\"")
739739
+ HelpExampleRpc("submitblock", "\"mydata\"")
740740
);
741+
}
741742

742743
std::shared_ptr<CBlock> blockptr = std::make_shared<CBlock>();
743744
CBlock& block = *blockptr;
744-
if (!DecodeHexBlk(block, request.params[0].get_str()))
745+
if (!DecodeHexBlk(block, request.params[0].get_str())) {
745746
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed");
747+
}
746748

747749
if (block.vtx.empty() || !block.vtx[0]->IsCoinBase()) {
748750
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block does not start with a coinbase");
@@ -755,10 +757,12 @@ UniValue submitblock(const JSONRPCRequest& request)
755757
BlockMap::iterator mi = mapBlockIndex.find(hash);
756758
if (mi != mapBlockIndex.end()) {
757759
CBlockIndex *pindex = mi->second;
758-
if (pindex->IsValid(BLOCK_VALID_SCRIPTS))
760+
if (pindex->IsValid(BLOCK_VALID_SCRIPTS)) {
759761
return "duplicate";
760-
if (pindex->nStatus & BLOCK_FAILED_MASK)
762+
}
763+
if (pindex->nStatus & BLOCK_FAILED_MASK) {
761764
return "duplicate-invalid";
765+
}
762766
// Otherwise, we might only have the header - process the block before returning
763767
fBlockPresent = true;
764768
}
@@ -776,14 +780,15 @@ UniValue submitblock(const JSONRPCRequest& request)
776780
RegisterValidationInterface(&sc);
777781
bool fAccepted = ProcessNewBlock(Params(), blockptr, true, NULL);
778782
UnregisterValidationInterface(&sc);
779-
if (fBlockPresent)
780-
{
781-
if (fAccepted && !sc.found)
783+
if (fBlockPresent) {
784+
if (fAccepted && !sc.found) {
782785
return "duplicate-inconclusive";
786+
}
783787
return "duplicate";
784788
}
785-
if (!sc.found)
789+
if (!sc.found) {
786790
return "inconclusive";
791+
}
787792
return BIP22ValidationResult(sc.state);
788793
}
789794

0 commit comments

Comments
 (0)