1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 09:28:13 +00:00

ethereum: support full range 32bit chain_id (#399)

This commit is contained in:
HackyMiner 2018-08-15 02:45:44 +09:00 committed by Pavol Rusnak
parent 809e313beb
commit d114665da7

View File

@ -202,7 +202,9 @@ static void send_signature(void)
msg_tx_request.has_data_length = false;
msg_tx_request.has_signature_v = true;
if (chain_id) {
if (chain_id > MAX_CHAIN_ID) {
msg_tx_request.signature_v = v;
} else if (chain_id) {
msg_tx_request.signature_v = v + 2 * chain_id + 35;
} else {
msg_tx_request.signature_v = v + 27;
@ -464,7 +466,7 @@ void ethereum_signing_init(EthereumSignTx *msg, const HDNode *node)
/* eip-155 chain id */
if (msg->has_chain_id) {
if (msg->chain_id < 1 || msg->chain_id > MAX_CHAIN_ID) {
if (msg->chain_id < 1) {
fsm_sendFailure(Failure_FailureType_Failure_DataError, _("Chain Id out of bounds"));
ethereum_signing_abort();
return;