diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 593530af0..065e61448 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -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"