1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 07:28:10 +00:00

src/apps/common: add decred attribute to coininfo, enable Decred

This commit is contained in:
Pavol Rusnak 2018-09-21 12:52:32 +02:00
parent d644147985
commit 86db527722
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
3 changed files with 82 additions and 1 deletions

View File

@ -23,6 +23,7 @@ class CoinInfo:
force_bip143: bool, force_bip143: bool,
version_group_id: int, version_group_id: int,
bip115: bool, bip115: bool,
decred: bool,
curve_name: str, curve_name: str,
): ):
self.coin_name = coin_name self.coin_name = coin_name
@ -42,6 +43,7 @@ class CoinInfo:
self.force_bip143 = force_bip143 self.force_bip143 = force_bip143
self.version_group_id = version_group_id self.version_group_id = version_group_id
self.bip115 = bip115 self.bip115 = bip115
self.decred = decred
self.curve_name = curve_name self.curve_name = curve_name
if curve_name == "secp256k1-groestl": if curve_name == "secp256k1-groestl":
self.b58_hash = groestl512d_32 self.b58_hash = groestl512d_32
@ -71,6 +73,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -91,6 +94,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -111,6 +115,7 @@ COINS = [
force_bip143=True, force_bip143=True,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -131,6 +136,7 @@ COINS = [
force_bip143=True, force_bip143=True,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -151,6 +157,7 @@ COINS = [
force_bip143=True, force_bip143=True,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -171,6 +178,7 @@ COINS = [
force_bip143=True, force_bip143=True,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -191,6 +199,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -211,6 +220,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -231,8 +241,51 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo(
coin_name="Decred",
coin_shortcut="DCR",
address_type=1855,
address_type_p2sh=1818,
maxfee_kb=1000000,
signed_message_header="Decred Signed Message:\n",
xpub_magic=0x02fda926,
xpub_magic_segwit_p2sh=None,
xpub_magic_segwit_native=None,
bech32_prefix=None,
cashaddr_prefix=None,
slip44=42,
segwit=False,
fork_id=None,
force_bip143=False,
version_group_id=None,
bip115=False,
decred=True,
curve_name='secp256k1-decred',
),
CoinInfo(
coin_name="Decred Testnet",
coin_shortcut="TDCR",
address_type=3873,
address_type_p2sh=3836,
maxfee_kb=10000000,
signed_message_header="Decred Signed Message:\n",
xpub_magic=0x043587d1,
xpub_magic_segwit_p2sh=None,
xpub_magic_segwit_native=None,
bech32_prefix=None,
cashaddr_prefix=None,
slip44=1,
segwit=False,
fork_id=None,
force_bip143=False,
version_group_id=None,
bip115=False,
decred=True,
curve_name='secp256k1-decred',
),
CoinInfo( CoinInfo(
coin_name="Denarius", coin_name="Denarius",
coin_shortcut="DNR", coin_shortcut="DNR",
@ -251,6 +304,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -271,6 +325,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -291,6 +346,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -311,6 +367,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -331,6 +388,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -351,6 +409,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -371,6 +430,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1-groestl', curve_name='secp256k1-groestl',
), ),
CoinInfo( CoinInfo(
@ -391,6 +451,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1-groestl', curve_name='secp256k1-groestl',
), ),
CoinInfo( CoinInfo(
@ -411,6 +472,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=0x02e7d970, version_group_id=0x02e7d970,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -431,6 +493,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -451,6 +514,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -471,6 +535,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -491,6 +556,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -511,6 +577,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -531,6 +598,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -551,6 +619,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -571,6 +640,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1-smart', curve_name='secp256k1-smart',
), ),
CoinInfo( CoinInfo(
@ -591,6 +661,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1-smart', curve_name='secp256k1-smart',
), ),
CoinInfo( CoinInfo(
@ -611,6 +682,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -631,6 +703,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -651,6 +724,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=0x03c48270, version_group_id=0x03c48270,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -671,6 +745,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=0x03c48270, version_group_id=0x03c48270,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -691,6 +766,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -711,6 +787,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=False, bip115=False,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
CoinInfo( CoinInfo(
@ -731,6 +808,7 @@ COINS = [
force_bip143=False, force_bip143=False,
version_group_id=None, version_group_id=None,
bip115=True, bip115=True,
decred=False,
curve_name='secp256k1', curve_name='secp256k1',
), ),
] ]

View File

@ -23,6 +23,7 @@ class CoinInfo:
force_bip143: bool, force_bip143: bool,
version_group_id: int, version_group_id: int,
bip115: bool, bip115: bool,
decred: bool,
curve_name: str, curve_name: str,
): ):
self.coin_name = coin_name self.coin_name = coin_name
@ -42,6 +43,7 @@ class CoinInfo:
self.force_bip143 = force_bip143 self.force_bip143 = force_bip143
self.version_group_id = version_group_id self.version_group_id = version_group_id
self.bip115 = bip115 self.bip115 = bip115
self.decred = decred
self.curve_name = curve_name self.curve_name = curve_name
if curve_name == "secp256k1-groestl": if curve_name == "secp256k1-groestl":
self.b58_hash = groestl512d_32 self.b58_hash = groestl512d_32
@ -77,6 +79,7 @@ ATTRIBUTES = (
("force_bip143", bool), ("force_bip143", bool),
("version_group_id", hexfmt), ("version_group_id", hexfmt),
("bip115", bool), ("bip115", bool),
("decred", bool),
("curve_name", lambda r: repr(r.replace("_", "-"))), ("curve_name", lambda r: repr(r.replace("_", "-"))),
) )
%>\ %>\

@ -1 +1 @@
Subproject commit 034289ddd2e517afc1a400341b01801afcf3f455 Subproject commit 6c47e483d4e7dc6c5149cf53d11e543a6f2a07bd