-
Notifications
You must be signed in to change notification settings - Fork 107
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
add(consensus): Check consensus branch ids in tx verifier #9063
Conversation
Just for reference I think the 4.10 rules are about the branch ID used in SIGHASH. What we seem to have missed is from 7.1.2:
which we check for transactions in blocks, but not for transactions in the mempool. |
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 looks good, but since it's a consensus change, I'll leave approval for the next reviewer
I confirmed that running a
|
Co-authored-by: Conrado Gouvea <[email protected]>
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.
utACK for the non-test code. I did not thoroughly review the tests.
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.
looks good, thank you @upbqdn
Co-authored-by: Alfredo Garcia <[email protected]>
I agree. To reflect this, I updated the implementation in b83ee0b and 4f37471 and the PR description as well. |
Consensus rules often start with conditions such as "[NU5 onward]". We take those conditions as implicit in the code, but we could implement them by checking what NU is active for the thing being checked. Should we start making those conditions explicit? |
c2fe569
to
8deea77
Compare
c900e55
to
c698507
Compare
I made the NU5 onward condition explicit in c698507. |
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 looks really good, thank you for the fix and the related cleanups.
I left a few suggestions for cleanups but there are no blockers.
Motivation
Close #9064.
Context
The tx verifier is not checking if the
nConsensusBranchId
field in V5 txs conforms to the following consensus rule:We have this check in the block verifier. However, since the mempool uses only the tx verifier, it can currently accept txs with an incorrect
nConsenusBranchId
.Specifications & References
Solution
Tests
PR Author's Checklist
PR Reviewer's Checklist