-
Notifications
You must be signed in to change notification settings - Fork 37.8k
MOVEONLY: Move constants to consensus.h #5696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6dcf663
to
b2272b8
Compare
b2272b8
to
1c96143
Compare
Updated adding MANDATORY_SCRIPT_VERIFY_FLAGS to consensus.h and STANDARD_SCRIPT_VERIFY_FLAGS and STANDARD_NOT_MANDATORY_VERIFY_FLAGS to policy.h |
1c96143
to
3163087
Compare
Needed rebase. |
* Failing one of these tests may trigger a DoS ban - see CheckInputs() for | ||
* details. | ||
*/ | ||
static const unsigned int MANDATORY_SCRIPT_VERIFY_FLAGS = SCRIPT_VERIFY_P2SH; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sold on this part...MANDATORY_SCRIPT_VERIFY_FLAGS is more about "what we accept now", whereas consensus code is generally "what we accept(ed) at the time the block was generated based on its version"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been thinking that Consensus could be a factory of an interface taking nHeight as parameter instead of a namespace.
Example:
if (Consensus(nHeight).CheckBlock(block, state))
Otherwise all consensus functions affected by softforks will have to take int nHeight as parameter.
But it's probably too soon for something like that.
I'm not sure what you're proposing though, leaving it on script/standard ?
3163087
to
c37cac0
Compare
Rebased adding LOCKTIME_THRESHOLD to consensus.h |
c37cac0
to
c7f0ece
Compare
Moved MANDATORY_SCRIPT_VERIFY_FLAGS to policy as suggested by @TheBlueMatt and @sipa |
c7f0ece
to
df861be
Compare
Renamed policy.o to policy/policy.o |
df861be
to
71a9bef
Compare
71a9bef
to
ca6793f
Compare
Rebased with @laanwj 's fix that should make travis happy again |
utACK. I like the direction this is going towards. |
ca6793f
to
d5ab935
Compare
I really don't like the introduction of globals into policy.h, but I understand that they're a temporary measure. utACK, with the assumption that the globals will be removed fairly quickly. |
5737c3d
to
386ea01
Compare
Needed rebase. |
386ea01
to
660cca3
Compare
Reopened as suggested by @theuni |
ae6329b
to
691161d
Compare
Updated only with the consensus constants but not the policy constants and globals. |
ACK. I asked @jtimon to re-open this (and slim it down to what it is now) in an effort to focus some of the current tangled PRs. I'm hoping we can serialize some of this work to get it in faster, so I'll take the blame for blowing up everyone's mailboxes with closed/reworked PRs today :). |
I like the idea of going ahead and getting some of this reorganization out of the way if we're going to do it. I reviewed this and did some basic testing and it looks good to me. |
ACK |
691161d Consensus: Create consensus/consensus.h with some constants (jtimon)
#include "main.h" | ||
#include "script/script.h" | ||
#include "timedata.h" | ||
#include "ui_interface.h" | ||
#include "util.h" | ||
#include "wallet/db.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this needed, seems I can compile without it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The question is not whether you can compile with it or not, the question is whether qt/transactiondesc.cpp is using anything declared in wallet/db.h or not. It's better to indicate dependencies explicitly.
Try commenting #include "main.h"
and #include "wallet/db.h"
and build again.
You will notice that
#include "coins.h"
#include <boost/foreach.hpp>
is missing but...yeah, you're right. wallet/db.h doesn't seem to be needed anymore.
None of nWalletDBUpdated, CDBEnv, bitdb and CDB is used here.
I am very sorry for putting it there unnecessarily. It seems that you removed it and I added it back in a rebase by accident.
Mhmm, I'll review #6068 in case something similar has happened there.
This is blocking #6051 and #5595
There's no way to start moving consensus and policy code effectively out of main without creating a first .h file.
UPDATE:
It was initially a tiny first step to sepearate consensus and policy but afer a lot of discussion it ended up being a tiny step towards separating only more consensus.
The motivation for this PR is stop blocking the 2 PRs mentioned in line 1.
OUTDATED (for archive):
While we discuss what the CPolicy interface should be #5595, we can start by just moving constants and globals to consensus.h and policy.o.
This will also open the door to some cleaning up on the includes.
nMaxDatacarrierBytes and MAX_OP_RETURN_RELAY are not moved from script/standard.o to policy.o because policy.o is in server while script/standard.o is in common and wouldn't link.
Please propose any other constant or global variable related to consensus or policy that I may have missed.
New but irrelevant:
Are you still reading?
This PR is so simple that the following comments are equivalent: