mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 12:28:09 +00:00
core/bitcoin: Rename witness_p2wsh() to witness_multisig().
This commit is contained in:
parent
91b615c217
commit
37f4dcc7e5
@ -293,7 +293,7 @@ def parse_witness_p2wpkh(witness: bytes) -> Tuple[bytes, bytes, int]:
|
||||
return pubkey, signature, hash_type
|
||||
|
||||
|
||||
def witness_p2wsh(
|
||||
def witness_multisig(
|
||||
multisig: MultisigRedeemScriptType,
|
||||
signature: bytes,
|
||||
signature_index: int,
|
||||
@ -342,7 +342,7 @@ def witness_p2wsh(
|
||||
return w
|
||||
|
||||
|
||||
def parse_witness_p2wsh(witness: bytes) -> Tuple[bytes, List[Tuple[bytes, int]]]:
|
||||
def parse_witness_multisig(witness: bytes) -> Tuple[bytes, List[Tuple[bytes, int]]]:
|
||||
try:
|
||||
r = BytearrayReader(witness)
|
||||
|
||||
@ -535,7 +535,7 @@ def write_bip322_signature_proof(
|
||||
if multisig:
|
||||
# find the place of our signature based on the public key
|
||||
signature_index = multisig_pubkey_index(multisig, public_key)
|
||||
witness = witness_p2wsh(
|
||||
witness = witness_multisig(
|
||||
multisig, signature, signature_index, common.SIGHASH_ALL
|
||||
)
|
||||
else:
|
||||
|
@ -353,7 +353,7 @@ class Bitcoin:
|
||||
# find out place of our signature based on the pubkey
|
||||
signature_index = multisig.multisig_pubkey_index(txi.multisig, public_key)
|
||||
self.serialized_tx.extend(
|
||||
scripts.witness_p2wsh(
|
||||
scripts.witness_multisig(
|
||||
txi.multisig, signature, signature_index, self.get_hash_type(txi)
|
||||
)
|
||||
)
|
||||
|
@ -13,8 +13,8 @@ from .scripts import (
|
||||
parse_input_script_multisig,
|
||||
parse_input_script_p2pkh,
|
||||
parse_output_script_multisig,
|
||||
parse_witness_multisig,
|
||||
parse_witness_p2wpkh,
|
||||
parse_witness_p2wsh,
|
||||
)
|
||||
|
||||
if False:
|
||||
@ -38,7 +38,7 @@ class SignatureVerifier:
|
||||
self.public_keys = [public_key]
|
||||
self.signatures = [(signature, hash_type)]
|
||||
elif len(script_pubkey) == 34: # P2WSH
|
||||
script, self.signatures = parse_witness_p2wsh(witness)
|
||||
script, self.signatures = parse_witness_multisig(witness)
|
||||
script_hash = sha256(script).digest()
|
||||
if output_script_native_p2wpkh_or_p2wsh(script_hash) != script_pubkey:
|
||||
raise wire.DataError("Invalid script hash")
|
||||
@ -57,7 +57,7 @@ class SignatureVerifier:
|
||||
self.public_keys = [public_key]
|
||||
self.signatures = [(signature, hash_type)]
|
||||
elif len(script_sig) == 35: # P2WSH nested in BIP16 P2SH
|
||||
script, self.signatures = parse_witness_p2wsh(witness)
|
||||
script, self.signatures = parse_witness_multisig(witness)
|
||||
script_hash = sha256(script).digest()
|
||||
if input_script_p2wsh_in_p2sh(script_hash) != script_sig:
|
||||
raise wire.DataError("Invalid script hash")
|
||||
|
Loading…
Reference in New Issue
Block a user