-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Reject non-final txs even in testnet/regtest #5521
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
|
utACK. I also wonder if this check should be part of the node's policy as in #5071 or it should be left in main. At least "chainActive.Height() + 1" doesn't seem to be something you should call from policy.o, at most pass it as parameter. |
|
@jtimon How is this sanely a node policy thing? We're talking about whether or not we accept transactions that can't be mined to the mempool; remember the nLockTime can be any amount in the future. |
|
That's what I'm saying, this probably shouldn't go with the policy code. Thus this change is good for a later move of |
|
@jtimon Oh, you mean should #5071 include this pull-req? Sure, but anyway IMO this pull-req makes sense to merge regardless of what we do with policy in a wider sense. FWIW I keep meaning to making IsStandard() something you can turn off via a command-line flag, as it makes testing software on testnet/regtest annoying due to the differences in behavior. |
|
Yes, this PR makes sense independently, just saying that it also makes sense from the policy-encapsulation perspective. |
|
@jtimon Yup, ACK DefaultPolicy() |
|
A few questions:
|
|
To be clear, this is what I'm suggesting: https://github.com/jtimon/bitcoin/commits/5521 |
src/main.cpp
Outdated
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.
s/reason/"non-final"
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.
Thanks!
bd3f7f0 to
72b453e
Compare
|
Yeah, the main point is that it is not required in IsStandardTx(), that if it was needed, it was only for the access to activeChain, making the function more independent from main to move it out later. |
|
utACK. Just wrote a almost bytewise identical patch (my update to the comment was slightly more minimal). (Lock can be removed in another patch) |
|
@gmaxwell thoughts on removing AssertLockHeld(cs_main); from IsStandardTx() within this PR? |
|
I think it's fine to remove. |
Previous behavior with IsFinalTx() being an IsStandard() rule was rather confusing and interferred with testing of protocols that depended on nLockTime.
72b453e to
0ea28ba
Compare
|
reACK |
|
Tested ACK |
|
@petertodd I've also checked and indeed, nothing is being done that requires cs_main lock anymore. ACK |
0ea28ba Reject non-final txs even in testnet/regtest (Peter Todd)
Previous behavior with IsFinalTx() being an IsStandard() rule was rather confusing and interferred with testing of protocols that depended on nLockTime. A particularly bad example is with CHECKLOCKTIMEVERIFY where it gave the impression that the CLTV opcode didn't do anything as CLTV-using txs that aren't yet minable because the locktimes haven't been reached are accepted.