Skip to content

Commit

Permalink
Fix code style check
Browse files Browse the repository at this point in the history
  • Loading branch information
timemarkovqtum committed Oct 16, 2023
1 parent e0ba4b3 commit 7b4388d
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/common/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "../crypto.h"
#endif

#ifndef SKIP_FOR_CMOCKA
#define DELEGATIONS_ADDRESS "\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0\x86"
#define ADD_DELEGATION_HASH "\x4c\x0e\x96\x8c"
#define REMOVE_DELEGATION_HASH "\x3d\x66\x6e\x8b"
Expand Down Expand Up @@ -413,6 +412,7 @@ bool get_sender_sig(uint8_t *buffer, size_t size, uint8_t **sig, unsigned int *s
*sigSize > 0;
}

#ifndef SKIP_FOR_CMOCKA
bool opcall_addr_encode(const uint8_t script[],
size_t script_len,
char *out,
Expand Down
2 changes: 1 addition & 1 deletion src/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* Maximum scriptPubKey length for an output that we can recognize.
*/
#define MAX_OUTPUT_SCRIPTPUBKEY_LEN 400 // max 393 for contracts; other scripts are shorter
#define MAX_INPUT_SCRIPTPUBKEY_LEN 35 // P2PK's scriptPubKeys are the longest supported
#define MAX_INPUT_SCRIPTPUBKEY_LEN 35 // P2PK's scriptPubKeys are the longest supported

/**
* Maximum length of a wallet registered into the device (characters), excluding terminating NULL.
Expand Down
7 changes: 4 additions & 3 deletions src/handler/sign_psbt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1439,10 +1439,11 @@ static bool read_outputs(dispatcher_context_t *dc,
++external_outputs_count;

// check if output contract data is allowed
bool isContractBlindSign = is_contract_blind_sign(output.in_out.scriptPubKey, output.in_out.scriptPubKey_len);
if(isContractBlindSign && !N_storage.dataAllowed) {
bool isContractBlindSign =
is_contract_blind_sign(output.in_out.scriptPubKey, output.in_out.scriptPubKey_len);
if (isContractBlindSign && !N_storage.dataAllowed) {
ui_warn_contract_data(dc);
if(!N_storage.dataAllowed) {
if (!N_storage.dataAllowed) {
SEND_SW(dc, SW_SIGNATURE_FAIL);
return false;
}
Expand Down
32 changes: 15 additions & 17 deletions src/ui/display_bagl.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,24 +248,22 @@ UX_STEP_CB(ux_sign_message_accept_new,
{&C_icon_validate_14, "Sign", "message"});

#ifdef TARGET_NANOS
UX_STEP_CB(
ux_warning_contract_data_step,
bnnn_paging,
set_ux_flow_response(false),
{
"Error",
"Blind signing must be enabled in Settings",
});
UX_STEP_CB(ux_warning_contract_data_step,
bnnn_paging,
set_ux_flow_response(false),
{
"Error",
"Blind signing must be enabled in Settings",
});
#else
UX_STEP_CB(
ux_warning_contract_data_step,
pnn,
set_ux_flow_response(false),
{
&C_icon_crossmark,
"Blind signing must be",
"enabled in Settings",
});
UX_STEP_CB(ux_warning_contract_data_step,
pnn,
set_ux_flow_response(false),
{
&C_icon_crossmark,
"Blind signing must be",
"enabled in Settings",
});
#endif

// FLOW to display BIP32 path and a message hash to sign:
Expand Down
6 changes: 3 additions & 3 deletions src/ui/menu_bagl.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ UX_STEP_NOCB(ux_menu_ready_step_bitcoin_testnet,

UX_STEP_NOCB(ux_menu_version_step, bn, {"Version", APPVERSION});
UX_STEP_CB(ux_menu_about_step, pb, ui_menu_about(), {&C_icon_certificate, "About"});
UX_STEP_CB(ux_menu_settings_step, pb, ui_menu_settings(), {&C_icon_eye,"Settings"});
UX_STEP_CB(ux_menu_settings_step, pb, ui_menu_settings(), {&C_icon_eye, "Settings"});
UX_STEP_VALID(ux_menu_exit_step, pb, os_sched_exit(-1), {&C_icon_dashboard_x, "Quit"});

// FLOW for the main menu (for bitcoin):
Expand Down Expand Up @@ -99,8 +99,8 @@ void ui_menu_settings(void) {
#define DISABLED_STR "Disabled"
#define BUF_INCREMENT (MAX(strlen(ENABLED_STR), strlen(DISABLED_STR)) + 1)
char strings[BUF_INCREMENT];
#define SETTING_BLIND_SIGNING_STATE strings
#define BOOL_TO_STATE_STR(b) (b ? ENABLED_STR : DISABLED_STR)
#define SETTING_BLIND_SIGNING_STATE strings
#define BOOL_TO_STATE_STR(b) (b ? ENABLED_STR : DISABLED_STR)

// clang-format off
UX_STEP_CB(
Expand Down
8 changes: 7 additions & 1 deletion src/ui/menu_nbgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ void settings_call_back(void) {
}

void ui_menu_settings(void) {
nbgl_useCaseSettings("Qtum", 1, 2, false, settings_call_back, navigation_cb, controls_call_back);
nbgl_useCaseSettings("Qtum",
1,
2,
false,
settings_call_back,
navigation_cb,
controls_call_back);
}
#endif // HAVE_NBGL

0 comments on commit 7b4388d

Please sign in to comment.