CODE MOVE ONLY
This PR creates a new unit which will be handling soft fork logic. For now all we do is move IsSuperMajority() from main.cpp to consensus/softforks.cpp.
CODE MOVE ONLY
This PR creates a new unit which will be handling soft fork logic. For now all we do is move IsSuperMajority() from main.cpp to consensus/softforks.cpp.
utACK
utACK
Please clean up class/struct Params:
src pavel$ grep "[class|strict] Params" consensus/*h
consensus/params.h:struct Params {
consensus/softforks.h:class Params;
src pavel$
6 | +#define BITCOIN_SOFTFORKS_H 7 | + 8 | +class CBlockIndex; 9 | +namespace Consensus { 10 | + 11 | +class Params;
As pointed out by @paveljanik, this should be a struct.
@paveljanik @dcousens Fixed class->struct
98 | @@ -99,6 +99,7 @@ BITCOIN_CORE_H = \ 99 | compressor.h \ 100 | consensus/consensus.h \ 101 | consensus/params.h \ 102 | + consensus/softforks.h \
If we're going to eventually use this for Hardfork consensus changes too, maybe it would be better to have a more generic name for the file/module: forks, changes, upgrades?
Or could be done now with less total work, that's the point.
0 | @@ -0,0 +1,25 @@ 1 | +// Copyright (c) 2009-2015 Eric Lombrozo, The Bitcoin Core developers 2 | +// Distributed under the MIT software license, see the accompanying 3 | +// file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | + 5 | +#include "chain.h" 6 | +#include "consensus/params.h" 7 | +#include "softforks.h" 8 | + 9 | +using namespace Consensus::SoftForks;
The additional namespace Softforks seems unnecessarily verbose, just Consensus seems enough.
Apart from my bike-shedding nits, ut ACK.
I changed my mind about this. I prefer something like https://github.com/jtimon/bitcoin/commit/8ec82416cdb48f6f01d49688406918be864d80b2 again. NACK In any case rebase or close?
It's simpler and achieves the task of encapsulating consensus code more simply (although of course this is relative). I don't think a UseRule() function is interesting getting the consensus validation flags that include those rules (and I would unify other future consensus flags [like the one for bip113] with the script ones too).
Sorry, that was a mistake, I thought I was talking on #6747 . This is just a tiny and pointless moveonly IMO. Instead of this, I would prefer something like this https://github.com/jtimon/bitcoin/commit/f8c34f27d4020880647cbdbafad70793882cef79 (see https://github.com/jtimon/bitcoin/commits/libconsensus-f2 for the "big picture" and #7091 for the pre-document-with-words-and-pictures opened first step).
I think we can close this now. Also I recall talk of replacing the ISM checks with block heights.