Make NetworkUpgradeAvailable a method of Params

This commit is contained in:
Eirik Ogilvie-Wigley 2019-07-29 14:47:06 -06:00
parent 102dafdf89
commit 2c6c55261d
13 changed files with 93 additions and 101 deletions

View File

@ -367,6 +367,7 @@ libbitcoin_common_a_SOURCES = \
chainparams.cpp \
coins.cpp \
compressor.cpp \
consensus/params.cpp \
consensus/upgrades.cpp \
core_read.cpp \
core_write.cpp \

View File

@ -576,7 +576,7 @@ std::string CChainParams::GetFoundersRewardAddressAtHeight(int nHeight) const {
// FounderAddressAdjustedHeight(height) :=
// height, if not IsBlossomActivated(height)
// BlossomActivationHeight + floor((height - BlossomActivationHeight) / BlossomPoWTargetSpacingRatio), otherwise
bool blossomActive = NetworkUpgradeActive(nHeight, consensus, Consensus::UPGRADE_BLOSSOM);
bool blossomActive = consensus.NetworkUpgradeActive(nHeight, Consensus::UPGRADE_BLOSSOM);
if (blossomActive) {
int blossomActivationHeight = consensus.vUpgrades[Consensus::UPGRADE_BLOSSOM].nActivationHeight;
nHeight = blossomActivationHeight + ((nHeight - blossomActivationHeight) / Consensus::BLOSSOM_POW_TARGET_SPACING_RATIO);

50
src/consensus/params.cpp Normal file
View File

@ -0,0 +1,50 @@
#include "params.h"
#include "upgrades.h"
namespace Consensus {
bool Params::NetworkUpgradeActive(int nHeight, Consensus::UpgradeIndex idx) const {
return NetworkUpgradeState(nHeight, *this, idx) == UPGRADE_ACTIVE;
}
int Params::GetLastFoundersRewardBlockHeight(int nHeight) const {
// zip208
// FoundersRewardLastBlockHeight := max({ height ⦂ N | Halving(height) < 1 })
// H := blossom activation height; SS := SubsidySlowStartShift(); R := BLOSSOM_POW_TARGET_SPACING_RATIO
// preBlossom:
// 1 = (height - SS) / preInterval
// height = preInterval + SS
// postBlossom:
// 1 = (H - SS) / preInterval + (height - H) / postInterval
// height = H + postInterval + (SS - H) * (postInterval / preInterval)
// height = H + postInterval + (SS - H) / R
bool blossomActive = NetworkUpgradeActive(nHeight, Consensus::UPGRADE_BLOSSOM);
if (blossomActive) {
int blossomActivationHeight = vUpgrades[Consensus::UPGRADE_BLOSSOM].nActivationHeight;
return blossomActivationHeight + nPostBlossomSubsidyHalvingInterval
- (SubsidySlowStartShift() - blossomActivationHeight) / BLOSSOM_POW_TARGET_SPACING_RATIO - 1;
} else {
return nPreBlossomSubsidyHalvingInterval + SubsidySlowStartShift() - 1;
}
}
int64_t Params::PoWTargetSpacing(int nHeight) const {
// zip208
// PoWTargetSpacing(height) :=
// PreBlossomPoWTargetSpacing, if not IsBlossomActivated(height)
// PostBlossomPoWTargetSpacing, otherwise.
bool blossomActive = NetworkUpgradeActive(nHeight, Consensus::UPGRADE_BLOSSOM);
return blossomActive ? nPostBlossomPowTargetSpacing : nPreBlossomPowTargetSpacing;
}
int64_t Params::AveragingWindowTimespan(int nHeight) const {
return nPowAveragingWindow * PoWTargetSpacing(nHeight);
}
int64_t Params::MinActualTimespan(int nHeight) const {
return (AveragingWindowTimespan(nHeight) * (100 - nPowMaxAdjustUp)) / 100;
}
int64_t Params::MaxActualTimespan(int nHeight) const {
return (AveragingWindowTimespan(nHeight) * (100 + nPowMaxAdjustDown)) / 100;
}
}

View File

@ -10,14 +10,6 @@
#include <boost/optional.hpp>
// Forward declaration. Enum requires storage type.
namespace Consensus {
struct Params;
enum UpgradeIndex : uint32_t;
}
bool NetworkUpgradeActive(int nHeight, const Consensus::Params& params, Consensus::UpgradeIndex idx);
namespace Consensus {
/**
@ -83,6 +75,13 @@ static const unsigned int POST_BLOSSOM_REGTEST_HALVING_INTERVAL = PRE_BLOSSOM_RE
* Parameters that influence chain consensus.
*/
struct Params {
/**
* Returns true if the given network upgrade is active as of the given block
* height. Caller must check that the height is >= 0 (and handle unknown
* heights).
*/
bool NetworkUpgradeActive(int nHeight, Consensus::UpgradeIndex idx) const;
uint256 hashGenesisBlock;
bool fCoinbaseMustBeProtected;
@ -104,26 +103,7 @@ struct Params {
int nPreBlossomSubsidyHalvingInterval;
int nPostBlossomSubsidyHalvingInterval;
int GetLastFoundersRewardBlockHeight(int nHeight) const {
// zip208
// FoundersRewardLastBlockHeight := max({ height ⦂ N | Halving(height) < 1 })
// H := blossom activation height; SS := SubsidySlowStartShift(); R := BLOSSOM_POW_TARGET_SPACING_RATIO
// preBlossom:
// 1 = (height - SS) / preInterval
// height = preInterval + SS
// postBlossom:
// 1 = (H - SS) / preInterval + (height - H) / postInterval
// height = H + postInterval + (SS - H) * (postInterval / preInterval)
// height = H + postInterval + (SS - H) / R
bool blossomActive = NetworkUpgradeActive(nHeight, *this, Consensus::UPGRADE_BLOSSOM);
if (blossomActive) {
int blossomActivationHeight = vUpgrades[Consensus::UPGRADE_BLOSSOM].nActivationHeight;
return blossomActivationHeight + nPostBlossomSubsidyHalvingInterval
- (SubsidySlowStartShift() - blossomActivationHeight) / BLOSSOM_POW_TARGET_SPACING_RATIO - 1;
} else {
return nPreBlossomSubsidyHalvingInterval + SubsidySlowStartShift() - 1;
}
}
int GetLastFoundersRewardBlockHeight(int nHeight) const;
/** Used to check majorities for block version upgrade */
int nMajorityEnforceBlockUpgrade;
@ -141,25 +121,10 @@ struct Params {
int64_t nPreBlossomPowTargetSpacing;
int64_t nPostBlossomPowTargetSpacing;
int64_t PoWTargetSpacing(int nHeight) const {
// PoWTargetSpacing(height) :=
// PreBlossomPoWTargetSpacing, if not IsBlossomActivated(height)
// PostBlossomPoWTargetSpacing, otherwise.
bool blossomActive = NetworkUpgradeActive(nHeight, *this, Consensus::UPGRADE_BLOSSOM);
return blossomActive ? nPostBlossomPowTargetSpacing : nPreBlossomPowTargetSpacing;
}
int64_t AveragingWindowTimespan(int nHeight) const {
return nPowAveragingWindow * PoWTargetSpacing(nHeight);
}
int64_t MinActualTimespan(int nHeight) const {
return (AveragingWindowTimespan(nHeight) * (100 - nPowMaxAdjustUp)) / 100;
}
int64_t MaxActualTimespan(int nHeight) const {
return (AveragingWindowTimespan(nHeight) * (100 + nPowMaxAdjustDown)) / 100;
}
int64_t PoWTargetSpacing(int nHeight) const;
int64_t AveragingWindowTimespan(int nHeight) const;
int64_t MinActualTimespan(int nHeight) const;
int64_t MaxActualTimespan(int nHeight) const;
uint256 nMinimumChainWork;
};

View File

@ -65,17 +65,9 @@ UpgradeState NetworkUpgradeState(
}
}
bool NetworkUpgradeActive(
int nHeight,
const Consensus::Params& params,
Consensus::UpgradeIndex idx)
{
return NetworkUpgradeState(nHeight, params, idx) == UPGRADE_ACTIVE;
}
int CurrentEpoch(int nHeight, const Consensus::Params& params) {
for (auto idxInt = Consensus::MAX_NETWORK_UPGRADES - 1; idxInt >= Consensus::BASE_SPROUT; idxInt--) {
if (NetworkUpgradeActive(nHeight, params, Consensus::UpgradeIndex(idxInt))) {
if (params.NetworkUpgradeActive(nHeight, Consensus::UpgradeIndex(idxInt))) {
return idxInt;
}
}

View File

@ -38,16 +38,6 @@ UpgradeState NetworkUpgradeState(
const Consensus::Params& params,
Consensus::UpgradeIndex idx);
/**
* Returns true if the given network upgrade is active as of the given block
* height. Caller must check that the height is >= 0 (and handle unknown
* heights).
*/
bool NetworkUpgradeActive(
int nHeight,
const Consensus::Params& params,
Consensus::UpgradeIndex idx);
/**
* Returns the index of the most recent upgrade as of the given block height
* (corresponding to the current "epoch"). Consensus::BASE_SPROUT is the

View File

@ -657,8 +657,8 @@ unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans) EXCLUSIVE_LOCKS_REQUIRE
bool IsStandardTx(const CTransaction& tx, string& reason, const CChainParams& chainparams, const int nHeight)
{
bool overwinterActive = NetworkUpgradeActive(nHeight, chainparams.GetConsensus(), Consensus::UPGRADE_OVERWINTER);
bool saplingActive = NetworkUpgradeActive(nHeight, chainparams.GetConsensus(), Consensus::UPGRADE_SAPLING);
bool overwinterActive = chainparams.GetConsensus().NetworkUpgradeActive(nHeight, Consensus::UPGRADE_OVERWINTER);
bool saplingActive = chainparams.GetConsensus().NetworkUpgradeActive(nHeight, Consensus::UPGRADE_SAPLING);
if (saplingActive) {
// Sapling standard rules apply
@ -897,8 +897,8 @@ bool ContextualCheckTransaction(
const int dosLevel,
bool (*isInitBlockDownload)(const CChainParams&))
{
bool overwinterActive = NetworkUpgradeActive(nHeight, chainparams.GetConsensus(), Consensus::UPGRADE_OVERWINTER);
bool saplingActive = NetworkUpgradeActive(nHeight, chainparams.GetConsensus(), Consensus::UPGRADE_SAPLING);
bool overwinterActive = chainparams.GetConsensus().NetworkUpgradeActive(nHeight, Consensus::UPGRADE_OVERWINTER);
bool saplingActive = chainparams.GetConsensus().NetworkUpgradeActive(nHeight, Consensus::UPGRADE_SAPLING);
bool isSprout = !overwinterActive;
// If Sprout rules apply, reject transactions which are intended for Overwinter and beyond
@ -1367,7 +1367,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
// 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);
if (NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
if (Params().GetConsensus().NetworkUpgradeActive(nextBlockHeight, Consensus::UPGRADE_OVERWINTER)) {
limit = 0;
}
if (limit > 0) {
@ -1766,7 +1766,7 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
// Halving(height) :=
// floor((height - SlowStartShift) / PreBlossomHalvingInterval), if not IsBlossomActivated(height)
// floor((BlossomActivationHeight - SlowStartShift) / PreBlossomHalvingInterval + (height - BlossomActivationHeight) / PostBlossomHalvingInterval), otherwise
bool blossomActive = NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_BLOSSOM);
bool blossomActive = consensusParams.NetworkUpgradeActive(nHeight, Consensus::UPGRADE_BLOSSOM);
int halvings;
if (blossomActive) {
int blossomActivationHeight = consensusParams.vUpgrades[Consensus::UPGRADE_BLOSSOM].nActivationHeight;
@ -2392,7 +2392,7 @@ static DisconnectResult DisconnectBlock(const CBlock& block, CValidationState& s
// 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->nHeight, chainparams.GetConsensus(), Consensus::UPGRADE_SAPLING)) {
if (chainparams.GetConsensus().NetworkUpgradeActive(pindex->pprev->nHeight, Consensus::UPGRADE_SAPLING)) {
view.PopAnchor(pindex->pprev->hashFinalSaplingRoot, SAPLING);
} else {
view.PopAnchor(SaplingMerkleTree::empty_root(), SAPLING);
@ -2800,7 +2800,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
if (NetworkUpgradeActive(pindex->nHeight, chainparams.GetConsensus(), Consensus::UPGRADE_SAPLING)) {
if (chainparams.GetConsensus().NetworkUpgradeActive(pindex->nHeight, Consensus::UPGRADE_SAPLING)) {
if (block.hashFinalSaplingRoot != sapling_tree.root()) {
return state.DoS(100,
error("ConnectBlock(): block's hashFinalSaplingRoot is incorrect"),
@ -6670,7 +6670,7 @@ CMutableTransaction CreateNewContextualCMutableTransaction(const Consensus::Para
CMutableTransaction CreateNewContextualCMutableTransaction(const Consensus::Params& consensusParams, int nHeight, int nExpiryDelta) {
CMutableTransaction mtx;
bool isOverwintered = NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_OVERWINTER);
bool isOverwintered = consensusParams.NetworkUpgradeActive(nHeight, Consensus::UPGRADE_OVERWINTER);
if (isOverwintered) {
mtx.fOverwintered = true;
mtx.nExpiryHeight = nHeight + nExpiryDelta;
@ -6683,7 +6683,7 @@ CMutableTransaction CreateNewContextualCMutableTransaction(const Consensus::Para
// of the current epoch (see below: Overwinter->Sapling), the transaction will be rejected if it falls within
// the expiring soon threshold of 3 blocks (for DoS mitigation) based on the current height.
// TODO: Generalise this code so behaviour applies to all post-Overwinter epochs
if (NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_SAPLING)) {
if (consensusParams.NetworkUpgradeActive(nHeight, Consensus::UPGRADE_SAPLING)) {
mtx.nVersionGroupId = SAPLING_VERSION_GROUP_ID;
mtx.nVersion = SAPLING_TX_VERSION;
} else {

View File

@ -531,7 +531,7 @@ UniValue createrawtransaction(const UniValue& params, bool fHelp)
}
if (params.size() > 3 && !params[3].isNull()) {
if (NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
if (Params().GetConsensus().NetworkUpgradeActive(nextBlockHeight, Consensus::UPGRADE_OVERWINTER)) {
int64_t nExpiryHeight = params[3].get_int64();
if (nExpiryHeight < 0 || nExpiryHeight >= TX_EXPIRY_HEIGHT_THRESHOLD) {
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("Invalid parameter, expiryheight must be nonnegative and less than %d.", TX_EXPIRY_HEIGHT_THRESHOLD));
@ -1046,7 +1046,7 @@ UniValue sendrawtransaction(const UniValue& params, bool fHelp)
// DoS mitigation: reject transactions expiring soon
if (tx.nExpiryHeight > 0) {
int nextBlockHeight = chainActive.Height() + 1;
if (NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
if (Params().GetConsensus().NetworkUpgradeActive(nextBlockHeight, Consensus::UPGRADE_OVERWINTER)) {
if (nextBlockHeight + TX_EXPIRING_SOON_THRESHOLD > tx.nExpiryHeight) {
throw JSONRPCError(RPC_TRANSACTION_REJECTED,
strprintf("tx-expiring-soon: expiryheight is %d but should be at least %d to avoid transaction expiring soon",

View File

@ -217,7 +217,7 @@ bool AsyncRPCOperation_mergetoaddress::main_impl()
size_t limit = (size_t)GetArg("-mempooltxinputlimit", 0);
{
LOCK(cs_main);
if (NetworkUpgradeActive(chainActive.Height() + 1, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
if (Params().GetConsensus().NetworkUpgradeActive(chainActive.Height() + 1, Consensus::UPGRADE_OVERWINTER)) {
limit = 0;
}
}

View File

@ -318,7 +318,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
size_t limit = (size_t)GetArg("-mempooltxinputlimit", 0);
{
LOCK(cs_main);
if (NetworkUpgradeActive(chainActive.Height() + 1, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
if (Params().GetConsensus().NetworkUpgradeActive(chainActive.Height() + 1, Consensus::UPGRADE_OVERWINTER)) {
limit = 0;
}
}

View File

@ -180,7 +180,7 @@ bool AsyncRPCOperation_shieldcoinbase::main_impl() {
size_t limit = (size_t)GetArg("-mempooltxinputlimit", 0);
{
LOCK(cs_main);
if (NetworkUpgradeActive(chainActive.Height() + 1, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
if (Params().GetConsensus().NetworkUpgradeActive(chainActive.Height() + 1, Consensus::UPGRADE_OVERWINTER)) {
limit = 0;
}
}

View File

@ -3790,8 +3790,8 @@ UniValue z_sendmany(const UniValue& params, bool fHelp)
mtx.nVersionGroupId = SAPLING_VERSION_GROUP_ID;
mtx.nVersion = SAPLING_TX_VERSION;
unsigned int max_tx_size = MAX_TX_SIZE_AFTER_SAPLING;
if (!NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
if (NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
if (!Params().GetConsensus().NetworkUpgradeActive(nextBlockHeight, Consensus::UPGRADE_SAPLING)) {
if (Params().GetConsensus().NetworkUpgradeActive(nextBlockHeight, Consensus::UPGRADE_OVERWINTER)) {
mtx.nVersionGroupId = OVERWINTER_VERSION_GROUP_ID;
mtx.nVersion = OVERWINTER_TX_VERSION;
} else {
@ -3805,10 +3805,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp)
if (zaddrRecipients.size() > Z_SENDMANY_MAX_ZADDR_OUTPUTS_BEFORE_SAPLING) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, too many zaddr outputs");
}
}
// If Sapling is not active, do not allow sending from or sending to Sapling addresses.
if (!NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
// If Sapling is not active, do not allow sending from or sending to Sapling addresses.
if (fromSapling || containsSaplingOutput) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, Sapling has not activated");
}
@ -4122,15 +4119,12 @@ UniValue z_shieldcoinbase(const UniValue& params, bool fHelp)
}
int nextBlockHeight = chainActive.Height() + 1;
bool overwinterActive = NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER);
bool overwinterActive = Params().GetConsensus().NetworkUpgradeActive(nextBlockHeight, Consensus::UPGRADE_OVERWINTER);
unsigned int max_tx_size = MAX_TX_SIZE_AFTER_SAPLING;
if (!NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
if (!Params().GetConsensus().NetworkUpgradeActive(nextBlockHeight, Consensus::UPGRADE_SAPLING)) {
max_tx_size = MAX_TX_SIZE_BEFORE_SAPLING;
}
// If Sapling is not active, do not allow sending to a Sapling address.
if (!NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
auto res = DecodePaymentAddress(destaddress);
// If Sapling is not active, do not allow sending to a Sapling address.
if (IsValidPaymentAddress(res)) {
bool toSapling = boost::get<libzcash::SaplingPaymentAddress>(&res) != nullptr;
if (toSapling) {
@ -4388,8 +4382,8 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp)
}
const int nextBlockHeight = chainActive.Height() + 1;
const bool overwinterActive = NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER);
const bool saplingActive = NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING);
const bool overwinterActive = Params().GetConsensus().NetworkUpgradeActive(nextBlockHeight, Consensus::UPGRADE_OVERWINTER);
const bool saplingActive = Params().GetConsensus().NetworkUpgradeActive(nextBlockHeight, Consensus::UPGRADE_SAPLING);
// Validate the destination address
auto destaddress = params[1].get_str();

View File

@ -595,7 +595,7 @@ void CWallet::ChainTip(const CBlockIndex *pindex,
}
void CWallet::RunSaplingMigration(int blockHeight) {
if (!NetworkUpgradeActive(blockHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
if (!Params().GetConsensus().NetworkUpgradeActive(blockHeight, Consensus::UPGRADE_SAPLING)) {
return;
}
LOCK(cs_wallet);
@ -2526,7 +2526,7 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
// state on the path to the tip of our chain
assert(pcoinsTip->GetSproutAnchorAt(pindex->hashSproutAnchor, sproutTree));
if (pindex->pprev) {
if (NetworkUpgradeActive(pindex->pprev->nHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
if (Params().GetConsensus().NetworkUpgradeActive(pindex->pprev->nHeight, Consensus::UPGRADE_SAPLING)) {
assert(pcoinsTip->GetSaplingAnchorAt(pindex->pprev->hashFinalSaplingRoot, saplingTree));
}
}
@ -3303,7 +3303,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
Params().GetConsensus(), nextBlockHeight);
// Activates after Overwinter network upgrade
if (NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
if (Params().GetConsensus().NetworkUpgradeActive(nextBlockHeight, Consensus::UPGRADE_OVERWINTER)) {
if (txNew.nExpiryHeight >= TX_EXPIRY_HEIGHT_THRESHOLD){
strFailReason = _("nExpiryHeight must be less than TX_EXPIRY_HEIGHT_THRESHOLD.");
return false;
@ -3311,7 +3311,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
}
unsigned int max_tx_size = MAX_TX_SIZE_AFTER_SAPLING;
if (!NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
if (!Params().GetConsensus().NetworkUpgradeActive(nextBlockHeight, Consensus::UPGRADE_SAPLING)) {
max_tx_size = MAX_TX_SIZE_BEFORE_SAPLING;
}
@ -3502,7 +3502,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
size_t limit = (size_t)GetArg("-mempooltxinputlimit", 0);
{
LOCK(cs_main);
if (NetworkUpgradeActive(chainActive.Height() + 1, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
if (Params().GetConsensus().NetworkUpgradeActive(chainActive.Height() + 1, Consensus::UPGRADE_OVERWINTER)) {
limit = 0;
}
}