Skip to content

Conversation

@jnewbery
Copy link
Contributor

#7562 made version 2 transactions standard, which should have broken the test in bip68-sequence.py that version 2 transactions are non-standard before BIP 68 activation. However, there was a syntax error in the test case, so it didn't break.

In fact, it's fine for version 2 transactions to be standard before BIP 68 activation since BIP 68 was activated in July 2016, so it'd have to be a pretty big re-org to go back to pre-activated times (and even then this is a non-consensus change).

Best fix here is to remove the test that version 2 transactions are non-standard prior to BIP68 activation.

@jnewbery
Copy link
Contributor Author

@sdaftuar

@fanquake fanquake added the Tests label Feb 10, 2017
@jnewbery
Copy link
Contributor Author

jnewbery commented Feb 11, 2017

@morcos has pointed out version 2 transactions were actually made standard in the CSV PR #7648 (not #7562 as I claimed above). That means that we were relaying version 2 transactions before CSV was activated. Oops.

Anyway, the point still stands. BIP68 is now well and truly activated, so we don't need to test pre-activation standardness.

@gmaxwell
Copy link
Contributor

That means that we were relaying version 2 transactions before CSV was activated. Oops.

I think that is fine and that it was the intent-- so long as they were valid CSV transactions, which they were, because the CSV rules were enforced against the mempool prior to activation.

Copy link
Member

@sdaftuar sdaftuar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gmaxwell This is an aside but for the sake of anyone following this conversation, we actually didn't start relaying version 2 transactions before CSV was activated -- we merged #7835 prior to release, to prevent that from happening. (If there is a class of transactions that we think are valid but that miners for whatever reason are likely to not mine, then that opens up some mempool-related DoS vectors.)

print("Verifying nVersion=2 transactions aren't standard")
self.test_version2_relay(before_activation=True)
print("Verifying nVersion=2 transactions are standard")
self.test_version2_relay()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should move this to below the CSV activation. Testing that relaying of nVersion=2 transactions post activation makes sense, whereas testing that it works pre-activation is strange -- it's okay in this case that we allow it (because on mainnet activation happened a long time ago), but that is not how the code used to behave prior to activation (because relaying those transactions prior to validation opens up some DoS vectors).

@jnewbery
Copy link
Contributor Author

ok, I've moved the standardness check to after BIP68 activation. I've also added a comment to say transaction version 2 is always standard for current bitcoin core versions to avoid any confusion for people reading the code. I've verified that the test still runs.

Once you're happy and have ACKed the changes, I'll squash for merging.

@jnewbery
Copy link
Contributor Author

@sdaftuar pointed out a missing closing parentheses. Fixed in f5aba8a

@sdaftuar
Copy link
Member

utACK f5aba8a

@maflcko
Copy link
Member

maflcko commented Feb 23, 2017

utACK f5aba8a

@laanwj laanwj merged commit f5aba8a into bitcoin:master Mar 6, 2017
laanwj added a commit that referenced this pull request Mar 6, 2017
f5aba8a Move tx version 2 standardness check to after bip68 activation (John Newbery)
99c0e81 Fix BIP68 activation test (John Newbery)

Tree-SHA512: 3633d5359705b33a22cd3d8ea28f41abd93ccc6fe9943c8004f6149add991771df9ea12b4e14192e39e14b414bb5ecc7218e516cfeec97e4c5df29778ac57060
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Feb 1, 2019
f5aba8a Move tx version 2 standardness check to after bip68 activation (John Newbery)
99c0e81 Fix BIP68 activation test (John Newbery)

Tree-SHA512: 3633d5359705b33a22cd3d8ea28f41abd93ccc6fe9943c8004f6149add991771df9ea12b4e14192e39e14b414bb5ecc7218e516cfeec97e4c5df29778ac57060
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants