-
Notifications
You must be signed in to change notification settings - Fork 37.1k
acceptnonstdtxn option to skip (most) "non-standard transaction" checks, for testnet/regtest only #6329
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
cb5eb0b
to
811bff3
Compare
@@ -396,6 +396,7 @@ std::string HelpMessage(HelpMessageMode mode) | |||
strUsage += HelpMessageOpt("-testnet", _("Use the test network")); | |||
|
|||
strUsage += HelpMessageGroup(_("Node relay options:")); | |||
strUsage += HelpMessageOpt("-acceptnonstdtxn", strprintf(_("Relay and mine \"non-standard\" transactions (testing only; default: %u)"), 0)); |
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.
This is confusing, as it doesn't make clear that the default is true on testnet and regtest.
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.
How would you improve 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.
One possibility: "Relay and mine \"non-standard\" transactions (testnet/regtest only, default: true)"
Edit: Want to clarify that a bit, I believe petertodd is confused by the default flag displayed ('0') when the actual flag setting code uses !Params().RequireStandard()
defaulting true for testnet/regtest
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.
@faizkhan00 Yup, that's exactly the issue I'm worried about.
I think your wording is fine, modulo s/true/1/
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.
Fixed.
811bff3
to
f749607
Compare
Modulo wording nit, tested ACK. I'll close #6255 if this gets merged. |
f749607
to
ac76421
Compare
Changed... |
953f36e
to
35853d9
Compare
@@ -396,6 +396,7 @@ std::string HelpMessage(HelpMessageMode mode) | |||
strUsage += HelpMessageOpt("-testnet", _("Use the test network")); | |||
|
|||
strUsage += HelpMessageGroup(_("Node relay options:")); | |||
strUsage += HelpMessageOpt("-acceptnonstdtxn", strprintf(_("Relay and mine \"non-standard\" transactions (%sdefault: %u)"), _("testnet/regtest only; "), !Params(CBaseChainParams::TESTNET).RequireStandard())); |
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.
This should be part of the debugging options (if(showDebug)
). Consequently, also the message should be left un-translated.
utACK apart rom translation nits |
35853d9
to
81ec58c
Compare
Removed translation tags. |
@@ -396,6 +396,7 @@ std::string HelpMessage(HelpMessageMode mode) | |||
strUsage += HelpMessageOpt("-testnet", _("Use the test network")); | |||
|
|||
strUsage += HelpMessageGroup(_("Node relay options:")); | |||
strUsage += HelpMessageOpt("-acceptnonstdtxn", strprintf("Relay and mine \"non-standard\" transactions (%sdefault: %u)", "testnet/regtest only; ", !Params(CBaseChainParams::TESTNET).RequireStandard())); |
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.
Also add if(showDebug)
…ks, for testnet/regtest only
81ec58c
to
0c37634
Compare
showDebug done |
0c37634 acceptnonstdtxn option to skip (most) "non-standard transaction" checks, for testnet/regtest only (Luke Dashjr)
How did I missed this while being so insistent with @luke-jr and @petertodd about #5180 ...this is the wrong way to expose this...instead of -acceptnonstdtxn you would have just used -policy=test. |
@@ -803,6 +805,10 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) | |||
return InitError(strprintf(_("Invalid amount for -minrelaytxfee=<amount>: '%s'"), mapArgs["-minrelaytxfee"])); | |||
} | |||
|
|||
fRequireStandard = !GetBoolArg("-acceptnonstdtxn", !Params().RequireStandard()); | |||
if (Params().RequireStandard() && !fRequireStandard) |
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 semantics are wrong, why would the user be prevented from overrriding a particular chain's default?
This check is completely unnecessary.
Also, any reason to name the variable amd the option as opposites (instead of both RequireStandard or both acceptnonstdtxn)?
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.
It's actually pretty dangerous to override the IsStandard() check on mainnet if you are a miner; you can end up creating blocks that take unreasonable amounts of time to verify, losing money.
Best go force people to edit the source code to so that.
Anyway, this is mainly useful for testing applications, so no need IMO to make this into a complex game of policy stuff when a simple and intuitive flag works.
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.
@petertodd Then miners shouldn't use this option and it can be documented. There's more users besides miners who may be interested in accepting non-std transactions and give the choice to the users instead of endlessly discuss the best default or how hard should it be to change it for less and more technical users.
This particularly surprises me because @luke-jr once said "the testing policy is actually a sane policy to run in production", supposedly as an argument in favor of "-acceptnonstdtxn=0/1" over "policy=standard/test".
Actually, prohibiting the option in certain chains adds more code complexity and couples CStandardPolicy to Params() forever.
I'm sure nobody would be in favor of prohibiting the -datacarriersize option for the main chain. master...jtimon:safe-configurable-policy
"Bitcoin core, now with configurable policy that is only configurable for testnet and regtest".
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.
@jtimon There's DoS attacks that IsStandard() prevents.
Anyway, without peers that also accept your non-default transactions, changing policy locally is pretty pointless; solve that issue first. One idea would be a hashcash-based relay network, maybe using Bitmessage if you want to get it implemented quickly.
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.
@jtimon There's DoS attacks that IsStandard() prevents.
There's DoS attacks that minRelayTxFee prevents, yet still -minrelaytxfee=1 is allowed (and -minrelaytxfee=0 should be allowed as well IMO).
Anyway, without peers that also accept your non-default transactions, changing policy locally is pretty pointless; solve that issue first.
No, I'm fixing this first. Solve that yourself if you want to.
I've been wanting to expose this option as -policy=test for very long (#5180). Then 2 competing PRs appear and one of them gets merged very fast. Nobody asked me for review (even though I had been very insistent demanding review for #5180 myself) and thus I wasn't able to nit the proposals and thus what was merged us wrong, and I can fix some of the mistakes for free in #6068. #5180 couldn't be fairly compared with #6329 without some previous steps (#6068 among them) that are taking forever to review, but whatever, what's done it's done.
Anyway, if "changing policy locally is pretty pointless" then nobody will do it and we don't need to maintain this additional stupid restriction, do we?
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.
Anyway, enough discussion. Please ack/nack jtimon@2d71478 in #6068 so that we can move on.
…tx functional tests coverage. 2d994c4 qa: adding test case for output value > input value out of range (furszy) 6165c80 qa: update and enable p2p_invalid_tx.py functional test. (furszy) bb62699 Backport chainparams and validation `fRequireStandard` flags functionality + init 'acceptnonstdtxn' option to skip (most) "non-standard transaction" checks, for testnet/regtest only. (furszy) 0280c39 New regression testing for CVE-2018-17144, CVE-2012-2459, and CVE-2010-5137. (lucash-dev) ec7d0b0 [qa] Test for duplicate inputs within a transaction (Suhas Daftuar) a501fe1 qa: update and enable p2p_invalid_block.py. (furszy) f83d140 qa: Read reject reasons from debug log, not p2p messages (furszy) 8a50165 [tests] Add P2PDataStore class (furszy) ebed910 qa: Correct coinbase input script height. (furszy) cae2d43 [tests] Reduce NodeConn connection logging from info to debug (John Newbery) Pull request description: Introduced the `P2PDataStore` class into the functional test suite and updated it up to a point where was able to enable the `p2p_invalid_block.py` and `p2p_invalid_tx.py` functional tests. Plus updated both tests to a much recent version, expanding its testing coverage as well. Now the test suite is covering the primary CVE that btc had in the past. As both tests were simply unusable before and we have a different synchronization process than upstream, plus we didn't have some params and init/global flags, this work isn't following a PR by PR back port path. Had to made my own way up to the complete tests support. Main pilar PRs from upstream from where this work was based: * dashpay#6329. * bitcoin#11771. * bitcoin#14119 (only `p2p_invalid_tx.py`, `p2p_invalid_block.py` and `mininode.py` changes). * bitcoin#14247 (only 9b4a36e). * bitcoin#14696. ACKs for top commit: random-zebra: ACK 2d994c4 Tree-SHA512: 548830b5fbf8b7f383832a7eea96179d089a4c9c222ef34007846f53736b07c873e37084235f1575eac157b63308c00ab3be78b71d3ed6520f4f73f1c8de81a5
Inspired by #6255, this makes it possible to enable IsStandard for regtest/testnet (but doesn't allow disabling it on mainnet), while remaining compatible with long-standing options in other node software.