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

fixed rlp_length for chain_id > 255 #381

Merged
merged 2 commits into from
Jul 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion firmware/ethereum.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,8 @@ void ethereum_signing_init(EthereumSignTx *msg, const HDNode *node)
rlp_length += rlp_calculate_length(1, tx_type);
}
if (chain_id) {
rlp_length += rlp_calculate_length(1, chain_id);
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