-
Notifications
You must be signed in to change notification settings - Fork 37.8k
WIP: Policy: Separate standard and testing policies #5180
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
Since I touch chainparams, my version needed rebase... |
Disagree with per-network policies and global Policy() function; the former overcomplicates modifications for no real benefit, and the latter would make multiple policies more difficult to add in circumstances where they would actually be desirable (ie, within the same running instance). |
1e64382
to
f1b49db
Compare
It's not a per-network policy, please, read the code. It's quite the opposite actually: it's decoupling policies from networks. A pointer to an abstract class is by all means more flexible than a reference to a an extern object when it comes to support multiple policies. I will of course clean this up, but I hope this can convince you that CNodePolicy::fRequireStandardTx, exposing CNodePolicy and the extern CNodePolicy in main are mistakes. I'm indifferent to "coins: GetTxFees method" because I don't see it as specially useful, but if the new method is not even going to be used (as in "SQUASHME: actually use GetTxFees method") I would say NACK. It seems completely orthogonal to the rest of the PR anyway. |
Updated initial description. |
Updated code and description again without IsDust() this time. |
5cbc611
to
ef91b0c
Compare
Rebased after #5521 has been merged for easier review. |
Closing in favor of #5652 |
Updated after #6068 has been updated. Now the addition of the -policy option is left for the end as an optinal "squasheable" commit. |
b26ea47
to
5f97028
Compare
3deba59
to
3eaa099
Compare
Closing until some version of #6068 is merged. |
Updated opening description after rebasing and re-closing. |
if (Params().RequireStandard() && !fRequireStandard) | ||
return InitError(strprintf("acceptnonstdtxn is not currently supported for %s chain", chainparams.NetworkIDString())); | ||
if (GetBoolArg("-acceptnonstdtxn", false)) | ||
return InitError(strprintf("acceptnonstdtxn is deprecated, use policy=test instead.", chainparams.NetworkIDString())); |
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.
acceptnonstdtxn affects only one facet of the policy. It shouldn't be deprecated unless you add a way to configure the flag some other way.
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 default -acceptnonstdtxn=0 is equivalent to the default -policy=standard.
To use the equivalent of -acceptnonstdtxn=1, you use -policy=test.
This has the advantages of decoupling policy from Params() and that adding new policies (say, -policy=fss_rbf) becomes easier in the future.
Anyway, this needs rebase.
…y class implementing it Rename 3 functions into CPolicy methods: - IsStandard -> policy.ApproveScript - IsStandardTx -> policy.ApproveTx - AreInputsStandard -> policy.ApproveTxInputs
…andardPolicy attributes
…tly of the chain ...by replacing CChainParams::fRequireStandard with CChainParams::strDefaultPolicy Also expose it as an option (-policy=test) equivalent to -acceptnonstdtxn. This decouples policy/policy.cpp from Params()
Updated without deprecating anything. |
I only reopened to show and discuss the updated version. But, again, closing until there's a CPolicy interface class. |
EDIT:
This prepares AcceptToMemoryPool to be decoupled from Params() and creates a -policy command-line option to select the standard or test policy independently of the chain mode (ie main, testnet3, regtest).
It's based on #6068.
@petertodd already acked the concept here: #5521 (comment)
OLD:
Instead of being based on #5071 as initially, it doesn't go as far as that PR.
A rebased version of #5071 on top of this PR can be found here: https://github.com/jtimon/bitcoin/tree/nodepolicy_5180
Instead of being based on #5071 it is based on #5521 (plus one doubt-commit).
Please let's not delay policy.o even if it's only with
minRelayTxFee
.Later proposals to expand policy.o become more readable once the first step has been walked.
Even better, later proposed changes to main.o may become proposed changes to policy.o!!
In my opinion the biggest development bottleneck is reviewing changes to main.o.
/EDIT
It's based on #5071 and eliminates Params().RequireStandard() by separating two policies for the 4 networks accessible with Params() as discussed in that PR.
It also includes a couple of "squashme" commits that solve my complains on #5071 in case you @luke-jr want to take them.