1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-08 09:08:46 +00:00

isinstance is used instead of __qualname__

This commit is contained in:
Tomas Susanka 2018-05-24 10:48:38 +02:00 committed by Jan Pochyla
parent b026287aed
commit 37f6525c15
2 changed files with 7 additions and 6 deletions

View File

@ -3,6 +3,7 @@ from trezor.utils import symbol, model
from trezor.wire import register, protobuf_workflow from trezor.wire import register, protobuf_workflow
from trezor.messages import wire_types from trezor.messages import wire_types
from trezor.messages.Features import Features from trezor.messages.Features import Features
from trezor.messages.Initialize import Initialize
from trezor.messages.Success import Success from trezor.messages.Success import Success
from apps.common import storage, cache from apps.common import storage, cache
@ -10,7 +11,7 @@ from apps.common import storage, cache
async def respond_Features(ctx, msg): async def respond_Features(ctx, msg):
if msg.__qualname__ == 'Initialize': if isinstance(msg, Initialize):
if msg.state is None or bytes(msg.state) != cache.get_state(state=bytes(msg.state)): if msg.state is None or bytes(msg.state) != cache.get_state(state=bytes(msg.state)):
cache.clear() cache.clear()

View File

@ -1,7 +1,7 @@
from trezor import ui, wire from trezor import ui, wire
from trezor.messages.RequestType import TXFINISHED
from trezor.messages.wire_types import TxAck from trezor.messages.wire_types import TxAck
from apps.common import seed from apps.common import seed
from apps.wallet.sign_tx.helpers import *
@ui.layout @ui.layout
@ -26,17 +26,17 @@ async def sign_tx(ctx, msg):
raise wire.Error(*e.args) raise wire.Error(*e.args)
except signing.Bip143Error as e: except signing.Bip143Error as e:
raise wire.Error(*e.args) raise wire.Error(*e.args)
if req.__qualname__ == 'TxRequest': if isinstance(req, TxRequest):
if req.request_type == TXFINISHED: if req.request_type == TXFINISHED:
break break
res = await ctx.call(req, TxAck) res = await ctx.call(req, TxAck)
elif req.__qualname__ == 'UiConfirmOutput': elif isinstance(req, UiConfirmOutput):
res = await layout.confirm_output(ctx, req.output, req.coin) res = await layout.confirm_output(ctx, req.output, req.coin)
progress.report_init() progress.report_init()
elif req.__qualname__ == 'UiConfirmTotal': elif isinstance(req, UiConfirmTotal):
res = await layout.confirm_total(ctx, req.spending, req.fee, req.coin) res = await layout.confirm_total(ctx, req.spending, req.fee, req.coin)
progress.report_init() progress.report_init()
elif req.__qualname__ == 'UiConfirmFeeOverThreshold': elif isinstance(req, UiConfirmFeeOverThreshold):
res = await layout.confirm_feeoverthreshold(ctx, req.fee, req.coin) res = await layout.confirm_feeoverthreshold(ctx, req.fee, req.coin)
progress.report_init() progress.report_init()
else: else: