1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 15:38:11 +00:00

apps.wallet: handle EstimateTxSize message

This commit is contained in:
Pavol Rusnak 2016-11-15 18:29:46 +01:00
parent e10e20d550
commit e6d38b8b71
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -1,7 +1,7 @@
from trezor.wire import register_type, protobuf_handler
from trezor.utils import unimport
from trezor.messages.wire_types import \
GetPublicKey, GetAddress, SignTx, SignMessage
GetPublicKey, GetAddress, SignTx, EstimateTxSize, SignMessage
@unimport
@ -22,6 +22,14 @@ def dispatch_SignTx(*args, **kwargs):
return layout_sign_tx(*args, **kwargs)
@unimport
async def dispatch_EstimateTxSize(msg, session_id):
from trezor.messages.TxSize import TxSize
m = TxSize()
m.tx_size = 10 + msg.inputs_count * 149 + msg.outputs_count * 35
return m
@unimport
def dispatch_SignMessage(*args, **kwargs):
from .layout_sign_message import layout_sign_message
@ -32,4 +40,5 @@ def boot():
register_type(GetPublicKey, protobuf_handler, dispatch_GetPublicKey)
register_type(GetAddress, protobuf_handler, dispatch_GetAddress)
register_type(SignTx, protobuf_handler, dispatch_SignTx)
register_type(EstimateTxSize, protobuf_handler, dispatch_EstimateTxSize)
register_type(SignMessage, protobuf_handler, dispatch_SignMessage)