mirror of
https://github.com/bitcoin/bips.git
synced 2026-11-09 19:47:16 +00:00
Merge pull request #2310 from zjubiology/master
BIP375: check SegWit versions in non-witness UTXOs
This commit is contained in:
3 files changed
+23
-7
No files matched your search
@@ -16,7 +16,6 @@ from deps.bitcoin_test.psbt import (
|
||||
PSBT_IN_OUTPUT_INDEX,
|
||||
PSBT_IN_PREVIOUS_TXID,
|
||||
PSBT_IN_SIGHASH_TYPE,
|
||||
PSBT_IN_WITNESS_UTXO,
|
||||
PSBT_OUT_SCRIPT,
|
||||
)
|
||||
from deps.dleq import dleq_verify_proof
|
||||
@@ -24,9 +23,9 @@ from secp256k1lab.secp256k1 import GE
|
||||
|
||||
from .bip352_crypto import compute_silent_payment_output_script
|
||||
from .inputs import (
|
||||
_script_pubkey_from_psbt_input,
|
||||
collect_input_ecdh_and_pubkey,
|
||||
is_input_eligible,
|
||||
parse_witness_utxo,
|
||||
pubkey_from_eligible_input,
|
||||
)
|
||||
from .psbt_bip375 import (
|
||||
@@ -284,11 +283,9 @@ def validate_input_eligibility(psbt: PSBT) -> Tuple[bool, str]:
|
||||
|
||||
# Check segwit version restrictions
|
||||
for i, input_map in enumerate(psbt.i):
|
||||
if PSBT_IN_WITNESS_UTXO in input_map:
|
||||
witness_utxo = input_map[PSBT_IN_WITNESS_UTXO]
|
||||
script = parse_witness_utxo(witness_utxo)
|
||||
if is_segwit_v2_or_later(script):
|
||||
return False, f"Input {i} uses segwit version > 1 with silent payments"
|
||||
script = _script_pubkey_from_psbt_input(input_map)
|
||||
if script is not None and is_segwit_v2_or_later(script):
|
||||
return False, f"Input {i} uses segwit version > 1 with silent payments"
|
||||
|
||||
# Check SIGHASH_ALL requirement - PSBT_IN_SIGHASH_TYPE is optional, but if set it must be SIGHASH_ALL when SP outputs are present
|
||||
for i, input_map in enumerate(psbt.i):
|
||||
|
||||
Reference in new issue
Block a user