python-bitcoinlib
python-bitcoinlib copied to clipboard
CScript.witness_version() should call CSriptOp.decode_op_n() on the value before returning
https://github.com/petertodd/python-bitcoinlib/blob/173a73e74781dcd2edce120d8685550a88a73189/bitcoin/core/script.py#L692-L694
Because the witness version is actually a 'small int' opcode - that is, for witness version 1, without decode_op_n(), the returned value will be 0x51. It worked for version 0 because 'small int' opcode is decoded as 0 --> 0; 0x51..0x60 --> 1..16