mirror of
https://github.com/dashpay/dash.git
synced 2024-12-29 13:59:06 +01:00
more checks for IsValidBlockHeight()
This commit is contained in:
parent
f7b6234cc2
commit
ade8f64163
@ -350,6 +350,10 @@ bool CSuperblockManager::IsSuperblockTriggered(int nBlockHeight)
|
|||||||
|
|
||||||
bool CSuperblockManager::GetBestSuperblock(CSuperblock_sptr& pBlock, int nBlockHeight)
|
bool CSuperblockManager::GetBestSuperblock(CSuperblock_sptr& pBlock, int nBlockHeight)
|
||||||
{
|
{
|
||||||
|
if(!CSuperblock::IsValidBlockHeight(nBlockHeight)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
AssertLockHeld(governance.cs);
|
AssertLockHeld(governance.cs);
|
||||||
std::vector<CSuperblock_sptr> vecTriggers = triggerman.GetActiveTriggers();
|
std::vector<CSuperblock_sptr> vecTriggers = triggerman.GetActiveTriggers();
|
||||||
int nYesCount = 0;
|
int nYesCount = 0;
|
||||||
@ -633,6 +637,10 @@ bool CSuperblock::IsValid(const CTransaction& txNew, int nBlockHeight, CAmount b
|
|||||||
// internal to *this and since CSuperblock's are accessed only through
|
// internal to *this and since CSuperblock's are accessed only through
|
||||||
// shared pointers there's no way our object can get deleted while this
|
// shared pointers there's no way our object can get deleted while this
|
||||||
// code is running.
|
// code is running.
|
||||||
|
if(!IsValidBlockHeight(nBlockHeight)) {
|
||||||
|
LogPrintf("CSuperblock::IsValid -- ERROR: Block invalid, incorrect block height\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::string strPayeesPossible = "";
|
std::string strPayeesPossible = "";
|
||||||
|
|
||||||
|
@ -185,9 +185,9 @@ bool IsBlockPayeeValid(const CTransaction& txNew, int nBlockHeight, CAmount bloc
|
|||||||
|
|
||||||
void FillBlockPayee(CMutableTransaction& txNew, CAmount blockReward, int nBlockHeight)
|
void FillBlockPayee(CMutableTransaction& txNew, CAmount blockReward, int nBlockHeight)
|
||||||
{
|
{
|
||||||
// only create superblocks after hardfork block AND if spork is enabled AND if superblock is actually triggered
|
// only create superblocks if spork is enabled AND if superblock is actually triggered
|
||||||
if(nBlockHeight > Params().GetConsensus().nSuperblockStartBlock &&
|
// (height should be validated inside)
|
||||||
sporkManager.IsSporkActive(SPORK_9_MASTERNODE_SUPERBLOCK_ENFORCEMENT) &&
|
if(sporkManager.IsSporkActive(SPORK_9_MASTERNODE_SUPERBLOCK_ENFORCEMENT) &&
|
||||||
CSuperblockManager::IsSuperblockTriggered(nBlockHeight)) {
|
CSuperblockManager::IsSuperblockTriggered(nBlockHeight)) {
|
||||||
LogPrint("gobject", "FillBlockPayee -- triggered superblock creation at height %d\n", nBlockHeight);
|
LogPrint("gobject", "FillBlockPayee -- triggered superblock creation at height %d\n", nBlockHeight);
|
||||||
CSuperblockManager::CreateSuperblock(txNew, nBlockHeight);
|
CSuperblockManager::CreateSuperblock(txNew, nBlockHeight);
|
||||||
@ -200,15 +200,12 @@ void FillBlockPayee(CMutableTransaction& txNew, CAmount blockReward, int nBlockH
|
|||||||
|
|
||||||
std::string GetRequiredPaymentsString(int nBlockHeight)
|
std::string GetRequiredPaymentsString(int nBlockHeight)
|
||||||
{
|
{
|
||||||
// IF THIS HEIGHT IS A SUPERBLOCK, GET THE REQUIRED PAYEES
|
// IF WE HAVE A ACTIVATED TRIGGER FOR THIS HEIGHT - IT IS A SUPERBLOCK, GET THE REQUIRED PAYEES
|
||||||
|
|
||||||
if(CSuperblockManager::IsSuperblockTriggered(nBlockHeight)) {
|
if(CSuperblockManager::IsSuperblockTriggered(nBlockHeight)) {
|
||||||
// IF WE HAVE A ACTIVATED TRIGGER
|
|
||||||
return CSuperblockManager::GetRequiredPaymentsString(nBlockHeight);
|
return CSuperblockManager::GetRequiredPaymentsString(nBlockHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
// OTHERWISE, PAY MASTERNODE
|
// OTHERWISE, PAY MASTERNODE
|
||||||
|
|
||||||
return mnpayments.GetRequiredPaymentsString(nBlockHeight);
|
return mnpayments.GetRequiredPaymentsString(nBlockHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user