Sapling and Overwinter network upgrades are always active

These NU's are always active for Hush Arrakis Chains so this code only serves
to slow down all operations by constantly being checked. So we disable them
which will speed up syncing, mining and creating transactions.
This commit is contained in:
Duke
2024-01-21 16:34:53 -05:00
parent b0b9565d6a
commit 27db254d68
9 changed files with 48 additions and 24 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)
{
bool overwinterActive = true; //NetworkUpgradeActive(nHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER);
bool saplingActive = true; //NetworkUpgradeActive(nHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING);
const bool overwinterActive = true; //NetworkUpgradeActive(nHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER);
const bool saplingActive = true; //NetworkUpgradeActive(nHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING);
if (saplingActive) {
// Sapling standard rules apply
@@ -1220,9 +1220,9 @@ bool ContextualCheckTransaction(int32_t slowflag,const CBlock *block, CBlockInde
const int dosLevel,
bool (*isInitBlockDownload)(),int32_t validateprices)
{
bool overwinterActive = true; //NetworkUpgradeActive(nHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER);
bool saplingActive = true; //NetworkUpgradeActive(nHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING);
bool isSprout = false; //!overwinterActive;
const bool overwinterActive = true; //NetworkUpgradeActive(nHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER);
const bool saplingActive = true; //NetworkUpgradeActive(nHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING);
const bool isSprout = false; //!overwinterActive;
// If Sprout rules apply, reject transactions which are intended for Overwinter and beyond
if (isSprout && tx.fOverwintered) {
@@ -1728,11 +1728,12 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
if ( nextBlockHeight <= 1 || chainActive.LastTip() == 0 )
tiptime = (uint32_t)time(NULL);
else tiptime = (uint32_t)chainActive.LastTip()->nTime;
/*
// Node operator can choose to reject tx by number of transparent inputs
static_assert(std::numeric_limits<size_t>::max() >= std::numeric_limits<int64_t>::max(), "size_t too small");
size_t limit = (size_t) GetArg("-mempooltxinputlimit", 0);
// Limit is ignored if Overwinter is active, which is the case on HUSH3 and all HSC's
const size_t limit = 0; //(size_t) GetArg("-mempooltxinputlimit", 0);
// Limit is ignored if Overwinter is active, which is the case on HUSH3 and all HAC's
if (NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
limit = 0;
}
@@ -1743,6 +1744,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
return false;
}
}
*/
auto verifier = libzcash::ProofVerifier::Strict();
if (!CheckTransaction(tiptime,tx, state, verifier, 0, 0))
@@ -3071,7 +3073,8 @@ 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.
if (NetworkUpgradeActive(pindex->pprev->GetHeight(), Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
const bool sapling = true; // NetworkUpgradeActive(pindex->pprev->GetHeight(), Params().GetConsensus(), Consensus::UPGRADE_SAPLING);
if (sapling) {
view.PopAnchor(pindex->pprev->hashFinalSaplingRoot, SAPLING);
} else {
view.PopAnchor(SaplingMerkleTree::empty_root(), SAPLING);
@@ -3489,7 +3492,8 @@ 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
if (NetworkUpgradeActive(pindex->GetHeight(), chainparams.GetConsensus(), Consensus::UPGRADE_SAPLING)) {
const bool sapling = true; //NetworkUpgradeActive(pindex->GetHeight(), chainparams.GetConsensus(), Consensus::UPGRADE_SAPLING);
if (sapling) {
if (block.hashFinalSaplingRoot != sapling_tree.root()) {
return state.DoS(100,
error("ConnectBlock(): block's hashFinalSaplingRoot is incorrect"),
@@ -8214,7 +8218,8 @@ CMutableTransaction CreateNewContextualCMutableTransaction(const Consensus::Para
{
mtx.fOverwintered = true;
mtx.nExpiryHeight = nHeight + expiryDelta;
if (NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_SAPLING))
const bool sapling = true;
if (sapling) // NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_SAPLING))
{
mtx.nVersionGroupId = SAPLING_VERSION_GROUP_ID;
mtx.nVersion = SAPLING_TX_VERSION;