bips/bip-0352
omipheo 1259a23acc BIP352: complete type annotations on bitcoin_utils class methods
Direct follow-up to PR #2154 (which annotated the free-function half
of bip-0352/bitcoin_utils.py) and 2f7117c ("BIP352: fix Any typing").
The four classes in this file — COutPoint, VinInfo, CScriptWitness,
and CTxInWitness — still had unannotated `__init__`, `serialize`,
`deserialize`, and `is_null` methods. mypy could not flow types
through the surrounding reference.py code that constructs and passes
these objects.

Annotate every method on all four classes:

- COutPoint:    __init__ (hash, n), serialize -> bytes, deserialize -> None
- VinInfo:      __init__ (typed Optional defaults for the three
                construct-on-None fields)
- CScriptWitness: __init__ -> None, is_null -> bool, plus an inline
                stack: List[bytes] declaration matching what the
                rest of the file already assumes
- CTxInWitness: __init__ -> None, deserialize -> "CTxInWitness"
                (forward ref since it returns self), is_null -> bool

Adds Optional to the existing typing import (List was already added
by #2154). No behavior changes.

Verified: mypy --ignore-missing-imports ./bip-0352/bitcoin_utils.py
reports "Success: no issues found in 1 source file"; round-trip
smoke tests on COutPoint serialize/deserialize, CScriptWitness
is_null with empty + non-empty stack, CTxInWitness deserialize
returning self, and VinInfo default-construction all match the
pre-change behavior.
2026-05-15 11:24:44 +02:00
..
secp256k1lab Merge commit '53b590e190f798131a10a16194261243abdf6b4d' as 'bip-0352/secp256k1lab' 2026-03-02 19:16:00 +01:00
bech32m.py Add reference.py with test vectors 2024-05-08 18:14:55 +02:00
bitcoin_utils.py BIP352: complete type annotations on bitcoin_utils class methods 2026-05-15 11:24:44 +02:00
reference.py BIP352: fix Any typing 2026-05-07 21:04:24 -06:00
ripemd160.py BIP-352: use own ripemd160 for reference implementation (#1616) 2024-06-29 07:08:49 -07:00
scan_data_downloader_per_month.png bip352: update appendix 2024-07-12 09:05:35 +02:00
send_and_receive_test_vectors.json BIP-352: add test vector for edge case - input key intermediate sum zero 2026-04-16 12:05:12 -04:00