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

@@ -511,6 +511,9 @@ void CWallet::RunSaplingSweep(int blockHeight) {
// if (!NetworkUpgradeActive(blockHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
// return;
// }
if (blockHeight == 0)
return;
AssertLockHeld(cs_wallet);
if (!fSweepEnabled) {
return;
@@ -3688,7 +3691,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
txNew.nLockTime = (uint32_t)chainActive.Tip()->GetMedianTimePast();
// Activates after Overwinter network upgrade
const bool overwinter = true;
const bool overwinter = nextBlockHeight >=1 ? true : false;
if (overwinter) { // NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
if (txNew.nExpiryHeight >= TX_EXPIRY_HEIGHT_THRESHOLD){
strFailReason = _("nExpiryHeight must be less than TX_EXPIRY_HEIGHT_THRESHOLD.");
@@ -3697,7 +3700,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
}
unsigned int max_tx_size = MAX_TX_SIZE_AFTER_SAPLING;
/* Sapling is always active
/* Sapling is always active since height=1
if (!NetworkUpgradeActive(nextBlockHeight, Params().GetConsensus(), Consensus::UPGRADE_SAPLING)) {
max_tx_size = MAX_TX_SIZE_BEFORE_SAPLING;
}
@@ -3898,13 +3901,13 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
// All Hush Arrakis Chains always have overwinter NU and so this option was never used
// Check mempooltxinputlimit to avoid creating a transaction which the local mempool rejects
// const size_t limit = 0; // (size_t)GetArg("-mempooltxinputlimit", 0);
{
LOCK(cs_main);
const bool overwinter = true;
//{
// LOCK(cs_main);
//const bool overwinter = true;
//if (NetworkUpgradeActive(chainActive.Height() + 1, Params().GetConsensus(), Consensus::UPGRADE_OVERWINTER)) {
// limit = 0;
//}
}
//}
/*
if (limit > 0) {
size_t n = txNew.vin.size();
@@ -5044,6 +5047,7 @@ SpendingKeyAddResult AddSpendingKeyToWallet::operator()(const libzcash::SaplingE
if (params.vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight == Consensus::NetworkUpgrade::ALWAYS_ACTIVE) {
m_wallet->mapSaplingZKeyMetadata[ivk].nCreateTime = nTime;
} else {
// TODO: set a better time for HUSH+DRAGONX
// 154051200 seconds from epoch is Friday, 26 October 2018 00:00:00 GMT - definitely before Sapling activates
m_wallet->mapSaplingZKeyMetadata[ivk].nCreateTime = std::max((int64_t) 154051200, nTime);
}