Do not apply overwinter/sapling consensus rules to block 0

This commit is contained in:
Duke
2024-02-15 10:40:22 -05:00
parent b14070d15b
commit 07b041fd94
7 changed files with 27 additions and 21 deletions

View File

@@ -931,8 +931,8 @@ unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans) EXCLUSIVE_LOCKS_REQUIRE
bool IsStandardTx(const CTransaction& tx, string& reason, const int nHeight)
{
const bool overwinterActive = true; //NetworkUpgradeActive(nHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER);
const bool saplingActive = true; //NetworkUpgradeActive(nHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING);
const bool overwinterActive = nHeight>=1 ? true : false; //NetworkUpgradeActive(nHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER);
const bool saplingActive = nHeight>=1 ? true : false; //NetworkUpgradeActive(nHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING);
if (saplingActive) {
// Sapling standard rules apply
@@ -3073,7 +3073,7 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex
// However, this is only reliable if the last block was on or after
// the Sapling activation height. Otherwise, the last anchor was the
// empty root.
const bool sapling = true; // NetworkUpgradeActive(pindex->pprev->GetHeight(), Params().GetConsensus(), Consensus::UPGRADE_SAPLING);
const bool sapling = pindex->pprev->GetHeight() >= 1 ? true : false; // NetworkUpgradeActive(pindex->pprev->GetHeight(), Params().GetConsensus(), Consensus::UPGRADE_SAPLING);
if (sapling) {
view.PopAnchor(pindex->pprev->hashFinalSaplingRoot, SAPLING);
} else {
@@ -3492,7 +3492,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
// If Sapling is active, block.hashFinalSaplingRoot must be the
// same as the root of the Sapling tree
const bool sapling = true; //NetworkUpgradeActive(pindex->GetHeight(), chainparams.GetConsensus(), Consensus::UPGRADE_SAPLING);
const bool sapling = pindex->GetHeight()>=1 ? true : false; //NetworkUpgradeActive(pindex->GetHeight(), chainparams.GetConsensus(), Consensus::UPGRADE_SAPLING);
if (sapling) {
if (block.hashFinalSaplingRoot != sapling_tree.root()) {
return state.DoS(100,
@@ -5219,7 +5219,7 @@ bool ContextualCheckBlock(int32_t slowflag,const CBlock& block, CValidationState
{
const int nHeight = pindexPrev == NULL ? 0 : pindexPrev->GetHeight() + 1;
const Consensus::Params& consensusParams = Params().GetConsensus();
bool sapling = true; //NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_SAPLING);
// bool sapling = nHeight>=1 ? true : false; //NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_SAPLING);
// Check that all transactions are finalized
for (uint32_t i = 0; i < block.vtx.size(); i++) {
@@ -8214,12 +8214,12 @@ CMutableTransaction CreateNewContextualCMutableTransaction(const Consensus::Para
mtx.nVersionGroupId = SAPLING_VERSION_GROUP_ID;
mtx.nVersion = SAPLING_TX_VERSION;
} else {
bool isOverwintered = true; //NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_OVERWINTER);
const bool isOverwintered = nHeight>=1 ? true : false; //NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_OVERWINTER);
if (isOverwintered)
{
mtx.fOverwintered = true;
mtx.nExpiryHeight = nHeight + expiryDelta;
const bool sapling = true;
const bool sapling = nHeight>=1 ? true : false;
if (sapling) // NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_SAPLING))
{
mtx.nVersionGroupId = SAPLING_VERSION_GROUP_ID;