Skip to content

Conversation

@dgpv
Copy link
Contributor

@dgpv dgpv commented Sep 17, 2018

Model CScript.is_witness_scriptpubkey after bitcoind's
CScript::IsWitnessProgram -- it not only checks for script size
and first opcode, but also checks that data push size equals
script size + 2 (entire script consists of version byte
and data push). In absense of this check, is_witness_scriptpubkey
wrongfully detects 1-of-1 p2sh redeem script as a witness program.

Model CScript.is_witness_scriptpubkey after bitcoind's
CScript::IsWitnessProgram -- it not only checks for script size
and first opcode, but also checks that data push size equals
script size + 2 (entire script consists of version byte
and data push). In absense of this check, is_witness_scriptpubkey
wrongfully detects 1-of-1 p2sh redeem script as a witness program.
petertodd added a commit that referenced this pull request Aug 21, 2019
…byte + 2

629a919 CScript.is_witness_scriptpubkey : size must match second byte + 2 (Dmitry Petukhov)

Pull request description:

  Model CScript.is_witness_scriptpubkey after bitcoind's
  CScript::IsWitnessProgram -- it not only checks for script size
  and first opcode, but also checks that data push size equals
  script size + 2 (entire script consists of version byte
  and data push). In absense of this check, is_witness_scriptpubkey
  wrongfully detects 1-of-1 p2sh redeem script as a witness program.

Top commit has no ACKs.

Tree-SHA512: 83a1ac530a107a0b69b549a81c1c9eb87152dd3c1f06a768f3c469ec3ae28c33d104d69d45aac23b48b76087f869ed1195989880fda5a34b1c78fad8a3504d64
@petertodd petertodd merged commit 629a919 into petertodd:master Aug 21, 2019
@petertodd
Copy link
Owner

Thanks!

It'd be good to add a test for this as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants