rpc: Document getblock RPC finalorchardroot field, omit before NU5

This commit is contained in:
Jack Grigg 2021-06-20 22:30:18 +01:00
parent 92d6984842
commit 62dce234be
1 changed files with 9 additions and 1 deletions

View File

@ -222,6 +222,9 @@ UniValue blockToDeltasJSON(const CBlock& block, const CBlockIndex* blockindex)
UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool txDetails = false)
{
AssertLockHeld(cs_main);
bool nu5Active = Params().GetConsensus().NetworkUpgradeActive(
blockindex->nHeight, Consensus::UPGRADE_NU5);
UniValue result(UniValue::VOBJ);
result.pushKV("hash", block.GetHash().GetHex());
int confirmations = -1;
@ -236,7 +239,9 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx
result.pushKV("blockcommitments", blockindex->hashBlockCommitments.GetHex());
result.pushKV("authdataroot", blockindex->hashAuthDataRoot.GetHex());
result.pushKV("finalsaplingroot", blockindex->hashFinalSaplingRoot.GetHex());
result.pushKV("finalorchardroot", blockindex->hashFinalOrchardRoot.GetHex());
if (nu5Active) {
result.pushKV("finalorchardroot", blockindex->hashFinalOrchardRoot.GetHex());
}
result.pushKV("chainhistoryroot", blockindex->hashChainHistoryRoot.GetHex());
UniValue txs(UniValue::VARR);
for (const CTransaction&tx : block.vtx)
@ -707,6 +712,9 @@ UniValue getblock(const UniValue& params, bool fHelp)
" \"version\" : n, (numeric) The block version\n"
" \"merkleroot\" : \"xxxx\", (string) The merkle root\n"
" \"finalsaplingroot\" : \"xxxx\", (string) The root of the Sapling commitment tree after applying this block\n"
" \"finalorchardroot\" : \"xxxx\", (string) The root of the Orchard commitment tree after applying this block.\n"
" Omitted for blocks prior to NU5 activation. This will be the null\n"
" hash if this block has never been connected to a main chain.\n"
" \"tx\" : [ (array of string) The transaction ids\n"
" \"transactionid\" (string) The transaction id\n"
" ,...\n"