Skip to content
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

Fix handling of nonstandard txns and the "-acceptnonstdtxn" switch #1047

Closed
hans-schmidt opened this issue Jun 1, 2021 · 1 comment
Closed
Labels

Comments

@hans-schmidt
Copy link
Contributor

User kralverde reported being able to send (and have mined) a 256-byte OP_RETURN transaction.
That is ok because he was on testnet. Nonstandard transactions are allowed on testnet and regtest (but not on mainnet).
However, this occurence highlighted the fact that it is difficult to properly test mainnet behavior using testnet or regtest.

There is a CLI switch option "-acceptnonstdtxn" (which reveals itself only when executing "raven-qt --help -help-debug) which is intended to determine raven-qt behavior. There is also a parameter "fRequireStandard" in "chainparams.cpp" for each chain, which is intended to restrict whether that CLI switch option is allowed for that chain.

However, as currently coded, the logic for the option switch is broken because it allows nonstandard transactions on a chain only if that is already the default behavior for that chain, and disallows it otherwise.
Since the "fRequireStandard" values in "chainparams.cpp" are fixed at mainnet:true, testnet:false, regtest:false, those serve to hard-code whether that chain rejects nonstandard transactions.

A very simple code change can be made to change the behavior so that all chains default to rejecting nonstandard transactions, while allowing the "-acceptnonstdtxn" switch to change that behavior on testnet and regtest (but not mainnet).

Note that bitcoin has also fixed the "-acceptnonstdtxn" switch in their PR#15891, but in a more complicated way and with different results.

@HyperPeek HyperPeek added the bug label Jun 4, 2021
@hans-schmidt
Copy link
Contributor Author

This has been fixed by PR #1048

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants