mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-30 03:18:20 +00:00
feat(python): support sortedmulti
This commit is contained in:
parent
297f50783b
commit
ec44e5b767
1
python/.changelog.d/4351.added
Normal file
1
python/.changelog.d/4351.added
Normal file
@ -0,0 +1 @@
|
|||||||
|
Added support for lexicographic sorting of pubkeys in multisig.
|
@ -167,6 +167,12 @@ def cli() -> None:
|
|||||||
type=int,
|
type=int,
|
||||||
default=2,
|
default=2,
|
||||||
)
|
)
|
||||||
|
@click.option(
|
||||||
|
"-s",
|
||||||
|
"--multisig-sort-pubkeys",
|
||||||
|
is_flag=True,
|
||||||
|
help="Sort pubkeys lexicographically using BIP-67",
|
||||||
|
)
|
||||||
@click.option("-C", "--chunkify", is_flag=True)
|
@click.option("-C", "--chunkify", is_flag=True)
|
||||||
@with_client
|
@with_client
|
||||||
def get_address(
|
def get_address(
|
||||||
@ -178,6 +184,7 @@ def get_address(
|
|||||||
multisig_xpub: List[str],
|
multisig_xpub: List[str],
|
||||||
multisig_threshold: Optional[int],
|
multisig_threshold: Optional[int],
|
||||||
multisig_suffix_length: int,
|
multisig_suffix_length: int,
|
||||||
|
multisig_sort_pubkeys: bool,
|
||||||
chunkify: bool,
|
chunkify: bool,
|
||||||
) -> str:
|
) -> str:
|
||||||
"""Get address for specified path.
|
"""Get address for specified path.
|
||||||
@ -211,8 +218,16 @@ def get_address(
|
|||||||
|
|
||||||
multisig_suffix = address_n[-multisig_suffix_length:]
|
multisig_suffix = address_n[-multisig_suffix_length:]
|
||||||
nodes = [xpub_deserialize(x)[1] for x in multisig_xpub]
|
nodes = [xpub_deserialize(x)[1] for x in multisig_xpub]
|
||||||
|
pubkeys_order = (
|
||||||
|
messages.MultisigPubkeysOrder.LEXICOGRAPHIC
|
||||||
|
if multisig_sort_pubkeys
|
||||||
|
else messages.MultisigPubkeysOrder.PRESERVED
|
||||||
|
)
|
||||||
multisig = messages.MultisigRedeemScriptType(
|
multisig = messages.MultisigRedeemScriptType(
|
||||||
nodes=nodes, address_n=multisig_suffix, m=multisig_threshold
|
nodes=nodes,
|
||||||
|
address_n=multisig_suffix,
|
||||||
|
m=multisig_threshold,
|
||||||
|
pubkeys_order=pubkeys_order,
|
||||||
)
|
)
|
||||||
if script_type == messages.InputScriptType.SPENDADDRESS:
|
if script_type == messages.InputScriptType.SPENDADDRESS:
|
||||||
script_type = messages.InputScriptType.SPENDMULTISIG
|
script_type = messages.InputScriptType.SPENDMULTISIG
|
||||||
|
Loading…
Reference in New Issue
Block a user