Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Update verifybmm RPC & help text
Browse files Browse the repository at this point in the history
* Print more specific errors if we cannot read block from disk yet

* Print error if a commit is found for the wrong h* for same sidechain

* Break loop once commit is found

* Update help text
  • Loading branch information
CryptAxe committed May 6, 2024
1 parent 4e87259 commit dd2d017
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/rpc/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ UniValue verifybmm(const JSONRPCRequest& request)
CBlock block;
if(!ReadBlockFromDisk(block, pblockindex, Params().GetConsensus()))
{
std::string strError = "Failed to read block from disk";
std::string strError = "Failed to read block from disk - try again later";
LogPrintf("%s: %s\n", __func__, strError);
throw JSONRPCError(RPC_MISC_ERROR, strError);
}
Expand Down Expand Up @@ -1225,12 +1225,19 @@ UniValue verifybmm(const JSONRPCRequest& request)
continue;

// Check prev block bytes
if (strPrevBlock != block.hashPrevBlock.ToString().substr(56, 63))
if (strPrevBlock != block.hashPrevBlock.ToString().substr(56, 63)) {
LogPrintf("%s: Skipping BMM commit for sidechain %u with invalid prevbytes\n", __func__, nSidechain);
continue;
}

// Check h*
if (hashBMM == data.hashCritical)
if (hashBMM == data.hashCritical) {
fBMMFound = true;
break;
} else {
LogPrintf("%s: Skipping BMM commit for sidechain %u with invalid h*\n", __func__, nSidechain);
continue;
}
}

if (!fBMMFound) {
Expand Down Expand Up @@ -1259,8 +1266,8 @@ UniValue verifydeposit(const JSONRPCRequest& request)
"2. \"txid\" (string, required) deposit txid to locate\n"
"3. \"nTx\" (int, required) deposit tx number in block\n"
"\nExamples:\n"
+ HelpExampleCli("verifybmm", "\"blockhash\", \"txid\"")
+ HelpExampleRpc("verifybmm", "\"blockhash\", \"txid\"")
+ HelpExampleCli("verifydeposit", "\"blockhash\", \"txid\", \"nTx\"")
+ HelpExampleRpc("verifydeposit", "\"blockhash\", \"txid\", \"nTx\"")
);

uint256 hashBlock = uint256S(request.params[0].get_str());
Expand Down

0 comments on commit dd2d017

Please sign in to comment.