Skip to content

Commit

Permalink
Merge branch 'KYAN-develop' of https://github.com/decenomy/DSW
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro-at-decenomy committed Jun 5, 2023
2 parents 11f299d + 34e0b1b commit 0d01bf2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3129,7 +3129,8 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo
// but issue an initial reject message.
// The case also exists that the sending peer could not have enough data to see
// that this block is invalid, so don't issue an outright ban.
if (nHeight != 0 && !IsInitialBlockDownload() &&
if (nHeight != 0 &&
!IsInitialBlockDownload() &&
GetAdjustedTime() - block.GetBlockTime() < DEFAULT_BLOCK_PAYEE_VERIFICATION_TIMEOUT)
{
// check masternode payment
Expand Down Expand Up @@ -3459,9 +3460,7 @@ bool AcceptBlock(const CBlock& block, CValidationState& state, CBlockIndex** ppi
int level = 100;

if(mapRejectedBlocks.find(block.hashPrevBlock) != mapRejectedBlocks.end()) {
auto elapsed = (GetTime() - mapRejectedBlocks[block.hashPrevBlock]) / MINUTE_IN_SECONDS;

level = elapsed <= 20 ? 0 : (level < elapsed ? level : elapsed);
level = 0; // let it be reconsidered
}

return state.DoS(level, error("%s : prev block %s is invalid, unable to add block %s", __func__, block.hashPrevBlock.GetHex(), block.GetHash().GetHex()),
Expand Down
2 changes: 1 addition & 1 deletion src/masternode-payments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ bool IsBlockPayeeValid(const CBlock& block, int nBlockHeight)
reconsiderWindowTime = t;

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

Expand Down

0 comments on commit 0d01bf2

Please sign in to comment.