Skip to content

Commit 22ce038

Browse files
Report exception to exchange in swap mode
1 parent e8f68a6 commit 22ce038

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib_standard_app/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ WEAK void library_app_main(libargs_t *args)
149149
}
150150
FINALLY
151151
{
152-
os_lib_end();
152+
swap_finalize_exchange_sign_transaction(LAST_CYCLE_EXCEPTION);
153153
}
154154
}
155155
END_TRY;

lib_standard_app/swap_entrypoints.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,15 @@ void swap_handle_get_printable_amount(get_printable_amount_parameters_t *params)
4141
* return false on error, true otherwise */
4242
bool swap_copy_transaction_parameters(create_transaction_parameters_t *sign_transaction_params);
4343

44+
// Boolean like status + a special value
45+
typedef enum last_cycle_status_e {
46+
LAST_CYCLE_ERROR = 0,
47+
LAST_CYCLE_SUCCESS = 1,
48+
LAST_CYCLE_EXCEPTION = 2,
49+
} last_cycle_status_t;
50+
4451
/* Set create_transaction.result and call os_lib_end().
4552
*
4653
* Doesn't return */
47-
void __attribute__((noreturn)) swap_finalize_exchange_sign_transaction(bool is_success);
54+
void __attribute__((noreturn))
55+
swap_finalize_exchange_sign_transaction(last_cycle_status_t is_success);

0 commit comments

Comments
 (0)