Skip to content

Commit

Permalink
fix: fix the jump problem in format_operation_source
Browse files Browse the repository at this point in the history
  • Loading branch information
overcat committed Aug 26, 2021
1 parent acdd872 commit 0a59bb3
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions src/stellar_format.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,35 @@ static void format_confirm_transaction_details(tx_context_t *txCtx) {
format_memo(txCtx);
}

static void format_next_operation(tx_context_t *txCtx) {
formatter_stack[formatter_index] = NULL;
set_state_data(true);
}

static void format_operation_source(tx_context_t *txCtx) {
if (txCtx->opDetails.sourceAccountPresent) {
strcpy(detailCaption, "Op Source");
print_public_key(txCtx->opDetails.sourceAccount, detailValue, 0, 0);
push_to_formatter_stack(&format_confirm_transaction_details);
} else {
if (txCtx->opIdx == txCtx->opCount) {
// last operation: show transaction details
if (txCtx->opIdx == txCtx->opCount) {
// last operation
if (txCtx->opDetails.sourceAccountPresent) {
// If there is a source account, wait for the user to
// enter the next step after displaying the source account
strcpy(detailCaption, "Op Source");
print_public_key(txCtx->opDetails.sourceAccount, detailValue, 0, 0);
push_to_formatter_stack(&format_confirm_transaction_details);
} else {
// Otherwise, go to the next step and display the transaction information.
format_confirm_transaction_details(txCtx);
}
} else {
// more operations
if (txCtx->opDetails.sourceAccountPresent) {
// If there is a source account, wait for the user to
// enter the next step after displaying the source account
strcpy(detailCaption, "Op Source");
print_public_key(txCtx->opDetails.sourceAccount, detailValue, 0, 0);
push_to_formatter_stack(&format_next_operation);
} else {
// more operations: show next operation
formatter_stack[formatter_index] = NULL;
set_state_data(true);
// Otherwise, show the next operation.
format_next_operation(txCtx);
}
}
}
Expand Down

0 comments on commit 0a59bb3

Please sign in to comment.