From 0e0b23d28c7996cba6aa395df729d6182f3a61b8 Mon Sep 17 00:00:00 2001 From: davidchocholaty Date: Fri, 8 Nov 2024 15:20:38 +0100 Subject: [PATCH] Add p2wpkh --- src/script.py | 1 - src/transaction.py | 8 ++------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/script.py b/src/script.py index 9422b4d..d468196 100644 --- a/src/script.py +++ b/src/script.py @@ -4,7 +4,6 @@ import hashlib import ecdsa from src.op_codes import OP_CODES -from src.verify import parse_der_signature_bytes from src.serialize import serialize_transaction class InvalidScriptException(Exception): diff --git a/src/transaction.py b/src/transaction.py index 3278dbb..c75b49d 100644 --- a/src/transaction.py +++ b/src/transaction.py @@ -112,17 +112,13 @@ def valid_input(self, vin_idx, vin): if scriptpubkey_type == "p2pkh": return self.validate_p2pkh(vin_idx, vin) - #pass elif scriptpubkey_type == "p2sh": - return self.validate_p2sh(vin_idx, vin) - #pass + pass elif scriptpubkey_type == "v0_p2wsh": - #self.has_witness = True pass elif scriptpubkey_type == "v1_p2tr": pass elif scriptpubkey_type == "v0_p2wpkh": - #pass self.has_witness = True return self.validate_p2wpkh(vin_idx, vin) @@ -231,7 +227,7 @@ def validate_p2wpkh(self, vin_idx, vin): return False scriptpubkey = bytes.fromhex(prevout.get("scriptpubkey", "")) - + # Verify that the scriptPubKey matches the P2WPKH format (OP_0 <20-byte-key-hash>) if len(scriptpubkey) != 22 or scriptpubkey[0] != 0x00 or scriptpubkey[1] != 0x14: return False