From 06304c2378ed9b4ec867f6a9f384257a6394cd29 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Fri, 12 May 2017 23:00:42 +0200 Subject: [PATCH] update coins --- firmware/coins-gen.py | 6 ------ firmware/coins.c | 16 ++++++++-------- firmware/protob/types.pb.c | 8 ++------ firmware/protob/types.pb.h | 16 ++++------------ vendor/trezor-common | 2 +- 5 files changed, 15 insertions(+), 33 deletions(-) diff --git a/firmware/coins-gen.py b/firmware/coins-gen.py index 39de05c38..7cb323c72 100755 --- a/firmware/coins-gen.py +++ b/firmware/coins-gen.py @@ -22,12 +22,6 @@ for c in coins: 'true' if c['address_type_p2sh'] is not None else 'false', '%d' % c['address_type_p2sh'] if c['address_type_p2sh'] is not None else '0', - 'true' if c['address_type_p2wpkh'] is not None else 'false', - '%d' % c['address_type_p2wpkh'] if c['address_type_p2wpkh'] is not None else '0', - - 'true' if c['address_type_p2wsh'] is not None else 'false', - '%d' % c['address_type_p2wsh'] if c['address_type_p2wsh'] is not None else '0', - 'true' if c['signed_message_header'] is not None else 'false', '"\\x%02x" "%s"' % (len(c['signed_message_header']), c['signed_message_header'].replace('\n', '\\n')) if c['signed_message_header'] is not None else 'NULL', diff --git a/firmware/coins.c b/firmware/coins.c index abe080f75..ac1f54def 100644 --- a/firmware/coins.c +++ b/firmware/coins.c @@ -26,14 +26,14 @@ // filled CoinType Protobuf structure defined in https://github.com/trezor/trezor-common/blob/master/protob/types.proto#L133 // address types > 0xFF represent a two-byte prefix in big-endian order const CoinType coins[COINS_COUNT] = { - {true, "Bitcoin", true, "BTC", true, 0, true, 300000, true, 5, true, 6, true, 10, true, "\x18" "Bitcoin Signed Message:\n", true, 0x0488b21e, true, 0x0488ade4, true, false, }, - {true, "Testnet", true, "TEST", true, 111, true, 10000000, true, 196, true, 3, true, 40, true, "\x18" "Bitcoin Signed Message:\n", true, 0x043587cf, true, 0x04358394, true, true, }, - {true, "Namecoin", true, "NMC", true, 52, true, 10000000, true, 5, false, 0, false, 0, true, "\x19" "Namecoin Signed Message:\n", true, 0x019da462, true, 0x019d9cfe, true, false, }, - {true, "Litecoin", true, "LTC", true, 48, true, 1000000, true, 5, false, 0, false, 0, true, "\x19" "Litecoin Signed Message:\n", true, 0x019da462, true, 0x019d9cfe, true, true, }, - {true, "Dogecoin", true, "DOGE", true, 30, true, 1000000000, true, 22, false, 0, false, 0, true, "\x19" "Dogecoin Signed Message:\n", true, 0x02facafd, true, 0x02fac398, true, false, }, - {true, "Dash", true, "DASH", true, 76, true, 100000, true, 16, false, 0, false, 0, true, "\x19" "DarkCoin Signed Message:\n", true, 0x02fe52cc, true, 0x02fe52f8, true, false, }, - {true, "Zcash", true, "ZEC", true, 7352, true, 1000000, true, 7357, false, 0, false, 0, true, "\x16" "Zcash Signed Message:\n", true, 0x0488b21e, true, 0x0488ade4, true, false, }, - {true, "Zcash Testnet", true, "TAZ", true, 7461, true, 10000000, true, 7354, false, 0, false, 0, true, "\x16" "Zcash Signed Message:\n", true, 0x043587cf, true, 0x04358394, true, false, }, + {true, "Bitcoin", true, "BTC", true, 0, true, 300000, true, 5, true, "\x18" "Bitcoin Signed Message:\n", true, 0x0488b21e, true, 0x0488ade4, true, false, }, + {true, "Testnet", true, "TEST", true, 111, true, 10000000, true, 196, true, "\x18" "Bitcoin Signed Message:\n", true, 0x043587cf, true, 0x04358394, true, true, }, + {true, "Namecoin", true, "NMC", true, 52, true, 10000000, true, 5, true, "\x19" "Namecoin Signed Message:\n", true, 0x019da462, true, 0x019d9cfe, true, false, }, + {true, "Litecoin", true, "LTC", true, 48, true, 1000000, true, 50, true, "\x19" "Litecoin Signed Message:\n", true, 0x019da462, true, 0x019d9cfe, true, true, }, + {true, "Dogecoin", true, "DOGE", true, 30, true, 1000000000, true, 22, true, "\x19" "Dogecoin Signed Message:\n", true, 0x02facafd, true, 0x02fac398, true, false, }, + {true, "Dash", true, "DASH", true, 76, true, 100000, true, 16, true, "\x19" "DarkCoin Signed Message:\n", true, 0x02fe52cc, true, 0x02fe52f8, true, false, }, + {true, "Zcash", true, "ZEC", true, 7352, true, 1000000, true, 7357, true, "\x16" "Zcash Signed Message:\n", true, 0x0488b21e, true, 0x0488ade4, true, false, }, + {true, "Zcash Testnet", true, "TAZ", true, 7461, true, 10000000, true, 7354, true, "\x16" "Zcash Signed Message:\n", true, 0x043587cf, true, 0x04358394, true, false, }, }; const CoinType *coinByShortcut(const char *shortcut) diff --git a/firmware/protob/types.pb.c b/firmware/protob/types.pb.c index 13448c606..dfc9a4908 100644 --- a/firmware/protob/types.pb.c +++ b/firmware/protob/types.pb.c @@ -5,8 +5,6 @@ const uint32_t CoinType_address_type_default = 0u; const uint32_t CoinType_address_type_p2sh_default = 5u; -const uint32_t CoinType_address_type_p2wpkh_default = 6u; -const uint32_t CoinType_address_type_p2wsh_default = 10u; const uint32_t CoinType_xpub_magic_default = 76067358u; const uint32_t CoinType_xprv_magic_default = 76066276u; const uint32_t TxInputType_sequence_default = 4294967295u; @@ -30,15 +28,13 @@ const pb_field_t HDNodePathType_fields[3] = { PB_LAST_FIELD }; -const pb_field_t CoinType_fields[12] = { +const pb_field_t CoinType_fields[10] = { PB_FIELD2( 1, STRING , OPTIONAL, STATIC , FIRST, CoinType, coin_name, coin_name, 0), PB_FIELD2( 2, STRING , OPTIONAL, STATIC , OTHER, CoinType, coin_shortcut, coin_name, 0), PB_FIELD2( 3, UINT32 , OPTIONAL, STATIC , OTHER, CoinType, address_type, coin_shortcut, &CoinType_address_type_default), PB_FIELD2( 4, UINT64 , OPTIONAL, STATIC , OTHER, CoinType, maxfee_kb, address_type, 0), PB_FIELD2( 5, UINT32 , OPTIONAL, STATIC , OTHER, CoinType, address_type_p2sh, maxfee_kb, &CoinType_address_type_p2sh_default), - PB_FIELD2( 6, UINT32 , OPTIONAL, STATIC , OTHER, CoinType, address_type_p2wpkh, address_type_p2sh, &CoinType_address_type_p2wpkh_default), - PB_FIELD2( 7, UINT32 , OPTIONAL, STATIC , OTHER, CoinType, address_type_p2wsh, address_type_p2wpkh, &CoinType_address_type_p2wsh_default), - PB_FIELD2( 8, STRING , OPTIONAL, STATIC , OTHER, CoinType, signed_message_header, address_type_p2wsh, 0), + PB_FIELD2( 8, STRING , OPTIONAL, STATIC , OTHER, CoinType, signed_message_header, address_type_p2sh, 0), PB_FIELD2( 9, UINT32 , OPTIONAL, STATIC , OTHER, CoinType, xpub_magic, signed_message_header, &CoinType_xpub_magic_default), PB_FIELD2( 10, UINT32 , OPTIONAL, STATIC , OTHER, CoinType, xprv_magic, xpub_magic, &CoinType_xprv_magic_default), PB_FIELD2( 11, BOOL , OPTIONAL, STATIC , OTHER, CoinType, segwit, xprv_magic, 0), diff --git a/firmware/protob/types.pb.h b/firmware/protob/types.pb.h index 30c52123c..892b0df88 100644 --- a/firmware/protob/types.pb.h +++ b/firmware/protob/types.pb.h @@ -92,10 +92,6 @@ typedef struct _CoinType { uint64_t maxfee_kb; bool has_address_type_p2sh; uint32_t address_type_p2sh; - bool has_address_type_p2wpkh; - uint32_t address_type_p2wpkh; - bool has_address_type_p2wsh; - uint32_t address_type_p2wsh; bool has_signed_message_header; char signed_message_header[32]; bool has_xpub_magic; @@ -292,8 +288,6 @@ extern const pb_extension_type_t wire_debug_out; /* Default values for struct fields */ extern const uint32_t CoinType_address_type_default; extern const uint32_t CoinType_address_type_p2sh_default; -extern const uint32_t CoinType_address_type_p2wpkh_default; -extern const uint32_t CoinType_address_type_p2wsh_default; extern const uint32_t CoinType_xpub_magic_default; extern const uint32_t CoinType_xprv_magic_default; extern const uint32_t TxInputType_sequence_default; @@ -303,7 +297,7 @@ extern const uint32_t IdentityType_index_default; /* Initializer values for message structs */ #define HDNodeType_init_default {0, 0, 0, {0, {0}}, false, {0, {0}}, false, {0, {0}}} #define HDNodePathType_init_default {HDNodeType_init_default, 0, {0, 0, 0, 0, 0, 0, 0, 0}} -#define CoinType_init_default {false, "", false, "", false, 0u, false, 0, false, 5u, false, 6u, false, 10u, false, "", false, 76067358u, false, 76066276u, false, 0} +#define CoinType_init_default {false, "", false, "", false, 0u, false, 0, false, 5u, false, "", false, 76067358u, false, 76066276u, false, 0} #define MultisigRedeemScriptType_init_default {0, {HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default, HDNodePathType_init_default}, 0, {{0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}}, false, 0} #define TxInputType_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}, {0, {0}}, 0, false, {0, {0}}, false, 4294967295u, false, InputScriptType_SPENDADDRESS, false, MultisigRedeemScriptType_init_default, false, 0} #define TxOutputType_init_default {false, "", 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, (OutputScriptType)0, false, MultisigRedeemScriptType_init_default, false, {0, {0}}} @@ -314,7 +308,7 @@ extern const uint32_t IdentityType_index_default; #define IdentityType_init_default {false, "", false, "", false, "", false, "", false, "", false, 0u} #define HDNodeType_init_zero {0, 0, 0, {0, {0}}, false, {0, {0}}, false, {0, {0}}} #define HDNodePathType_init_zero {HDNodeType_init_zero, 0, {0, 0, 0, 0, 0, 0, 0, 0}} -#define CoinType_init_zero {false, "", false, "", false, 0, false, 0, false, 0, false, 0, false, 0, false, "", false, 0, false, 0, false, 0} +#define CoinType_init_zero {false, "", false, "", false, 0, false, 0, false, 0, false, "", false, 0, false, 0, false, 0} #define MultisigRedeemScriptType_init_zero {0, {HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero, HDNodePathType_init_zero}, 0, {{0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}, {0, {0}}}, false, 0} #define TxInputType_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}, {0, {0}}, 0, false, {0, {0}}, false, 0, false, (InputScriptType)0, false, MultisigRedeemScriptType_init_zero, false, 0} #define TxOutputType_init_zero {false, "", 0, {0, 0, 0, 0, 0, 0, 0, 0}, 0, (OutputScriptType)0, false, MultisigRedeemScriptType_init_zero, false, {0, {0}}} @@ -330,8 +324,6 @@ extern const uint32_t IdentityType_index_default; #define CoinType_address_type_tag 3 #define CoinType_maxfee_kb_tag 4 #define CoinType_address_type_p2sh_tag 5 -#define CoinType_address_type_p2wpkh_tag 6 -#define CoinType_address_type_p2wsh_tag 7 #define CoinType_signed_message_header_tag 8 #define CoinType_xpub_magic_tag 9 #define CoinType_xprv_magic_tag 10 @@ -393,7 +385,7 @@ extern const uint32_t IdentityType_index_default; /* Struct field encoding specification for nanopb */ extern const pb_field_t HDNodeType_fields[7]; extern const pb_field_t HDNodePathType_fields[3]; -extern const pb_field_t CoinType_fields[12]; +extern const pb_field_t CoinType_fields[10]; extern const pb_field_t MultisigRedeemScriptType_fields[4]; extern const pb_field_t TxInputType_fields[9]; extern const pb_field_t TxOutputType_fields[7]; @@ -406,7 +398,7 @@ extern const pb_field_t IdentityType_fields[7]; /* Maximum encoded size of messages (where known) */ #define HDNodeType_size 121 #define HDNodePathType_size 171 -#define CoinType_size 113 +#define CoinType_size 101 #define MultisigRedeemScriptType_size 3741 #define TxInputType_size 5508 #define TxOutputType_size 3947 diff --git a/vendor/trezor-common b/vendor/trezor-common index fe6e62c11..564801fdd 160000 --- a/vendor/trezor-common +++ b/vendor/trezor-common @@ -1 +1 @@ -Subproject commit fe6e62c11f7dca8cb601e53c5865f15f770fd079 +Subproject commit 564801fddc908c30e0ef8410465a193ae35e2992