mirror of
https://github.com/bitcoin/bips.git
synced 2025-09-22 13:51:38 +00:00
address feedback (newline + extra whitespace)
This commit is contained in:
parent
b26f77db65
commit
b7c79dcbc0
@ -130,7 +130,6 @@ def create_outputs(input_priv_keys: List[Tuple[ECKey, bool]], outpoints: List[CO
|
|||||||
# Input privkeys sum is zero -> fail
|
# Input privkeys sum is zero -> fail
|
||||||
return []
|
return []
|
||||||
assert ECKey().set(bytes.fromhex(expected.get("input_private_key_sum"))) == a_sum, "a_sum did not match expected input_private_key_sum"
|
assert ECKey().set(bytes.fromhex(expected.get("input_private_key_sum"))) == a_sum, "a_sum did not match expected input_private_key_sum"
|
||||||
|
|
||||||
input_hash = get_input_hash(outpoints, a_sum * G)
|
input_hash = get_input_hash(outpoints, a_sum * G)
|
||||||
silent_payment_groups: Dict[ECPubKey, List[ECPubKey]] = {}
|
silent_payment_groups: Dict[ECPubKey, List[ECPubKey]] = {}
|
||||||
for recipient in recipients:
|
for recipient in recipients:
|
||||||
@ -148,7 +147,6 @@ def create_outputs(input_priv_keys: List[Tuple[ECKey, bool]], outpoints: List[CO
|
|||||||
outputs = []
|
outputs = []
|
||||||
for B_scan, B_m_values in silent_payment_groups.items():
|
for B_scan, B_m_values in silent_payment_groups.items():
|
||||||
ecdh_shared_secret = input_hash * a_sum * B_scan
|
ecdh_shared_secret = input_hash * a_sum * B_scan
|
||||||
|
|
||||||
expected_shared_secrets = expected.get("shared_secrets", {})
|
expected_shared_secrets = expected.get("shared_secrets", {})
|
||||||
# Find the recipient address that corresponds to this B_scan and get its index
|
# Find the recipient address that corresponds to this B_scan and get its index
|
||||||
for recipient_idx, recipient in enumerate(recipients):
|
for recipient_idx, recipient in enumerate(recipients):
|
||||||
@ -157,7 +155,6 @@ def create_outputs(input_priv_keys: List[Tuple[ECKey, bool]], outpoints: List[CO
|
|||||||
expected_shared_secret_hex = expected_shared_secrets[recipient_idx]
|
expected_shared_secret_hex = expected_shared_secrets[recipient_idx]
|
||||||
assert ecdh_shared_secret.get_bytes(False).hex() == expected_shared_secret_hex, f"ecdh_shared_secret did not match expected, recipient {recipient_idx} ({recipient['address']}): expected={expected_shared_secret_hex}"
|
assert ecdh_shared_secret.get_bytes(False).hex() == expected_shared_secret_hex, f"ecdh_shared_secret did not match expected, recipient {recipient_idx} ({recipient['address']}): expected={expected_shared_secret_hex}"
|
||||||
break
|
break
|
||||||
|
|
||||||
k = 0
|
k = 0
|
||||||
for B_m in B_m_values:
|
for B_m in B_m_values:
|
||||||
t_k = TaggedHash("BIP0352/SharedSecret", ecdh_shared_secret.get_bytes(False) + ser_uint32(k))
|
t_k = TaggedHash("BIP0352/SharedSecret", ecdh_shared_secret.get_bytes(False) + ser_uint32(k))
|
||||||
@ -173,10 +170,8 @@ def scanning(b_scan: ECKey, B_spend: ECPubKey, A_sum: ECPubKey, input_hash: byte
|
|||||||
input_hash_key = ECKey().set(input_hash)
|
input_hash_key = ECKey().set(input_hash)
|
||||||
computed_tweak_point = input_hash_key * A_sum
|
computed_tweak_point = input_hash_key * A_sum
|
||||||
assert computed_tweak_point.get_bytes(False).hex() == expected.get("tweak"), "tweak did not match expected"
|
assert computed_tweak_point.get_bytes(False).hex() == expected.get("tweak"), "tweak did not match expected"
|
||||||
|
|
||||||
ecdh_shared_secret = input_hash * b_scan * A_sum
|
ecdh_shared_secret = input_hash * b_scan * A_sum
|
||||||
assert ecdh_shared_secret.get_bytes(False).hex() == expected.get("shared_secret"), "ecdh_shared_secret did not match expected shared_secret"
|
assert ecdh_shared_secret.get_bytes(False).hex() == expected.get("shared_secret"), "ecdh_shared_secret did not match expected shared_secret"
|
||||||
|
|
||||||
k = 0
|
k = 0
|
||||||
wallet = []
|
wallet = []
|
||||||
while True:
|
while True:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user