From 4bc37c6b8227d0c49fc52c883fc5bb9c59d6969b Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Fri, 15 Feb 2019 01:44:10 +0100 Subject: [PATCH] signing: add default values for branch_id (zcash) --- firmware/signing.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/firmware/signing.c b/firmware/signing.c index 428fbd4d96..035ab05c72 100644 --- a/firmware/signing.c +++ b/firmware/signing.c @@ -487,6 +487,17 @@ void signing_init(const SignTx *msg, const CoinInfo *_coin, const HDNode *_root) overwintered = msg->has_overwintered && msg->overwintered; version_group_id = msg->version_group_id; branch_id = msg->branch_id; + // set default values for Zcash if branch_id is unset + if (overwintered && (branch_id == 0)) { + switch (version) { + case 3: + branch_id = 0x5BA81B19; // Overwinter + break; + case 4: + branch_id = 0x76B809BB; // Sapling + break; + } + } uint32_t size = TXSIZE_HEADER + TXSIZE_FOOTER + ser_length_size(inputs_count) + ser_length_size(outputs_count); if (coin->decred) {