Skip to content

Commit b999ac2

Browse files
authored
Add support for Pay-to-Anchor (P2A) address type in get_pubkey_from_input function
This commit adds a conditional statement to the get_pubkey_from_input function to handle Pay-to-Anchor (P2A) address types. The function now checks if the previous output is a P2A address type and extracts the public key from the anchor_script. This update ensures compatibility with the Bitcoin protocol for P2A address types and enhances the function's versatility in processing various address types.
1 parent 532c4c1 commit b999ac2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

bip-0352/reference.py

+5
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ def get_pubkey_from_input(vin: VinInfo) -> ECPubKey:
7878
pubkey = ECPubKey().set(vin.prevout[2:])
7979
if (pubkey.valid) & (pubkey.compressed):
8080
return pubkey
81+
if is_p2a(vin.prevout):
82+
anchor_script = vin.scriptSig[1:]
83+
pubkey = ECPubKey().set(anchor_script)
84+
if (pubkey.valid) & (pubkey.compressed):
85+
return pubkey
8186

8287

8388
return ECPubKey()

0 commit comments

Comments
 (0)