mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 13:03:17 +01:00
change logic in IsBlockValueValid and IsBlockPayeeValid to allow superblocks only when spork9 is on
This commit is contained in:
parent
1e2d61ad0d
commit
8d80a71ffe
@ -79,25 +79,25 @@ bool IsBlockValueValid(const CBlock& block, int nBlockHeight, CAmount blockRewar
|
|||||||
|
|
||||||
// we are synced, let's try to check as much data as we can
|
// we are synced, let's try to check as much data as we can
|
||||||
|
|
||||||
if(CSuperblockManager::IsSuperblockTriggered(nBlockHeight)) {
|
if(sporkManager.IsSporkActive(SPORK_9_SUPERBLOCKS_ENABLED)) {
|
||||||
if(CSuperblockManager::IsValid(block.vtx[0], nBlockHeight, blockReward)) {
|
if(CSuperblockManager::IsSuperblockTriggered(nBlockHeight)) {
|
||||||
LogPrint("gobject", "IsBlockValueValid -- Valid superblock at height %d: %s", nBlockHeight, block.vtx[0].ToString());
|
if(CSuperblockManager::IsValid(block.vtx[0], nBlockHeight, blockReward)) {
|
||||||
// all checks are done in CSuperblock::IsValid, nothing to do here
|
LogPrint("gobject", "IsBlockValueValid -- Valid superblock at height %d: %s", nBlockHeight, block.vtx[0].ToString());
|
||||||
return true;
|
// all checks are done in CSuperblock::IsValid, nothing to do here
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// triggered but invalid? that's weird
|
// triggered but invalid? that's weird
|
||||||
if(sporkManager.IsSporkActive(SPORK_9_SUPERBLOCKS_ENABLED)) {
|
|
||||||
LogPrintf("IsBlockValueValid -- ERROR: Invalid superblock detected at height %d: %s", nBlockHeight, block.vtx[0].ToString());
|
LogPrintf("IsBlockValueValid -- ERROR: Invalid superblock detected at height %d: %s", nBlockHeight, block.vtx[0].ToString());
|
||||||
// should NOT allow invalid superblocks, when superblock enforcement is enabled
|
// should NOT allow invalid superblocks, when superblocks are enabled
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
LogPrint("gobject", "IsBlockValueValid -- No triggered superblock detected at height %d\n", nBlockHeight);
|
||||||
// should NOT allow superblocks at all, when superblock enforcement is disabled
|
} else {
|
||||||
LogPrintf("IsBlockValueValid -- Superblock enforcement is disabled, no superblocks allowed\n");
|
// should NOT allow superblocks at all, when superblocks are disabled
|
||||||
|
LogPrintf("IsBlockValueValid -- Superblocks are disabled, no superblocks allowed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
LogPrint("gobject", "IsBlockValueValid -- No valid superblock detected at height %d\n", nBlockHeight);
|
|
||||||
// it MUST be a regular block
|
// it MUST be a regular block
|
||||||
return isNormalBlockValueMet;
|
return isNormalBlockValueMet;
|
||||||
}
|
}
|
||||||
@ -147,25 +147,24 @@ bool IsBlockPayeeValid(const CTransaction& txNew, int nBlockHeight, CAmount bloc
|
|||||||
// superblocks started
|
// superblocks started
|
||||||
// SEE IF THIS IS A VALID SUPERBLOCK
|
// SEE IF THIS IS A VALID SUPERBLOCK
|
||||||
|
|
||||||
if(CSuperblockManager::IsSuperblockTriggered(nBlockHeight)) {
|
if(sporkManager.IsSporkActive(SPORK_9_SUPERBLOCKS_ENABLED)) {
|
||||||
if(CSuperblockManager::IsValid(txNew, nBlockHeight, blockReward)) {
|
if(CSuperblockManager::IsSuperblockTriggered(nBlockHeight)) {
|
||||||
LogPrint("gobject", "IsBlockPayeeValid -- Valid superblock at height %d: %s", nBlockHeight, txNew.ToString());
|
if(CSuperblockManager::IsValid(txNew, nBlockHeight, blockReward)) {
|
||||||
return true;
|
LogPrint("gobject", "IsBlockPayeeValid -- Valid superblock at height %d: %s", nBlockHeight, txNew.ToString());
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if(sporkManager.IsSporkActive(SPORK_9_SUPERBLOCKS_ENABLED)) {
|
|
||||||
LogPrintf("IsBlockPayeeValid -- ERROR: Invalid superblock detected at height %d: %s", nBlockHeight, txNew.ToString());
|
LogPrintf("IsBlockPayeeValid -- ERROR: Invalid superblock detected at height %d: %s", nBlockHeight, txNew.ToString());
|
||||||
// should NOT allow such superblocks, when superblock enforcement is enabled
|
// should NOT allow such superblocks, when superblocks are enabled
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// continue validation, should pay MN
|
||||||
// should NOT allow superblocks at all, when superblock enforcement is disabled
|
LogPrint("gobject", "IsBlockPayeeValid -- No triggered superblock detected at height %d\n", nBlockHeight);
|
||||||
LogPrintf("IsBlockPayeeValid -- Superblock enforcement is disabled, no superblocks allowed\n");
|
} else {
|
||||||
|
// should NOT allow superblocks at all, when superblocks are disabled
|
||||||
|
LogPrintf("IsBlockPayeeValid -- Superblocks are disabled, no superblocks allowed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// continue validation, should pay MN
|
|
||||||
LogPrint("gobject", "IsBlockPayeeValid -- No valid superblock detected at height %d\n", nBlockHeight);
|
|
||||||
|
|
||||||
// IF THIS ISN'T A SUPERBLOCK OR SUPERBLOCK IS INVALID, IT SHOULD PAY A MASTERNODE DIRECTLY
|
// IF THIS ISN'T A SUPERBLOCK OR SUPERBLOCK IS INVALID, IT SHOULD PAY A MASTERNODE DIRECTLY
|
||||||
if(mnpayments.IsTransactionValid(txNew, nBlockHeight)) {
|
if(mnpayments.IsTransactionValid(txNew, nBlockHeight)) {
|
||||||
LogPrint("mnpayments", "IsBlockPayeeValid -- Valid masternode payment at height %d: %s", nBlockHeight, txNew.ToString());
|
LogPrint("mnpayments", "IsBlockPayeeValid -- Valid masternode payment at height %d: %s", nBlockHeight, txNew.ToString());
|
||||||
|
Loading…
Reference in New Issue
Block a user