Fix sapling pool persistence and add subsidy/fees to getblock RPC
Lower SPROUT_VALUE_VERSION and SAPLING_VALUE_VERSION constants in chain.h from upstream Zcash values (1001400/1010100) to 1000000. When DragonX was rebranded from HUSH3, CLIENT_VERSION was reset from 3.10.5 to 1.0.0, falling below these thresholds. This caused nSaplingValue to silently skip serialization, so the sapling pool total reset to 0 on every node restart. Explorer nodes should reindex once after upgrading. Add subsidy and fees fields to the getblock RPC response so explorers can display the correct 3 DRGX block reward separately from fees, instead of showing the combined coinbase output as the reward.
This commit is contained in:
@@ -322,6 +322,15 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx
|
||||
result.push_back(Pair("anchor", blockindex->hashFinalSproutRoot.GetHex()));
|
||||
result.push_back(Pair("blocktype", "mined"));
|
||||
|
||||
// Report block subsidy and fees separately so explorers don't have to
|
||||
// reimplement the reward schedule to display them.
|
||||
CAmount nSubsidy = GetBlockSubsidy(blockindex->GetHeight(), Params().GetConsensus());
|
||||
CAmount nCoinbase = block.vtx[0].GetValueOut();
|
||||
CAmount nFees = nCoinbase - nSubsidy;
|
||||
if (nFees < 0) nFees = 0; // block 1 has premine, avoid negative
|
||||
result.push_back(Pair("subsidy", ValueFromAmount(nSubsidy)));
|
||||
result.push_back(Pair("fees", ValueFromAmount(nFees)));
|
||||
|
||||
UniValue valuePools(UniValue::VARR);
|
||||
valuePools.push_back(ValuePoolDesc("sapling", blockindex->nChainSaplingValue, blockindex->nSaplingValue));
|
||||
result.push_back(Pair("valuePools", valuePools));
|
||||
|
||||
Reference in New Issue
Block a user