1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-05 21:10:57 +00:00

fix(python): protocol_v2 database init

[no changelog]
This commit is contained in:
M1nd3r 2024-11-22 10:10:14 +01:00
parent 131c611fce
commit 08c0c94f42

View File

@ -50,7 +50,7 @@ def _get_iv_from_nonce(nonce: int) -> bytes:
class ProtocolV2(ProtocolAndChannel):
channel_id: int
channel_database: ChannelDatabase
key_request: bytes
key_response: bytes
nonce_request: int
@ -67,6 +67,7 @@ class ProtocolV2(ProtocolAndChannel):
mapping: ProtobufMapping,
channel_data: ChannelData | None = None,
) -> None:
self.channel_database: ChannelDatabase = get_channel_db()
super().__init__(transport, mapping, channel_data)
if channel_data is not None:
self.channel_id = channel_data.channel_id
@ -77,7 +78,6 @@ class ProtocolV2(ProtocolAndChannel):
self.sync_bit_receive = channel_data.sync_bit_receive
self.sync_bit_send = channel_data.sync_bit_send
self._has_valid_channel = True
self.channel_database: ChannelDatabase = get_channel_db()
def get_channel(self) -> ProtocolV2:
if not self._has_valid_channel: