From c9f989b05ee14e1bfd67c2061f70594d42c757ef Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 8 Aug 2025 17:37:58 +0200 Subject: [PATCH 1/2] Update bitcoin_utils.py --- bip-0352/bitcoin_utils.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/bip-0352/bitcoin_utils.py b/bip-0352/bitcoin_utils.py index ee55f2d3b3..a1c456c5cf 100644 --- a/bip-0352/bitcoin_utils.py +++ b/bip-0352/bitcoin_utils.py @@ -32,13 +32,11 @@ def deser_txid(txid: str): def deser_compact_size(f: BytesIO): - view = f.getbuffer() - nbytes = view.nbytes; - view.release() - if (nbytes == 0): - return 0 # end of stream + b = f.read(1) + if not b: + return 0 # end of stream - nit = struct.unpack(" Date: Fri, 8 Aug 2025 17:38:28 +0200 Subject: [PATCH 2/2] Update reference.py --- bip-0352/reference.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bip-0352/reference.py b/bip-0352/reference.py index 3d0899ce27..3b0cc95c4f 100755 --- a/bip-0352/reference.py +++ b/bip-0352/reference.py @@ -4,7 +4,7 @@ import hashlib import json -from typing import List, Tuple, Dict, cast +from typing import List, Tuple, Dict, cast, Optional from sys import argv, exit from functools import reduce from itertools import permutations @@ -152,7 +152,9 @@ def create_outputs(input_priv_keys: List[Tuple[ECKey, bool]], outpoints: List[CO return list(set(outputs)) -def scanning(b_scan: ECKey, B_spend: ECPubKey, A_sum: ECPubKey, input_hash: bytes, outputs_to_check: List[ECPubKey], labels: Dict[str, str] = {}) -> List[Dict[str, str]]: +def scanning(b_scan: ECKey, B_spend: ECPubKey, A_sum: ECPubKey, input_hash: bytes, outputs_to_check: List[ECPubKey], labels: Optional[Dict[str, str]] = None) -> List[Dict[str, str]]: + if labels is None: + labels = {} G = ECKey().set(1).get_pubkey() ecdh_shared_secret = input_hash * b_scan * A_sum k = 0