mirror of
https://github.com/jwinterm/myriadcoin.git
synced 2026-10-19 05:58:38 +02:00
fix logic for consecutive-same-algo limit change
This commit is contained in:
+14
-9
@@ -2689,8 +2689,7 @@ bool AcceptBlock(CBlock& block, CValidationState& state, CDiskBlockPos* dbp)
|
||||
nHeight = pindexPrev->nHeight+1;
|
||||
|
||||
// Check count of sequence of same algo
|
||||
if ( (TestNet() && (nHeight > 200))
|
||||
|| (nHeight > nBlockSequentialAlgoRuleStart) )
|
||||
if ( (TestNet() && (nHeight > 200)) || (nHeight > nBlockSequentialAlgoRuleStart))
|
||||
{
|
||||
int nAlgo = block.GetAlgo();
|
||||
int nAlgoCount = 1;
|
||||
@@ -2702,17 +2701,23 @@ bool AcceptBlock(CBlock& block, CValidationState& state, CDiskBlockPos* dbp)
|
||||
nAlgoCount++;
|
||||
piPrev = piPrev->pprev;
|
||||
}
|
||||
if ((nHeight > nBlockSequentialAlgoRuleStart3) && (nAlgoCount > nBlockSequentialAlgoMaxCount3))
|
||||
if (nHeight > nBlockSequentialAlgoRuleStart3)
|
||||
{
|
||||
return state.DoS(100, error("AcceptBlock() : too many blocks from same algo"),
|
||||
if(nAlgoCount > nBlockSequentialAlgoMaxCount3)
|
||||
{
|
||||
return state.DoS(100, error("AcceptBlock() : too many blocks from same algo"),
|
||||
REJECT_INVALID, "algo-toomany");
|
||||
} else
|
||||
if ((nHeight > nBlockSequentialAlgoRuleStart2) && (nAlgoCount > nBlockSequentialAlgoMaxCount2))
|
||||
}
|
||||
}
|
||||
else if (nHeight > nBlockSequentialAlgoRuleStart2)
|
||||
{
|
||||
return state.DoS(100, error("AcceptBlock() : too many blocks from same algo"),
|
||||
if(nAlgoCount > nBlockSequentialAlgoMaxCount2)
|
||||
{
|
||||
return state.DoS(100, error("AcceptBlock() : too many blocks from same algo"),
|
||||
REJECT_INVALID, "algo-toomany");
|
||||
} else
|
||||
if (nAlgoCount > nBlockSequentialAlgoMaxCount)
|
||||
}
|
||||
}
|
||||
else if (nAlgoCount > nBlockSequentialAlgoMaxCount)
|
||||
{
|
||||
return state.DoS(100, error("AcceptBlock() : too many blocks from same algo"),
|
||||
REJECT_INVALID, "algo-toomany");
|
||||
|
||||
Reference in New Issue
Block a user