mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-03 20:11:00 +00:00
wallet: fix ergonomic issue in the multisig structure
Previously, it wasn't completely clear that MultisigRedeemScriptType.signatures needs to contain empty bytes for missing signatures. Now it can be shorter or even empty.
This commit is contained in:
parent
4ee69f1e3f
commit
4db5f56d0a
@ -156,13 +156,17 @@ def witness_p2wsh(
|
||||
signature_index: int,
|
||||
sighash: int,
|
||||
):
|
||||
signatures = multisig.signatures # other signatures
|
||||
if len(signatures[signature_index]) > 0:
|
||||
# get other signatures, stretch with None to the number of the pubkeys
|
||||
signatures = multisig.signatures + [None] * (
|
||||
len(multisig.pubkeys) - len(multisig.signatures)
|
||||
)
|
||||
# fill in our signature
|
||||
if signatures[signature_index]:
|
||||
raise ScriptsError("Invalid multisig parameters")
|
||||
signatures[signature_index] = signature # our signature
|
||||
signatures[signature_index] = signature
|
||||
|
||||
# filter empty
|
||||
signatures = [s for s in multisig.signatures if len(s) > 0]
|
||||
signatures = [s for s in multisig.signatures if s]
|
||||
|
||||
# witness program + signatures + redeem script
|
||||
num_of_witness_items = 1 + len(signatures) + 1
|
||||
|
Loading…
Reference in New Issue
Block a user