Merge branch 'duke' into dev

This commit is contained in:
Duke
2024-02-15 10:41:50 -05:00
306 changed files with 56 additions and 58346 deletions

View File

@@ -1230,6 +1230,7 @@ bool ContextualCheckTransaction(int32_t slowflag,const CBlock *block, CBlockInde
return state.DoS((ht < 0 || nHeight < ht) ? 0 : dosLevel,error("ContextualCheckTransaction(): ht.%d activates.%d dosLevel.%d overwinter is not active yet",nHeight, Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight, dosLevel),REJECT_INVALID, "tx-overwinter-not-active");
//return state.DoS(isInitBlockDownload() ? 0 : dosLevel,error("ContextualCheckTransaction(): ht.%d activates.%d dosLevel.%d overwinter is not active yet",nHeight, Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight, dosLevel),REJECT_INVALID, "tx-overwinter-not-active");
}
*/
if (saplingActive) {
// Reject transactions with valid version but missing overwintered flag
@@ -3073,7 +3074,13 @@ 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.
<<<<<<< HEAD
const bool sapling = pindex->pprev->GetHeight() >= 1 ? true : false; // NetworkUpgradeActive(pindex->pprev->GetHeight(), Params().GetConsensus(), Consensus::UPGRADE_SAPLING);
||||||| merged common ancestors
const bool sapling = true; // NetworkUpgradeActive(pindex->pprev->GetHeight(), Params().GetConsensus(), Consensus::UPGRADE_SAPLING);
=======
const bool sapling = pindex->GetHeight() >= 2 ? true : false; // NetworkUpgradeActive(pindex->pprev->GetHeight(), Params().GetConsensus(), Consensus::UPGRADE_SAPLING);
>>>>>>> duke
if (sapling) {
view.PopAnchor(pindex->pprev->hashFinalSaplingRoot, SAPLING);
} else {
@@ -3152,7 +3159,6 @@ static int64_t nTimeTotal = 0;
bool FindBlockPos(int32_t tmpflag,CValidationState &state, CDiskBlockPos &pos, unsigned int nAddSize, unsigned int nHeight, uint64_t nTime, bool fKnown = false);
bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBlockIndex *pindexNew, const CDiskBlockPos& pos);
bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& view, bool fJustCheck,bool fCheckPOW)
{
CDiskBlockPos blockPos;
@@ -3164,7 +3170,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
//fprintf(stderr,"connectblock ht.%d\n",(int32_t)pindex->GetHeight());
AssertLockHeld(cs_main);
bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
const bool ishush3 = strncmp(SMART_CHAIN_SYMBOL, "HUSH3",5) == 0 ? true : false;
// At startup, HUSH3 doesn't know a block height yet and so we must wait until
// connecting a block to set our private/blocktime flags, which are height-dependent
@@ -3336,11 +3342,6 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
// that is on the tip of our chain
//assert(view.GetSproutAnchorAt(old_sprout_tree_root, sprout_tree));
//{
// Consistency check: the root of the tree we're given should
// match what we asked for.
//assert(sprout_tree.root() == old_sprout_tree_root);
//}
SaplingMerkleTree sapling_tree;
assert(view.GetSaplingAnchorAt(view.GetBestAnchor(SAPLING), sapling_tree));
@@ -3492,7 +3493,13 @@ 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
<<<<<<< HEAD
const bool sapling = pindex->GetHeight()>=1 ? true : false; //NetworkUpgradeActive(pindex->GetHeight(), chainparams.GetConsensus(), Consensus::UPGRADE_SAPLING);
||||||| merged common ancestors
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);
>>>>>>> duke
if (sapling) {
if (block.hashFinalSaplingRoot != sapling_tree.root()) {
return state.DoS(100,
@@ -5218,8 +5225,16 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
bool ContextualCheckBlock(int32_t slowflag,const CBlock& block, CValidationState& state, CBlockIndex * const pindexPrev)
{
const int nHeight = pindexPrev == NULL ? 0 : pindexPrev->GetHeight() + 1;
<<<<<<< HEAD
const Consensus::Params& consensusParams = Params().GetConsensus();
// bool sapling = nHeight>=1 ? true : false; //NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_SAPLING);
||||||| merged common ancestors
const Consensus::Params& consensusParams = Params().GetConsensus();
bool sapling = true; //NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_SAPLING);
=======
//const Consensus::Params& consensusParams = Params().GetConsensus();
//bool sapling = true; //NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_SAPLING);
>>>>>>> duke
// Check that all transactions are finalized
for (uint32_t i = 0; i < block.vtx.size(); i++) {
@@ -8214,12 +8229,24 @@ CMutableTransaction CreateNewContextualCMutableTransaction(const Consensus::Para
mtx.nVersionGroupId = SAPLING_VERSION_GROUP_ID;
mtx.nVersion = SAPLING_TX_VERSION;
} else {
<<<<<<< HEAD
const bool isOverwintered = nHeight>=1 ? true : false; //NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_OVERWINTER);
||||||| merged common ancestors
bool isOverwintered = true; //NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_OVERWINTER);
=======
const bool isOverwintered = nHeight >=1 ? true : false; //NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_OVERWINTER);
>>>>>>> duke
if (isOverwintered)
{
mtx.fOverwintered = true;
mtx.nExpiryHeight = nHeight + expiryDelta;
<<<<<<< HEAD
const bool sapling = nHeight>=1 ? true : false;
||||||| merged common ancestors
const bool sapling = true;
=======
const bool sapling = nHeight >=1 ? true : false;
>>>>>>> duke
if (sapling) // NetworkUpgradeActive(nHeight, consensusParams, Consensus::UPGRADE_SAPLING))
{
mtx.nVersionGroupId = SAPLING_VERSION_GROUP_ID;