Skip to content

Commit

Permalink
Merge branch 'BIR-develop' of https://github.com/decenomy/DSW
Browse files Browse the repository at this point in the history
  • Loading branch information
zimbora committed Feb 13, 2024
2 parents cdf725f + 409c888 commit a0caa8a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 30 deletions.
31 changes: 3 additions & 28 deletions src/masternode-payments.cpp
Expand Up @@ -21,9 +21,6 @@
/** Object for who's going to get paid on which blocks */
CMasternodePayments masternodePayments;

uint64_t reconsiderWindowMin = 0;
uint64_t reconsiderWindowTime = 0;

RecursiveMutex cs_vecPayments;
RecursiveMutex cs_mapMasternodeBlocks;
RecursiveMutex cs_mapMasternodePayeeVotes;
Expand Down Expand Up @@ -255,17 +252,6 @@ bool IsBlockPayeeValid(const CBlock& block, int nBlockHeight)
const bool isPoSActive = Params().GetConsensus().NetworkUpgradeActive(nBlockHeight, Consensus::UPGRADE_POS);
const CTransaction& txNew = (isPoSActive ? block.vtx[1] : block.vtx[0]);

auto t = GetTime();

if((t - reconsiderWindowTime) > HOUR_IN_SECONDS) { // shift the reconsider window at each hour
reconsiderWindowMin = GetRand() % 10; // choose randomly from minute 0 to minute 9
reconsiderWindowTime = t;

for (auto it = mapRejectedBlocks.cbegin(); it != mapRejectedBlocks.cend();) { // clean up old entries
it = (GetAdjustedTime() - (*it).second) > DAY_IN_SECONDS ? mapRejectedBlocks.erase(it) : std::next(it);
}
}

// if it's the mint block then verify if exists an output with the right amount and address
if (consensus.nMintHeight == nBlockHeight) {
LogPrint(BCLog::MASTERNODE, "masternode", "IsBlockPayeeValid: Check mint reward\n");
Expand Down Expand Up @@ -294,22 +280,11 @@ bool IsBlockPayeeValid(const CBlock& block, int nBlockHeight)
// fails if spork 8 is enabled and
// spork 113 is disabled or current time is outside the reconsider window
if (sporkManager.IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT)) {
if (!sporkManager.IsSporkActive(SPORK_113_RECONSIDER_WINDOW_ENFORCEMENT))
{
return false;
}

if ((t / MINUTE_IN_SECONDS) % 10 != reconsiderWindowMin)
{
return false;
}

LogPrint(BCLog::MASTERNODE,"Masternode payment enforcement reconsidered, accepting block\n");
return false;
} else {
LogPrint(BCLog::MASTERNODE,"Masternode payment enforcement is disabled, accepting block\n");
return true;
}

LogPrint(BCLog::MASTERNODE,"Masternode payment enforcement is disabled, accepting block\n");
return true;
}

void FillBlockPayee(CMutableTransaction& txNew, const CBlockIndex* pindexPrev, bool fProofOfStake)
Expand Down
1 change: 0 additions & 1 deletion src/spork.cpp
Expand Up @@ -30,7 +30,6 @@ std::vector<CSporkDef> sporkDefs = {
MAKE_SPORK_DEF(SPORK_110_FORCE_ENABLED_MASTERNODE_PAYMENT, 4070908800ULL), // OFF
MAKE_SPORK_DEF(SPORK_111_ALLOW_DUPLICATE_MN_IPS, 4070908800ULL), // OFF
MAKE_SPORK_DEF(SPORK_112_MASTERNODE_LAST_PAID_V2, 4070908800ULL), // OFF
MAKE_SPORK_DEF(SPORK_113_RECONSIDER_WINDOW_ENFORCEMENT, 4070908800ULL), // OFF
MAKE_SPORK_DEF(SPORK_114_MN_PAYMENT_V2, 4070908800ULL), // OFF
MAKE_SPORK_DEF(SPORK_115_MN_COLLATERAL_WINDOW, 4070908800ULL), // OFF

Expand Down
1 change: 0 additions & 1 deletion src/sporkid.h
Expand Up @@ -28,7 +28,6 @@ enum SporkId : int32_t {
SPORK_110_FORCE_ENABLED_MASTERNODE_PAYMENT = 10109,
SPORK_111_ALLOW_DUPLICATE_MN_IPS = 10110,
SPORK_112_MASTERNODE_LAST_PAID_V2 = 10111,
SPORK_113_RECONSIDER_WINDOW_ENFORCEMENT = 10112,
SPORK_114_MN_PAYMENT_V2 = 10113,
SPORK_115_MN_COLLATERAL_WINDOW = 10114,

Expand Down

0 comments on commit a0caa8a

Please sign in to comment.