1
0
mirror of https://github.com/bitcoin/bips.git synced 2026-07-13 17:56:00 +00:00

Merge branch 'Snezhkko-chore/fix-create-outputs-recipients-typing'

* Snezhkko-chore/fix-create-outputs-recipients-typing:
  BIP352: fix Any typing
  BIP352: Fix recipients typing in create_outputs to List[Dict[str, str]]
This commit is contained in:
Jon Atack
2026-05-07 21:05:21 -06:00

View File

@@ -5,7 +5,7 @@
import json import json
from pathlib import Path from pathlib import Path
import sys import sys
from typing import List, Tuple, Dict, cast from typing import Any, List, Tuple, Dict, cast
# import the vendored copy of secp256k1lab # import the vendored copy of secp256k1lab
sys.path.insert(0, str(Path(__file__).parent / "secp256k1lab/src")) sys.path.insert(0, str(Path(__file__).parent / "secp256k1lab/src"))
@@ -125,7 +125,7 @@ def decode_silent_payment_address(address: str, hrp: str = "tsp") -> Tuple[GE, G
return B_scan, B_spend return B_scan, B_spend
def create_outputs(input_priv_keys: List[Tuple[Scalar, bool]], outpoints: List[COutPoint], recipients: List[str], expected: Dict[str, any] = None, hrp="tsp") -> List[str]: def create_outputs(input_priv_keys: List[Tuple[Scalar, bool]], outpoints: List[COutPoint], recipients: List[Dict[str, str]], expected: Dict[str, Any] = None, hrp="tsp") -> List[str]:
negated_keys = [] negated_keys = []
for key, is_xonly in input_priv_keys: for key, is_xonly in input_priv_keys:
k = Scalar.from_bytes_checked(key.to_bytes()) k = Scalar.from_bytes_checked(key.to_bytes())
@@ -177,7 +177,7 @@ def create_outputs(input_priv_keys: List[Tuple[Scalar, bool]], outpoints: List[C
return list(set(outputs)) return list(set(outputs))
def scanning(b_scan: Scalar, B_spend: GE, A_sum: GE, input_hash: bytes, outputs_to_check: List[bytes], labels: Dict[str, str] = None, expected: Dict[str, any] = None) -> List[Dict[str, str]]: def scanning(b_scan: Scalar, B_spend: GE, A_sum: GE, input_hash: bytes, outputs_to_check: List[bytes], labels: Dict[str, str] = None, expected: Dict[str, Any] = None) -> List[Dict[str, str]]:
input_hash_scalar = Scalar.from_bytes_checked(input_hash) input_hash_scalar = Scalar.from_bytes_checked(input_hash)
computed_tweak_point = input_hash_scalar * A_sum computed_tweak_point = input_hash_scalar * A_sum
assert computed_tweak_point.to_bytes_compressed().hex() == expected.get("tweak"), "tweak did not match expected" assert computed_tweak_point.to_bytes_compressed().hex() == expected.get("tweak"), "tweak did not match expected"