1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-23 07:58:09 +00:00

wallet: use coin's .curve_name

This commit is contained in:
Yura Pakhuchiy 2018-07-01 20:16:53 +07:00 committed by Pavol Rusnak
parent 7db1061123
commit a3542a6441
4 changed files with 9 additions and 8 deletions

View File

@ -9,7 +9,7 @@ async def get_address(ctx, msg):
coin_name = msg.coin_name or 'Bitcoin' coin_name = msg.coin_name or 'Bitcoin'
coin = coins.by_name(coin_name) coin = coins.by_name(coin_name)
node = await seed.derive_node(ctx, msg.address_n) node = await seed.derive_node(ctx, msg.address_n, curve_name=coin.curve_name)
address = addresses.get_address(msg.script_type, coin, node, msg.multisig) address = addresses.get_address(msg.script_type, coin, node, msg.multisig)
address_short = addresses.address_short(coin, address) address_short = addresses.address_short(coin, address)

View File

@ -11,13 +11,12 @@ from ubinascii import hexlify
async def get_public_key(ctx, msg): async def get_public_key(ctx, msg):
coin_name = msg.coin_name or 'Bitcoin' coin_name = msg.coin_name or 'Bitcoin'
coin = coins.by_name(coin_name)
curve_name = msg.ecdsa_curve_name curve_name = msg.ecdsa_curve_name
if not curve_name: if not curve_name:
node = await seed.derive_node(ctx, msg.address_n) curve_name = coin.curve_name
else: node = await seed.derive_node(ctx, msg.address_n, curve_name=curve_name)
node = await seed.derive_node(ctx, msg.address_n, curve_name=curve_name)
coin = coins.by_name(coin_name)
node_xpub = node.serialize_public(coin.xpub_magic) node_xpub = node.serialize_public(coin.xpub_magic)
pubkey = node.public_key() pubkey = node.public_key()

View File

@ -18,7 +18,7 @@ async def sign_message(ctx, msg):
await require_confirm_sign_message(ctx, message) await require_confirm_sign_message(ctx, message)
node = await seed.derive_node(ctx, address_n) node = await seed.derive_node(ctx, address_n, curve_name=coin.curve_name)
seckey = node.private_key() seckey = node.private_key()
address = get_address(script_type, coin, node) address = get_address(script_type, coin, node)

View File

@ -2,7 +2,7 @@ from trezor import ui, wire
from trezor.messages.MessageType import TxAck from trezor.messages.MessageType import TxAck
from trezor.messages.TxRequest import TxRequest from trezor.messages.TxRequest import TxRequest
from trezor.messages.RequestType import TXFINISHED from trezor.messages.RequestType import TXFINISHED
from apps.common import seed from apps.common import seed, coins
from apps.wallet.sign_tx.helpers import UiConfirmOutput, UiConfirmTotal, UiConfirmFeeOverThreshold, UiConfirmForeignAddress from apps.wallet.sign_tx.helpers import UiConfirmOutput, UiConfirmTotal, UiConfirmFeeOverThreshold, UiConfirmForeignAddress
@ -10,8 +10,10 @@ from apps.wallet.sign_tx.helpers import UiConfirmOutput, UiConfirmTotal, UiConfi
async def sign_tx(ctx, msg): async def sign_tx(ctx, msg):
from apps.wallet.sign_tx import layout, progress, signing from apps.wallet.sign_tx import layout, progress, signing
coin_name = msg.coin_name or 'Bitcoin'
coin = coins.by_name(coin_name)
# TODO: rework this so we don't have to pass root to signing.sign_tx # TODO: rework this so we don't have to pass root to signing.sign_tx
root = await seed.derive_node(ctx, []) root = await seed.derive_node(ctx, [], curve_name=coin.curve_name)
signer = signing.sign_tx(msg, root) signer = signing.sign_tx(msg, root)
res = None res = None