-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Update standardness rules congruent to Bitcoin Core #2178
Conversation
Pull Request Test Coverage Report for Build 9180393402Details
💛 - Coveralls |
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.
Nice PR, there're a few lingering policy rules bitcoind applies that we don't, so nice to be able to periodically bridge the gap. Hopefully one day this'll all be in a nice BIP to make it easier to track relevant policy that full node implementations should consider.
Left a few comments in line
@@ -589,6 +596,12 @@ func (msg *MsgTx) btcDecode(r io.Reader, pver uint32, enc MessageEncoding, | |||
sbuf = sbuf[len(txin.Witness[j]):] | |||
} | |||
} | |||
|
|||
// Check that if the witness flag is set that we actually have |
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.
Nice, this is something that is actually spelled out in the old BIP (144):
If the witness is empty, the old serialization format must be used.
https://github.com/bitcoin/bips/blob/master/bip-0144.mediawiki
|
||
// ScriptVerifyConstScriptCode fails non-segwit scripts if a signature | ||
// match is found in the script code or if OP_CODESEPARATOR is used. | ||
ScriptVerifyConstScriptCode |
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.
+1 for aligning here, this wasn't in the original set of BIPs, but was added afterwards: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2017-November/015292.html
Being closer to bitcoind
here policy wise may make it easier to keep up with w/e the outcome of the Great Consensus Cleanup Revival is.
778dad0
to
d7a021b
Compare
d7a021b
to
e7c694a
Compare
This is to mitigate CVE-2017-12842. Along the way, also error when deserializing transactions that have the witness marker flag set but have no witnesses. This matches Bitcoin Core's behaviour initially introduced here bitcoin/bitcoin#14039. Allowing such transactions is benign, but this makes sure that our parsing code matches Core's exactly.
e7c694a
to
da2f3b1
Compare
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.
LGTM 🧆
This PR updates a couple of relay policy rules to bring them in line with what Bitcoin Core does. We do two things here,
References: