From d114665da77a03c8dffa9eb5dc5a31b9aaa3fdf0 Mon Sep 17 00:00:00 2001 From: HackyMiner Date: Wed, 15 Aug 2018 02:45:44 +0900 Subject: [PATCH] ethereum: support full range 32bit chain_id (#399) --- firmware/ethereum.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/firmware/ethereum.c b/firmware/ethereum.c index b0d9eeb1e2..851d84e16f 100644 --- a/firmware/ethereum.c +++ b/firmware/ethereum.c @@ -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;