Skip to content

Commit

Permalink
Merge pull request #194 from LedgerHQ/fix-swap-screen
Browse files Browse the repository at this point in the history
Fix swap screen
  • Loading branch information
sgliner-ledger authored Aug 30, 2023
2 parents c95993b + 56f39db commit a27fc18
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ jobs:
run: |
cd tests
pip install -r requirements.txt
PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --model=${{ matrix.model }} --timeout=300
PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --model=${{ matrix.model }} --timeout=500
job_test_mainnet:
name: Tests on mainnet
Expand Down
18 changes: 13 additions & 5 deletions src/handler/sign_psbt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ process_outputs(dispatcher_context_t *dc, sign_psbt_state_t *st) {

if (!read_outputs(dc, st, &placeholder_info, true)) return false;

if (!ui_transaction_prompt(dc, st->outputs.n_external)) {
if (!G_swap_state.called_from_swap && !ui_transaction_prompt(dc, st->outputs.n_external)) {
SEND_SW(dc, SW_DENY);
return false;
}
Expand Down Expand Up @@ -2381,7 +2381,9 @@ sign_transaction(dispatcher_context_t *dc,

if (n_key_placeholders < 0) {
SEND_SW(dc, SW_BAD_STATE); // should never happen
ui_post_processing_confirm_transaction(dc, false);
if (!G_swap_state.called_from_swap) {
ui_post_processing_confirm_transaction(dc, false);
}
return false;
}

Expand Down Expand Up @@ -2415,7 +2417,9 @@ sign_transaction(dispatcher_context_t *dc,
&input.in_out.map);
if (res < 0) {
SEND_SW(dc, SW_INCORRECT_DATA);
ui_post_processing_confirm_transaction(dc, false);
if (!G_swap_state.called_from_swap) {
ui_post_processing_confirm_transaction(dc, false);
}
return false;
}

Expand All @@ -2428,7 +2432,9 @@ sign_transaction(dispatcher_context_t *dc,

if (!sign_transaction_input(dc, st, &hashes, &placeholder_info, &input, i)) {
SEND_SW(dc, SW_BAD_STATE); // should never happen
ui_post_processing_confirm_transaction(dc, false);
if (!G_swap_state.called_from_swap) {
ui_post_processing_confirm_transaction(dc, false);
}
return false;
}
}
Expand All @@ -2437,7 +2443,9 @@ sign_transaction(dispatcher_context_t *dc,
++placeholder_index;
}

ui_post_processing_confirm_transaction(dc, true);
if (!G_swap_state.called_from_swap) {
ui_post_processing_confirm_transaction(dc, true);
}
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/automations/register_wallet_accept.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
]
},
{
"regexp": "Processing",
"regexp": "Processing|REGISTERED",
"actions": [
["finger", 55, 550, false]
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
]
},
{
"regexp": "[S]?pend from|Wallet name|There are|Reject if you're|Review|Amount|Address|Confirm|Fees",
"regexp": "[S]?pend from|Wallet name|There are|Reject if you['-]re|Review|Amount|Address|Confirm|Fees",
"actions": [
["button", 2, true],
["button", 2, false]
Expand Down
9 changes: 7 additions & 2 deletions tests/test_get_extended_pubkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def ux_thread():
def ux_thread_stax():
event = comm.get_next_event()

while "Approve" not in event["text"]:
while "Approve public key" not in event["text"]:
if "Tap to continue" in event["text"]:
comm.finger_touch(55, 550)

Expand Down Expand Up @@ -165,7 +165,12 @@ def ux_thread():
comm.press_and_release("right")
comm.wait_for_text_event("Confirm public key")
comm.press_and_release("right")
comm.wait_for_text_event("111'/222'/333'")
# Temporary fix for broken OCR
if (model == "nanox"):
comm.wait_for_text_event("111-/222-/333-")
else:
comm.wait_for_text_event("111'/222'/333'")

comm.press_and_release("right")
comm.wait_for_text_event("not sure") # second line of "Reject if you're not sure"
comm.press_and_release("both")
Expand Down

0 comments on commit a27fc18

Please sign in to comment.