Only return active protocol components from z_gettreestate.
This adds checks that exclude both the Sapling and Orchard portions of the result if the associated network upgrades are not yet active. Fixes #5957
This commit is contained in:
parent
09b02bedc9
commit
c44e58ea51
|
@ -1316,6 +1316,7 @@ UniValue z_gettreestate(const UniValue& params, bool fHelp)
|
|||
UniValue sapling_result(UniValue::VOBJ);
|
||||
UniValue sapling_commitments(UniValue::VOBJ);
|
||||
sapling_commitments.pushKV("finalRoot", pindex->hashFinalSaplingRoot.GetHex());
|
||||
if (Params().GetConsensus().NetworkUpgradeActive(pindex->nHeight, Consensus::UPGRADE_SAPLING)) {
|
||||
bool need_skiphash = false;
|
||||
SaplingMerkleTree tree;
|
||||
if (pcoinsTip->GetSaplingAnchorAt(pindex->hashFinalSaplingRoot, tree)) {
|
||||
|
@ -1332,6 +1333,7 @@ UniValue z_gettreestate(const UniValue& params, bool fHelp)
|
|||
sapling_result.pushKV("skipHash", pindex_skip->GetBlockHash().GetHex());
|
||||
}
|
||||
}
|
||||
}
|
||||
sapling_result.pushKV("commitments", sapling_commitments);
|
||||
res.pushKV("sapling", sapling_result);
|
||||
}
|
||||
|
@ -1341,6 +1343,7 @@ UniValue z_gettreestate(const UniValue& params, bool fHelp)
|
|||
UniValue orchard_result(UniValue::VOBJ);
|
||||
UniValue orchard_commitments(UniValue::VOBJ);
|
||||
orchard_commitments.pushKV("finalRoot", pindex->hashFinalOrchardRoot.GetHex());
|
||||
if (Params().GetConsensus().NetworkUpgradeActive(pindex->nHeight, Consensus::UPGRADE_NU5)) {
|
||||
bool need_skiphash = false;
|
||||
OrchardMerkleFrontier tree;
|
||||
if (pcoinsTip->GetOrchardAnchorAt(pindex->hashFinalOrchardRoot, tree)) {
|
||||
|
@ -1357,6 +1360,7 @@ UniValue z_gettreestate(const UniValue& params, bool fHelp)
|
|||
orchard_result.pushKV("skipHash", pindex_skip->GetBlockHash().GetHex());
|
||||
}
|
||||
}
|
||||
}
|
||||
orchard_result.pushKV("commitments", orchard_commitments);
|
||||
res.pushKV("orchard", orchard_result);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue