diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2024-06-14 14:33:40 +0200 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2024-06-22 01:48:44 +0200 |
commit | 59cc43d727000794f18dac0a502cd87c0daec22a (patch) | |
tree | 7c22335138cf9a2a57a474ae3dc89bbf3d69604d /bip-0352/reference.py | |
parent | 47033c62dc101080c31c1e8a88118ae8288f6d36 (diff) | |
download | bips-59cc43d727000794f18dac0a502cd87c0daec22a.tar.xz |
BIP-352: scanning: add step to skip tx if input pubkeys sum A is point at infinity
The input data for the test vector is taken from the signet transaction
fe788cf6578d547819def43d79e6c8f0153d4885f5a343d12bd03f34507aabd6
which spends two P2WPKH inputs with negated pubkeys (x, y) and (x, -y)
from the funding transaction 3a286147b25e16ae80aff406f2673c6e565418c40f45c071245cdebc8a94174e
(see also https://github.com/bitcoin-core/secp256k1/pull/1519#issuecomment-2143167510
and the output from the script in the previous commit message).
Co-authored-by: josibake <josibake@protonmail.com>
Diffstat (limited to 'bip-0352/reference.py')
-rwxr-xr-x | bip-0352/reference.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/bip-0352/reference.py b/bip-0352/reference.py index 7882ad1..b4eaf94 100755 --- a/bip-0352/reference.py +++ b/bip-0352/reference.py @@ -300,6 +300,10 @@ if __name__ == "__main__": add_to_wallet = [] if (len(input_pub_keys) > 0): A_sum = reduce(lambda x, y: x + y, input_pub_keys) + if A_sum.get_bytes() is None: + # Input pubkeys sum is point at infinity -> skip tx + assert expected["outputs"] == [] + continue input_hash = get_input_hash([vin.outpoint for vin in vins], A_sum) pre_computed_labels = { (generate_label(b_scan, label) * G).get_bytes(False).hex(): generate_label(b_scan, label).hex() |