Skip to content
This repository has been archived by the owner on Apr 16, 2019. It is now read-only.

Commit

Permalink
remove nested if, remove case for < 0x80 (by jhoenicke)
Browse files Browse the repository at this point in the history
  • Loading branch information
hackmod committed Jul 18, 2018
1 parent c581715 commit 1c81a14
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions firmware/ethereum.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,10 +568,7 @@ void ethereum_signing_init(EthereumSignTx *msg, const HDNode *node)
rlp_length += rlp_calculate_length(1, tx_type);
}
if (chain_id) {
int length = 0;
if (msg->has_chain_id) {
length = chain_id < 0x80 ? 0: chain_id < 0x100 ? 1: chain_id < 0x10000 ? 2: chain_id < 0x1000000 ? 3 : 4;
}
int length = chain_id < 0x100 ? 1: chain_id < 0x10000 ? 2: chain_id < 0x1000000 ? 3 : 4;
rlp_length += rlp_calculate_length(length, chain_id);
rlp_length += rlp_calculate_length(0, 0);
rlp_length += rlp_calculate_length(0, 0);
Expand Down

0 comments on commit 1c81a14

Please sign in to comment.