1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-21 04:41:18 +00:00

chore(core): clean/improve create_new_session.py

[no changelog]
This commit is contained in:
M1nd3r 2024-10-16 16:53:57 +02:00
parent cd649b1f78
commit 51d9607341

View File

@ -21,7 +21,7 @@ async def create_new_session(message: ThpCreateNewSession) -> ThpNewSession | Fa
channel = ctx.channel
# Do not use `ctx` beyond this point, as it is techically
# allowed to change inbetween await statements
# allowed to change in between await statements
new_session = create_new_session(channel)
try:
@ -31,13 +31,11 @@ async def create_new_session(message: ThpCreateNewSession) -> ThpNewSession | Fa
except ActionCancelled as e:
return Failure(code=FailureType.ActionCancelled, message=e.message)
# TODO handle other errors
# TODO handle BITCOIN_ONLY
new_session.set_session_state(SessionState.ALLOCATED)
channel.sessions[new_session.session_id] = new_session
loop.schedule(new_session.handle())
new_session_id: int = new_session.session_id
# await get_seed() TODO
if __debug__:
log.debug(