mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-02 02:41:28 +00:00
feat(core): implement GetPublicKey.ignore_xpub_magic behaviour
This commit is contained in:
parent
e660a518c6
commit
92452d54e5
@ -28,15 +28,21 @@ async def get_public_key(ctx: wire.Context, msg: GetPublicKey) -> PublicKey:
|
|||||||
elif (
|
elif (
|
||||||
coin.segwit
|
coin.segwit
|
||||||
and script_type == InputScriptType.SPENDP2SHWITNESS
|
and script_type == InputScriptType.SPENDP2SHWITNESS
|
||||||
and coin.xpub_magic_segwit_p2sh is not None
|
and (msg.ignore_xpub_magic or coin.xpub_magic_segwit_p2sh is not None)
|
||||||
):
|
):
|
||||||
node_xpub = node.serialize_public(coin.xpub_magic_segwit_p2sh)
|
# TODO: resolve type: ignore below
|
||||||
|
node_xpub = node.serialize_public(
|
||||||
|
coin.xpub_magic if msg.ignore_xpub_magic else coin.xpub_magic_segwit_p2sh # type: ignore
|
||||||
|
)
|
||||||
elif (
|
elif (
|
||||||
coin.segwit
|
coin.segwit
|
||||||
and script_type == InputScriptType.SPENDWITNESS
|
and script_type == InputScriptType.SPENDWITNESS
|
||||||
and coin.xpub_magic_segwit_native is not None
|
and (msg.ignore_xpub_magic or coin.xpub_magic_segwit_native is not None)
|
||||||
):
|
):
|
||||||
node_xpub = node.serialize_public(coin.xpub_magic_segwit_native)
|
# TODO: resolve type: ignore below
|
||||||
|
node_xpub = node.serialize_public(
|
||||||
|
coin.xpub_magic if msg.ignore_xpub_magic else coin.xpub_magic_segwit_native # type: ignore
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
raise wire.DataError("Invalid combination of coin and script_type")
|
raise wire.DataError("Invalid combination of coin and script_type")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user