Merge pull request #1037 from UdjinM6/fixSpork9Payment
change logic in IsBlockValueValid and IsBlockPayeeValid to allow valid superblocks only when spork9 is on
This commit is contained in:
commit
b9bd11610d
@ -79,6 +79,7 @@ bool IsBlockValueValid(const CBlock& block, int nBlockHeight, CAmount blockRewar
|
||||
|
||||
// we are synced, let's try to check as much data as we can
|
||||
|
||||
if(sporkManager.IsSporkActive(SPORK_9_SUPERBLOCKS_ENABLED)) {
|
||||
if(CSuperblockManager::IsSuperblockTriggered(nBlockHeight)) {
|
||||
if(CSuperblockManager::IsValid(block.vtx[0], nBlockHeight, blockReward)) {
|
||||
LogPrint("gobject", "IsBlockValueValid -- Valid superblock at height %d: %s", nBlockHeight, block.vtx[0].ToString());
|
||||
@ -87,17 +88,16 @@ bool IsBlockValueValid(const CBlock& block, int nBlockHeight, CAmount blockRewar
|
||||
}
|
||||
|
||||
// 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());
|
||||
// should NOT allow invalid superblocks, when superblock enforcement is enabled
|
||||
// should NOT allow invalid superblocks, when superblocks are enabled
|
||||
return false;
|
||||
}
|
||||
|
||||
// should NOT allow superblocks at all, when superblock enforcement is disabled
|
||||
LogPrintf("IsBlockValueValid -- Superblock enforcement is disabled, no superblocks allowed\n");
|
||||
LogPrint("gobject", "IsBlockValueValid -- No triggered superblock detected at height %d\n", nBlockHeight);
|
||||
} else {
|
||||
// should NOT allow superblocks at all, when superblocks are disabled
|
||||
LogPrint("gobject", "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
|
||||
return isNormalBlockValueMet;
|
||||
}
|
||||
@ -147,24 +147,23 @@ bool IsBlockPayeeValid(const CTransaction& txNew, int nBlockHeight, CAmount bloc
|
||||
// superblocks started
|
||||
// SEE IF THIS IS A VALID SUPERBLOCK
|
||||
|
||||
if(sporkManager.IsSporkActive(SPORK_9_SUPERBLOCKS_ENABLED)) {
|
||||
if(CSuperblockManager::IsSuperblockTriggered(nBlockHeight)) {
|
||||
if(CSuperblockManager::IsValid(txNew, nBlockHeight, blockReward)) {
|
||||
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());
|
||||
// should NOT allow such superblocks, when superblock enforcement is enabled
|
||||
// should NOT allow such superblocks, when superblocks are enabled
|
||||
return false;
|
||||
}
|
||||
|
||||
// should NOT allow superblocks at all, when superblock enforcement is disabled
|
||||
LogPrintf("IsBlockPayeeValid -- Superblock enforcement is disabled, no superblocks allowed\n");
|
||||
}
|
||||
|
||||
// continue validation, should pay MN
|
||||
LogPrint("gobject", "IsBlockPayeeValid -- No valid superblock detected at height %d\n", nBlockHeight);
|
||||
LogPrint("gobject", "IsBlockPayeeValid -- No triggered superblock detected at height %d\n", nBlockHeight);
|
||||
} else {
|
||||
// should NOT allow superblocks at all, when superblocks are disabled
|
||||
LogPrint("gobject", "IsBlockPayeeValid -- Superblocks are disabled, no superblocks allowed\n");
|
||||
}
|
||||
|
||||
// IF THIS ISN'T A SUPERBLOCK OR SUPERBLOCK IS INVALID, IT SHOULD PAY A MASTERNODE DIRECTLY
|
||||
if(mnpayments.IsTransactionValid(txNew, nBlockHeight)) {
|
||||
|
Loading…
Reference in New Issue
Block a user