summaryrefslogtreecommitdiff
path: root/bip-0352/reference.py
diff options
context:
space:
mode:
Diffstat (limited to 'bip-0352/reference.py')
-rwxr-xr-xbip-0352/reference.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/bip-0352/reference.py b/bip-0352/reference.py
index 9f43695..9b35d04 100755
--- a/bip-0352/reference.py
+++ b/bip-0352/reference.py
@@ -117,7 +117,7 @@ def decode_silent_payment_address(address: str, hrp: str = "tsp") -> Tuple[ECPub
return B_scan, B_spend
-def create_outputs(input_priv_keys: List[Tuple[ECKey, bool]], input_hash: bytes, recipients: List[str], hrp="tsp") -> List[str]:
+def create_outputs(input_priv_keys: List[Tuple[ECKey, bool]], outpoints: List[COutPoint], recipients: List[str], hrp="tsp") -> List[str]:
G = ECKey().set(1).get_pubkey()
negated_keys = []
for key, is_xonly in input_priv_keys:
@@ -127,6 +127,7 @@ def create_outputs(input_priv_keys: List[Tuple[ECKey, bool]], input_hash: bytes,
negated_keys.append(k)
a_sum = sum(negated_keys)
+ input_hash = get_input_hash(outpoints, a_sum * G)
silent_payment_groups: Dict[ECPubKey, List[ECPubKey]] = {}
for recipient in recipients:
B_scan, B_m = decode_silent_payment_address(recipient, hrp=hrp)
@@ -236,9 +237,8 @@ if __name__ == "__main__":
sending_outputs = []
if (len(input_pub_keys) > 0):
- A_sum = reduce(lambda x, y: x + y, input_pub_keys)
- input_hash = get_input_hash([vin.outpoint for vin in vins], A_sum)
- sending_outputs = create_outputs(input_priv_keys, input_hash, given["recipients"], hrp="sp")
+ outpoints = [vin.outpoint for vin in vins]
+ sending_outputs = create_outputs(input_priv_keys, outpoints, given["recipients"], hrp="sp")
# Note: order doesn't matter for creating/finding the outputs. However, different orderings of the recipient addresses
# will produce different generated outputs if sending to multiple silent payment addresses belonging to the