mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Add braces to submitblock per current style.
This commit is contained in:
parent
4f15ea102d
commit
30f30c0f99
@ -720,7 +720,7 @@ protected:
|
||||
|
||||
UniValue submitblock(const JSONRPCRequest& request)
|
||||
{
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
|
||||
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2) {
|
||||
throw std::runtime_error(
|
||||
"submitblock \"hexdata\" ( \"jsonparametersobject\" )\n"
|
||||
"\nAttempts to submit new block to network.\n"
|
||||
@ -738,11 +738,13 @@ UniValue submitblock(const JSONRPCRequest& request)
|
||||
+ HelpExampleCli("submitblock", "\"mydata\"")
|
||||
+ HelpExampleRpc("submitblock", "\"mydata\"")
|
||||
);
|
||||
}
|
||||
|
||||
std::shared_ptr<CBlock> blockptr = std::make_shared<CBlock>();
|
||||
CBlock& block = *blockptr;
|
||||
if (!DecodeHexBlk(block, request.params[0].get_str()))
|
||||
if (!DecodeHexBlk(block, request.params[0].get_str())) {
|
||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed");
|
||||
}
|
||||
|
||||
if (block.vtx.empty() || !block.vtx[0]->IsCoinBase()) {
|
||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block does not start with a coinbase");
|
||||
@ -755,10 +757,12 @@ UniValue submitblock(const JSONRPCRequest& request)
|
||||
BlockMap::iterator mi = mapBlockIndex.find(hash);
|
||||
if (mi != mapBlockIndex.end()) {
|
||||
CBlockIndex *pindex = mi->second;
|
||||
if (pindex->IsValid(BLOCK_VALID_SCRIPTS))
|
||||
if (pindex->IsValid(BLOCK_VALID_SCRIPTS)) {
|
||||
return "duplicate";
|
||||
if (pindex->nStatus & BLOCK_FAILED_MASK)
|
||||
}
|
||||
if (pindex->nStatus & BLOCK_FAILED_MASK) {
|
||||
return "duplicate-invalid";
|
||||
}
|
||||
// Otherwise, we might only have the header - process the block before returning
|
||||
fBlockPresent = true;
|
||||
}
|
||||
@ -776,14 +780,15 @@ UniValue submitblock(const JSONRPCRequest& request)
|
||||
RegisterValidationInterface(&sc);
|
||||
bool fAccepted = ProcessNewBlock(Params(), blockptr, true, NULL);
|
||||
UnregisterValidationInterface(&sc);
|
||||
if (fBlockPresent)
|
||||
{
|
||||
if (fAccepted && !sc.found)
|
||||
if (fBlockPresent) {
|
||||
if (fAccepted && !sc.found) {
|
||||
return "duplicate-inconclusive";
|
||||
}
|
||||
return "duplicate";
|
||||
}
|
||||
if (!sc.found)
|
||||
if (!sc.found) {
|
||||
return "inconclusive";
|
||||
}
|
||||
return BIP22ValidationResult(sc.state);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user