1
0
mirror of https://github.com/bitcoin/bips.git synced 2026-03-30 16:06:44 +00:00

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>
This commit is contained in:
Sebastian Falbesoner
2024-06-14 14:33:40 +02:00
parent 47033c62dc
commit 59cc43d727
3 changed files with 47 additions and 0 deletions

View File

@@ -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()