From 4154954077073b14e21f94ec97486109e3becdb5 Mon Sep 17 00:00:00 2001 From: nzsquirrell Date: Sun, 23 Aug 2015 19:33:13 +1200 Subject: [PATCH] Revert "fix logic for consecutive-same-algo limit change" This reverts commit 519a398b265bb989c8cedd5d8d9b8169adb9b679. --- src/main.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index b2237351..51fc2752 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2689,7 +2689,8 @@ 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; @@ -2701,23 +2702,17 @@ bool AcceptBlock(CBlock& block, CValidationState& state, CDiskBlockPos* dbp) nAlgoCount++; piPrev = piPrev->pprev; } - if (nHeight > nBlockSequentialAlgoRuleStart3) + if ((nHeight > nBlockSequentialAlgoRuleStart3) && (nAlgoCount > nBlockSequentialAlgoMaxCount3)) { - if(nAlgoCount > nBlockSequentialAlgoMaxCount3) - { - return state.DoS(100, error("AcceptBlock() : too many blocks from same algo"), + return state.DoS(100, error("AcceptBlock() : too many blocks from same algo"), REJECT_INVALID, "algo-toomany"); - } - } - else if (nHeight > nBlockSequentialAlgoRuleStart2) + } else + if ((nHeight > nBlockSequentialAlgoRuleStart2) && (nAlgoCount > nBlockSequentialAlgoMaxCount2)) { - if(nAlgoCount > nBlockSequentialAlgoMaxCount2) - { - return state.DoS(100, error("AcceptBlock() : too many blocks from same algo"), + 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");