validation: add const for minimum witness commitment size#18780
validation: add const for minimum witness commitment size#18780fanquake merged 2 commits intobitcoin:masterfrom
Conversation
maflcko
left a comment
There was a problem hiding this comment.
Concept ACK. Thanks for adding the test.
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
54f8c48 to
a9db322
Compare
ajtowns
left a comment
There was a problem hiding this comment.
ACK a9db322e017281811e5039c80cd3114c5025ee27
maflcko
left a comment
There was a problem hiding this comment.
ACK, only style-nits. Feel free to ignore if you don't have to push for other reasons.
Per BIP 141, the witness commitment structure is atleast 38 bytes, OP_RETURN (0x6a) + 36 (0x24) + 4 byte header (0xaa21a9ed) + 32 byte SHA256 hash. It can be longer, however any additional data has no consensus meaning.
As per BIP 141, if there is more than 1 pubkey that matches the witness commitment structure, the one with the highest output index should be chosen. This adds a sanity check that we are doing that, which will fail if anyone trys to "optimise" GetWitnessCommitmentIndex() be returning early.
a9db322 to
692f830
Compare
|
ACK 692f830 |
|
ACK 692f830 🌵 Show signature and timestampSignature: Timestamp of file with hash |
|
ACK 692f830 |
…ment size 692f830 test: add test for witness commitment index (fanquake) 0644254 validation: Add minimum witness commitment size constant (fanquake) Pull request description: bitcoin@16101de: Per [BIP 141](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#Commitment_structure), the witness commitment structure is at least 38 bytes, OP_RETURN (0x6a) + 36 (0x24) + 4 byte header (0xaa21a9ed) + 32 byte SHA256 hash. It can be longer, however any additional data has no consensus meaning. bitcoin@54f8c48: As per BIP 141, if there is more than 1 pubkey that matches the witness commitment structure, the one with the highest output index should be chosen. This adds a sanity check that we are doing that, which will fail if anyone tries to "optimize" GetWitnessCommitmentIndex() by returning early. ACKs for top commit: MarcoFalke: ACK 692f830 🌵 jonatack: Code review ACK 692f830 ajtowns: ACK 692f830 jnewbery: utACK 692f830 laanwj: ACK 692f830 Tree-SHA512: 7af3fe4b8a52fea2cdd0aec95f7bb935351a77b73d934bc88d6625a3503311b2a062cba5190b2228f97caa76840db3889032d910fc8e318ca8e7810a8afbafa0
16101de: Per BIP 141, the witness commitment structure is at least 38 bytes,
OP_RETURN (0x6a) + 36 (0x24) + 4 byte header (0xaa21a9ed) + 32 byte
SHA256 hash. It can be longer, however any additional data has no
consensus meaning.
54f8c48: As per BIP 141, if there is more than 1 pubkey that matches the witness
commitment structure, the one with the highest output index should be
chosen. This adds a sanity check that we are doing that, which will fail
if anyone tries to "optimize" GetWitnessCommitmentIndex() by returning
early.