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

common: add coin.divisibility attribute

legacy: remove has_address_type/has_address_type_p2sh
This commit is contained in:
Pavol Rusnak 2019-12-05 04:30:51 +01:00
parent 6ca0288092
commit 5301c03607
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
81 changed files with 219 additions and 85 deletions

View File

@ -6,6 +6,7 @@
"github": "https://github.com/Actinium-project/Actinium",
"maintainer": "Harris Brakmic <brakmic@actinium.org>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 53,
"address_type_p2sh": 55,
"maxfee_kb": 40000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/axerunners/axe",
"maintainer": "Kirill Orlov <kirill@axerunners.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 55,
"address_type_p2sh": 16,
"maxfee_kb": 100000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/Bitcoin-ABC/bitcoin-abc",
"maintainer": "Jochen Hoenicke <hoenicke@gmail.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 0,
"address_type_p2sh": 5,
"maxfee_kb": 500000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/Bitcoin-ABC/bitcoin-abc",
"maintainer": "Jochen Hoenicke <hoenicke@gmail.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 111,
"address_type_p2sh": 196,
"maxfee_kb": 10000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/bellcoin-org/bellcoin",
"maintainer": "ilmango-doge <ilmango.doge@gmail.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 25,
"address_type_p2sh": 85,
"maxfee_kb": 1000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/BTCGPU/BTCGPU",
"maintainer": "Saleem Rashid <trezor@saleemrashid.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 38,
"address_type_p2sh": 23,
"maxfee_kb": 500000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/BTCGPU/BTCGPU",
"maintainer": "The Bitcoin Gold Developers <support@bitcoingold.org>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 111,
"address_type_p2sh": 196,
"maxfee_kb": 500000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/bitcoin/bitcoin",
"maintainer": "Pavol Rusnak <stick@satoshilabs.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 0,
"address_type_p2sh": 5,
"maxfee_kb": 2000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/bitcoin/bitcoin",
"maintainer": "Thomas Kerin <me@thomaskerin.io>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 111,
"address_type_p2sh": 196,
"maxfee_kb": 10000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/bitcoin/bitcoin",
"maintainer": "Pavol Rusnak <stick@satoshilabs.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 111,
"address_type_p2sh": 196,
"maxfee_kb": 10000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/LIMXTEC/BitCore",
"maintainer": "limxdev <limxdev@bitcore.cc>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 3,
"address_type_p2sh": 125,
"maxfee_kb": 2000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/bitgreen/bitgreen",
"maintainer": "Dennis R <xezzor@gmail.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 38,
"address_type_p2sh": 6,
"maxfee_kb": 100000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/BitzenyCoreDevelopers/bitzeny",
"maintainer": "y-chan <yuto_tetuota@yahoo.co.jp>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 81,
"address_type_p2sh": 5,
"maxfee_kb": 1000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/BlockStamp/bst",
"maintainer": "Krzysztof Kuchta <k.kuchta@blockstamp.info>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 26,
"address_type_p2sh": 5,
"maxfee_kb": 2000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/BTCPrivate/BitcoinPrivate",
"maintainer": "Chris Sulmone <csulmone@gmail.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 4901,
"address_type_p2sh": 5039,
"maxfee_kb": 1000000,

View File

@ -6,6 +6,7 @@
"github": "https://gitlab.com/bitcoinrh/BRhodiumNode",
"maintainer": "baff5b <dvbr3@protonmail.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 61,
"address_type_p2sh": 123,
"maxfee_kb": 2000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/Capricoinofficial/Capricoin",
"maintainer": "Jozef Knaperek <jknaperek@gmail.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 28,
"address_type_p2sh": 35,
"maxfee_kb": 2000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/cpuchain/cpuchain",
"maintainer": "Min Khang Aung <info@cpuchain.org>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 28,
"address_type_p2sh": 30,
"maxfee_kb": 1000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/Crowndev/crowncoin",
"maintainer": "Ashot <ashot@crownplatform.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 95495,
"address_type_p2sh": 95473,
"maxfee_kb": 2000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/dashpay/dash",
"maintainer": "Karel Bilek <karel.bilek@satoshilabs.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 76,
"address_type_p2sh": 16,
"maxfee_kb": 100000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/dashpay/dash",
"maintainer": "Karel Bilek <karel.bilek@satoshilabs.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 140,
"address_type_p2sh": 19,
"maxfee_kb": 100000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/decred/dcrd",
"maintainer": "Alex Yocom-Piatt <ay-p@decred.org>",
"curve_name": "secp256k1_decred",
"divisibility": 8,
"address_type": 1855,
"address_type_p2sh": 1818,
"maxfee_kb": 1000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/decred/dcrd",
"maintainer": "Saleem Rashid <trezor@saleemrashid.com>",
"curve_name": "secp256k1_decred",
"divisibility": 8,
"address_type": 3873,
"address_type_p2sh": 3836,
"maxfee_kb": 10000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/digibyte/digibyte",
"maintainer": "DigiByte <dev@digibyte.co>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 30,
"address_type_p2sh": 63,
"maxfee_kb": 500000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/dogecoin/dogecoin",
"maintainer": "Karel Bilek <karel.bilek@satoshilabs.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 30,
"address_type_p2sh": 22,
"maxfee_kb": 1000000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/ElementsProject/elements",
"maintainer": "Roman Zeyde <mail@romanzey.de>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 235,
"address_type_p2sh": 75,
"maxfee_kb": 10000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/mvs-org/metaverse",
"maintainer": "Sven Mutzl <sven@mutzl.org>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 50,
"address_type_p2sh": 5,
"maxfee_kb": 2000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/faircoin/faircoin",
"maintainer": "Santi Noreña <santi@criptomart.net>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 95,
"address_type_p2sh": 36,
"maxfee_kb": 10000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/FeatherCoin/Feathercoin",
"maintainer": "Lucas Betschart <lucas@feathercoin.foundation>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 14,
"address_type_p2sh": 5,
"maxfee_kb": 40000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/floblockchain/flo",
"maintainer": "Robert English <ksaredfx@gmail.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 35,
"address_type_p2sh": 94,
"maxfee_kb": 40000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/fujicoin/fujicoin",
"maintainer": "motty <admin@fujicoin.org>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 36,
"address_type_p2sh": 16,
"maxfee_kb": 1000000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/gamecredits-project/gamecredits",
"maintainer": "Samad Sajanlal <samad.sajanlal@gmail.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 38,
"address_type_p2sh": 62,
"maxfee_kb": 5000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/gincoin-dev/gincoin-core",
"maintainer": "Dragos Badea <dragos.badea@gincoin.io>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 38,
"address_type_p2sh": 10,
"maxfee_kb": 100000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/Groestlcoin/groestlcoin",
"maintainer": "Yura Pakhuchiy <pakhuchiy@gmail.com>",
"curve_name": "secp256k1_groestl",
"divisibility": 8,
"address_type": 36,
"address_type_p2sh": 5,
"maxfee_kb": 100000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/Groestlcoin/groestlcoin",
"maintainer": "Yura Pakhuchiy <pakhuchiy@gmail.com>",
"curve_name": "secp256k1_groestl",
"divisibility": 8,
"address_type": 111,
"address_type_p2sh": 196,
"maxfee_kb": 100000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/hatchpay/hatch",
"maintainer": "Hatch Support <support@hatch.ga>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 76,
"address_type_p2sh": 16,
"maxfee_kb": 100000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/hatchpay/hatch",
"maintainer": "Hatch Support <support@hatch.ga>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 140,
"address_type_p2sh": 19,
"maxfee_kb": 100000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/ZencashOfficial/zen",
"maintainer": "Power_VANO <vano@horizen.global>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 8329,
"address_type_p2sh": 8342,
"maxfee_kb": 2000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/komodoplatform/komodo",
"maintainer": "Kadan Stadelmann <ca333@komodoplatform.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 60,
"address_type_p2sh": 85,
"maxfee_kb": 1000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/KotoDevelopers/koto",
"maintainer": "WO <wo@ko-to.org>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 6198,
"address_type_p2sh": 6203,
"maxfee_kb": 1000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/litecoin-project/litecoin",
"maintainer": "Pavol Rusnak <stick@satoshilabs.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 48,
"address_type_p2sh": 50,
"maxfee_kb": 40000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/litecoin-project/litecoin",
"maintainer": "Pavol Rusnak <stick@satoshilabs.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 111,
"address_type_p2sh": 58,
"maxfee_kb": 40000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/monacoinproject/monacoin",
"maintainer": "cryptcoin-junkey <cryptcoin.junkey@gmail.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 50,
"address_type_p2sh": 55,
"maxfee_kb": 5000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/muecoin/MUE",
"maintainer": "Sotiris Blad <swthrhs@protonmail.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 16,
"address_type_p2sh": 76,
"maxfee_kb": 100000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/namecoin/namecoin-core",
"maintainer": "Pavol Rusnak <stick@satoshilabs.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 52,
"address_type_p2sh": 5,
"maxfee_kb": 10000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/nixplatform/nixcore",
"maintainer": "mattt21 <matt@nixplatform.io>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 38,
"address_type_p2sh": 53,
"maxfee_kb": 40000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/particl/particl-core",
"maintainer": "Ryno <ryno@particl.io>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 56,
"address_type_p2sh": 60,
"maxfee_kb": 2000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/particl/particl-core",
"maintainer": "Ryno <ryno@particl.io>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 118,
"address_type_p2sh": 122,
"maxfee_kb": 10000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/FundacionPesetacoin/PesetacoinCore",
"maintainer": "Rw <info@pesetacoin.info>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 47,
"address_type_p2sh": 22,
"maxfee_kb": 1000000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/PIVX-Project/PIVX",
"maintainer": "Random Zebra <random.zebra@protonmail.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 30,
"address_type_p2sh": 13,
"maxfee_kb": 100000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/PIVX-Project/PIVX",
"maintainer": "Random Zebra <random.zebra@protonmail.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 139,
"address_type_p2sh": 19,
"maxfee_kb": 100000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/polispay/polis",
"maintainer": "Cronos <eabz@polispay.org>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 55,
"address_type_p2sh": 56,
"maxfee_kb": 100000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/primecoin/primecoin",
"maintainer": "James Skrowvedeht <james@thedevworks.io>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 23,
"address_type_p2sh": 83,
"maxfee_kb": 1000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/qtumproject/qtum",
"maintainer": "CodeFace <codeface@qtum.info>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 58,
"address_type_p2sh": 50,
"maxfee_kb": 40000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/qtumproject/qtum",
"maintainer": "CodeFace <codeface@qtum.info>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 120,
"address_type_p2sh": 110,
"maxfee_kb": 40000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/RavenProject/Ravencoin",
"maintainer": "Scotty <scotty.rvn@gmail.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 60,
"address_type_p2sh": 122,
"maxfee_kb": 2000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/RitoProject",
"maintainer": "Scotty <scotty.rvn@gmail.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 25,
"address_type_p2sh": 105,
"maxfee_kb": 2000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/SmartCash/Core-Smart",
"maintainer": "Leandro Reinaux <leoreinaux@gmail.com>",
"curve_name": "secp256k1_smart",
"divisibility": 8,
"address_type": 63,
"address_type_p2sh": 18,
"maxfee_kb": 1000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/SmartCash/Core-Smart",
"maintainer": "Leandro Reinaux <leoreinaux@gmail.com>",
"curve_name": "secp256k1_smart",
"divisibility": 8,
"address_type": 65,
"address_type_p2sh": 21,
"maxfee_kb": 1000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/X9Developers/XSN",
"maintainer": "Alexis Hernandez <alexis@alexitc.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 76,
"address_type_p2sh": 16,
"maxfee_kb": 2000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/syscoin/syscoin",
"maintainer": "Jagdeep Sidhu <jsidhu@blockchainfoundry.co>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 63,
"address_type_p2sh": 5,
"maxfee_kb": 10000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/terracoin/terracoin",
"maintainer": "The Terracoin Foundation <support@terracoin.io>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 0,
"address_type_p2sh": 5,
"maxfee_kb": 100000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/unobtanium-official/unobtanium",
"maintainer": "choicesz <choicesz@unobtanium.uno>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 130,
"address_type_p2sh": 30,
"maxfee_kb": 2000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/vertcoin-project/vertcoin-core",
"maintainer": "Jochen Hoenicke <hoenicke@gmail.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 71,
"address_type_p2sh": 5,
"maxfee_kb": 40000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/viacoin",
"maintainer": "romanornr <romanornr@gmail.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 71,
"address_type_p2sh": 33,
"maxfee_kb": 40000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/VIPSTARCOIN/VIPSTARCOIN",
"maintainer": "y-chan <yuto_tetuota@yahoo.co.jp>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 70,
"address_type_p2sh": 50,
"maxfee_kb": 40000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/zcash/zcash",
"maintainer": "Pavol Rusnak <stick@satoshilabs.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 7352,
"address_type_p2sh": 7357,
"maxfee_kb": 1000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/zcash/zcash",
"maintainer": "Pavol Rusnak <stick@satoshilabs.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 7461,
"address_type_p2sh": 7354,
"maxfee_kb": 10000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/zcoinofficial/zcoin",
"maintainer": "Yura Pakhuchiy <pakhuchiy@gmail.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 82,
"address_type_p2sh": 7,
"maxfee_kb": 1000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/zcoinofficial/zcoin",
"maintainer": "Yura Pakhuchiy <pakhuchiy@gmail.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 65,
"address_type_p2sh": 178,
"maxfee_kb": 1000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/zcore-coin/zcore-2.0",
"maintainer": "Erick Costa <erick@zcore.cash>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 142,
"address_type_p2sh": 145,
"maxfee_kb": 1000000,

View File

@ -6,6 +6,7 @@
"github": "https://github.com/zelcash",
"maintainer": "Cabecinha84 <valter.cabecinha@gmail.com>",
"curve_name": "secp256k1",
"divisibility": 8,
"address_type": 7352,
"address_type_p2sh": 7357,
"maxfee_kb": 1000000,

View File

@ -12,6 +12,7 @@ class CoinInfo:
self,
coin_name: str,
coin_shortcut: str,
divisibility: int,
address_type: int,
address_type_p2sh: int,
maxfee_kb: int,
@ -33,6 +34,7 @@ class CoinInfo:
):
self.coin_name = coin_name
self.coin_shortcut = coin_shortcut
self.divisibility = divisibility
self.address_type = address_type
self.address_type_p2sh = address_type_p2sh
self.maxfee_kb = maxfee_kb
@ -82,6 +84,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="BTC",
divisibility=8,
address_type=0,
address_type_p2sh=5,
maxfee_kb=2000000,
@ -105,6 +108,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="REGTEST",
divisibility=8,
address_type=111,
address_type_p2sh=196,
maxfee_kb=10000000,
@ -128,6 +132,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="TEST",
divisibility=8,
address_type=111,
address_type_p2sh=196,
maxfee_kb=10000000,
@ -154,6 +159,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="ACM",
divisibility=8,
address_type=53,
address_type_p2sh=55,
maxfee_kb=40000000,
@ -177,6 +183,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="AXE",
divisibility=8,
address_type=55,
address_type_p2sh=16,
maxfee_kb=100000,
@ -200,6 +207,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="BELL",
divisibility=8,
address_type=25,
address_type_p2sh=85,
maxfee_kb=1000000,
@ -223,6 +231,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="BITG",
divisibility=8,
address_type=38,
address_type_p2sh=6,
maxfee_kb=100000,
@ -246,6 +255,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="ZNY",
divisibility=8,
address_type=81,
address_type_p2sh=5,
maxfee_kb=1000000,
@ -269,6 +279,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="BCH",
divisibility=8,
address_type=0,
address_type_p2sh=5,
maxfee_kb=500000,
@ -292,6 +303,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="TBCH",
divisibility=8,
address_type=111,
address_type_p2sh=196,
maxfee_kb=10000000,
@ -315,6 +327,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="BTG",
divisibility=8,
address_type=38,
address_type_p2sh=23,
maxfee_kb=500000,
@ -338,6 +351,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="TBTG",
divisibility=8,
address_type=111,
address_type_p2sh=196,
maxfee_kb=500000,
@ -361,6 +375,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="BTCP",
divisibility=8,
address_type=4901,
address_type_p2sh=5039,
maxfee_kb=1000000,
@ -384,6 +399,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="XRC",
divisibility=8,
address_type=61,
address_type_p2sh=123,
maxfee_kb=2000000,
@ -407,6 +423,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="BTX",
divisibility=8,
address_type=3,
address_type_p2sh=125,
maxfee_kb=2000000,
@ -430,6 +447,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="BST",
divisibility=8,
address_type=26,
address_type_p2sh=5,
maxfee_kb=2000000,
@ -453,6 +471,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="CPU",
divisibility=8,
address_type=28,
address_type_p2sh=30,
maxfee_kb=1000000,
@ -476,6 +495,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="CPC",
divisibility=8,
address_type=28,
address_type_p2sh=35,
maxfee_kb=2000000,
@ -499,6 +519,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="CRW",
divisibility=8,
address_type=95495,
address_type_p2sh=95473,
maxfee_kb=2000000,
@ -522,6 +543,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="DASH",
divisibility=8,
address_type=76,
address_type_p2sh=16,
maxfee_kb=100000,
@ -545,6 +567,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="tDASH",
divisibility=8,
address_type=140,
address_type_p2sh=19,
maxfee_kb=100000,
@ -568,6 +591,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="DCR",
divisibility=8,
address_type=1855,
address_type_p2sh=1818,
maxfee_kb=1000000,
@ -591,6 +615,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="TDCR",
divisibility=8,
address_type=3873,
address_type_p2sh=3836,
maxfee_kb=10000000,
@ -614,6 +639,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="DGB",
divisibility=8,
address_type=30,
address_type_p2sh=63,
maxfee_kb=500000,
@ -637,6 +663,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="DOGE",
divisibility=8,
address_type=30,
address_type_p2sh=22,
maxfee_kb=1000000000,
@ -660,6 +687,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="ELEMENTS",
divisibility=8,
address_type=235,
address_type_p2sh=75,
maxfee_kb=10000000,
@ -683,6 +711,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="FAIR",
divisibility=8,
address_type=95,
address_type_p2sh=36,
maxfee_kb=10000000,
@ -706,6 +735,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="FTC",
divisibility=8,
address_type=14,
address_type_p2sh=5,
maxfee_kb=40000000,
@ -729,6 +759,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="FLO",
divisibility=8,
address_type=35,
address_type_p2sh=94,
maxfee_kb=40000000,
@ -752,6 +783,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="FJC",
divisibility=8,
address_type=36,
address_type_p2sh=16,
maxfee_kb=1000000000,
@ -775,6 +807,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="GIN",
divisibility=8,
address_type=38,
address_type_p2sh=10,
maxfee_kb=100000,
@ -798,6 +831,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="GAME",
divisibility=8,
address_type=38,
address_type_p2sh=62,
maxfee_kb=5000000,
@ -821,6 +855,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="GRS",
divisibility=8,
address_type=36,
address_type_p2sh=5,
maxfee_kb=100000,
@ -844,6 +879,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="tGRS",
divisibility=8,
address_type=111,
address_type_p2sh=196,
maxfee_kb=100000,
@ -867,6 +903,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="HATCH",
divisibility=8,
address_type=76,
address_type_p2sh=16,
maxfee_kb=100000,
@ -890,6 +927,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="tHATCH",
divisibility=8,
address_type=140,
address_type_p2sh=19,
maxfee_kb=100000,
@ -913,6 +951,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="ZEN",
divisibility=8,
address_type=8329,
address_type_p2sh=8342,
maxfee_kb=2000000,
@ -936,6 +975,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="KMD",
divisibility=8,
address_type=60,
address_type_p2sh=85,
maxfee_kb=1000000,
@ -959,6 +999,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="KOTO",
divisibility=8,
address_type=6198,
address_type_p2sh=6203,
maxfee_kb=1000000,
@ -982,6 +1023,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="LTC",
divisibility=8,
address_type=48,
address_type_p2sh=50,
maxfee_kb=40000000,
@ -1005,6 +1047,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="tLTC",
divisibility=8,
address_type=111,
address_type_p2sh=58,
maxfee_kb=40000000,
@ -1028,6 +1071,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="ETP",
divisibility=8,
address_type=50,
address_type_p2sh=5,
maxfee_kb=2000000,
@ -1051,6 +1095,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="MONA",
divisibility=8,
address_type=50,
address_type_p2sh=55,
maxfee_kb=5000000,
@ -1074,6 +1119,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="MUE",
divisibility=8,
address_type=16,
address_type_p2sh=76,
maxfee_kb=100000,
@ -1097,6 +1143,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="NIX",
divisibility=8,
address_type=38,
address_type_p2sh=53,
maxfee_kb=40000000,
@ -1120,6 +1167,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="NMC",
divisibility=8,
address_type=52,
address_type_p2sh=5,
maxfee_kb=10000000,
@ -1143,6 +1191,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="PIVX",
divisibility=8,
address_type=30,
address_type_p2sh=13,
maxfee_kb=100000,
@ -1166,6 +1215,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="tPIVX",
divisibility=8,
address_type=139,
address_type_p2sh=19,
maxfee_kb=100000,
@ -1189,6 +1239,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="PART",
divisibility=8,
address_type=56,
address_type_p2sh=60,
maxfee_kb=2000000,
@ -1212,6 +1263,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="tPART",
divisibility=8,
address_type=118,
address_type_p2sh=122,
maxfee_kb=10000000,
@ -1235,6 +1287,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="PTC",
divisibility=8,
address_type=47,
address_type_p2sh=22,
maxfee_kb=1000000000,
@ -1258,6 +1311,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="POLIS",
divisibility=8,
address_type=55,
address_type_p2sh=56,
maxfee_kb=100000,
@ -1281,6 +1335,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="XPM",
divisibility=8,
address_type=23,
address_type_p2sh=83,
maxfee_kb=1000000,
@ -1304,6 +1359,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="QTUM",
divisibility=8,
address_type=58,
address_type_p2sh=50,
maxfee_kb=40000000,
@ -1327,6 +1383,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="tQTUM",
divisibility=8,
address_type=120,
address_type_p2sh=110,
maxfee_kb=40000000,
@ -1350,6 +1407,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="RVN",
divisibility=8,
address_type=60,
address_type_p2sh=122,
maxfee_kb=2000000,
@ -1373,6 +1431,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="RITO",
divisibility=8,
address_type=25,
address_type_p2sh=105,
maxfee_kb=2000000,
@ -1396,6 +1455,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="SMART",
divisibility=8,
address_type=63,
address_type_p2sh=18,
maxfee_kb=1000000,
@ -1419,6 +1479,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="tSMART",
divisibility=8,
address_type=65,
address_type_p2sh=21,
maxfee_kb=1000000,
@ -1442,6 +1503,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="XSN",
divisibility=8,
address_type=76,
address_type_p2sh=16,
maxfee_kb=2000000,
@ -1465,6 +1527,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="SYS",
divisibility=8,
address_type=63,
address_type_p2sh=5,
maxfee_kb=10000000,
@ -1488,6 +1551,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="UNO",
divisibility=8,
address_type=130,
address_type_p2sh=30,
maxfee_kb=2000000,
@ -1511,6 +1575,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="VIPS",
divisibility=8,
address_type=70,
address_type_p2sh=50,
maxfee_kb=40000000,
@ -1534,6 +1599,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="VTC",
divisibility=8,
address_type=71,
address_type_p2sh=5,
maxfee_kb=40000000,
@ -1557,6 +1623,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="VIA",
divisibility=8,
address_type=71,
address_type_p2sh=33,
maxfee_kb=40000000,
@ -1580,6 +1647,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="ZCR",
divisibility=8,
address_type=142,
address_type_p2sh=145,
maxfee_kb=1000000,
@ -1603,6 +1671,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="ZEC",
divisibility=8,
address_type=7352,
address_type_p2sh=7357,
maxfee_kb=1000000,
@ -1626,6 +1695,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="TAZ",
divisibility=8,
address_type=7461,
address_type_p2sh=7354,
maxfee_kb=10000000,
@ -1649,6 +1719,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="XZC",
divisibility=8,
address_type=82,
address_type_p2sh=7,
maxfee_kb=1000000,
@ -1672,6 +1743,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="tXZC",
divisibility=8,
address_type=65,
address_type_p2sh=178,
maxfee_kb=1000000,
@ -1695,6 +1767,7 @@ def by_name(name: str) -> CoinInfo:
return CoinInfo(
coin_name=name,
coin_shortcut="ZEL",
divisibility=8,
address_type=7352,
address_type_p2sh=7357,
maxfee_kb=1000000,

View File

@ -12,6 +12,7 @@ class CoinInfo:
self,
coin_name: str,
coin_shortcut: str,
divisibility: int,
address_type: int,
address_type_p2sh: int,
maxfee_kb: int,
@ -33,6 +34,7 @@ class CoinInfo:
):
self.coin_name = coin_name
self.coin_shortcut = coin_shortcut
self.divisibility = divisibility
self.address_type = address_type
self.address_type_p2sh = address_type_p2sh
self.maxfee_kb = maxfee_kb
@ -90,6 +92,7 @@ def optional_dict(x):
ATTRIBUTES = (
("coin_name", lambda _: "name"),
("coin_shortcut", black_repr),
("divisibility", int),
("address_type", int),
("address_type_p2sh", int),
("maxfee_kb", int),

View File

@ -9,7 +9,7 @@ _LOCKTIME_TIMESTAMP_MIN_VALUE = const(500000000)
def format_coin_amount(amount, coin):
return "%s %s" % (format_amount(amount, 8), coin.coin_shortcut)
return "%s %s" % (format_amount(amount, coin.divisibility), coin.coin_shortcut)
def split_address(address):

View File

@ -29,12 +29,11 @@ const CoinInfo coins[COINS_COUNT] = {
.coin_shortcut = ${c_str(" " + c.coin_shortcut)},
.maxfee_kb = ${c_int(c.maxfee_kb)},
.signed_message_header = ${signed_message_header(c.signed_message_header)},
.has_address_type = ${defined(c.address_type)},
.has_address_type_p2sh = ${defined(c.address_type_p2sh)},
.has_segwit = ${c_bool(c.segwit)},
.has_fork_id = ${defined(c.fork_id)},
.force_bip143 = ${c_bool(c.force_bip143)},
.decred = ${c_bool(c.decred)},
.divisibility = ${c.divisibility},
.address_type = ${c.address_type},
.address_type_p2sh = ${c.address_type_p2sh},
.xpub_magic = ${hex(c.xpub_magic)},

View File

@ -65,13 +65,11 @@ bool coinExtractAddressType(const CoinInfo *coin, const char *addr,
bool coinExtractAddressTypeRaw(const CoinInfo *coin, const uint8_t *addr_raw,
uint32_t *address_type) {
if (coin->has_address_type &&
address_check_prefix(addr_raw, coin->address_type)) {
if (address_check_prefix(addr_raw, coin->address_type)) {
*address_type = coin->address_type;
return true;
}
if (coin->has_address_type_p2sh &&
address_check_prefix(addr_raw, coin->address_type_p2sh)) {
if (address_check_prefix(addr_raw, coin->address_type_p2sh)) {
*address_type = coin->address_type_p2sh;
return true;
}

View File

@ -31,8 +31,7 @@ typedef struct _CoinInfo {
const char *coin_shortcut;
uint64_t maxfee_kb;
const char *signed_message_header;
bool has_address_type;
bool has_address_type_p2sh;
uint32_t divisibility;
bool has_segwit;
bool has_fork_id;
bool force_bip143;

View File

@ -165,7 +165,6 @@ static bool path_mismatched(const CoinInfo *coin, const GetAddress *msg) {
if (msg->address_n[0] == (0x80000000 + 49)) {
mismatch |= (msg->script_type != InputScriptType_SPENDP2SHWITNESS);
mismatch |= !coin->has_segwit;
mismatch |= !coin->has_address_type_p2sh;
mismatch |= (msg->address_n_count != 5);
mismatch |= (msg->address_n[1] != coin->coin_type);
mismatch |= (msg->address_n[2] & 0x80000000) == 0;

View File

@ -35,8 +35,6 @@
#include "timer.h"
#include "util.h"
#define BITCOIN_DIVISIBILITY (8)
#if !BITCOIN_ONLY
static const char *slip44_extras(uint32_t coin_type) {
@ -93,12 +91,12 @@ static const char *address_n_str(const uint32_t *address_n,
abbr = coin->coin_shortcut + 1;
}
} else if (p2sh_segwit) {
if (coin && coin->has_segwit && coin->has_address_type_p2sh) {
if (coin && coin->has_segwit) {
abbr = coin->coin_shortcut + 1;
}
} else {
if (coin) {
if (coin->has_segwit && coin->has_address_type_p2sh) {
if (coin->has_segwit) {
legacy = true;
}
abbr = coin->coin_shortcut + 1;
@ -346,7 +344,7 @@ static void render_address_dialog(const CoinInfo *coin, const char *address,
void layoutConfirmOutput(const CoinInfo *coin, const TxOutputType *out) {
char str_out[32 + 3] = {0};
bn_format_uint64(out->amount, NULL, coin->coin_shortcut, BITCOIN_DIVISIBILITY,
bn_format_uint64(out->amount, NULL, coin->coin_shortcut, coin->divisibility,
0, false, str_out, sizeof(str_out) - 3);
strlcat(str_out, " to", sizeof(str_out));
const char *address = out->address;
@ -389,8 +387,8 @@ void layoutConfirmOmni(const uint8_t *data, uint32_t size) {
uint64_t amount_be = 0, amount = 0;
memcpy(&amount_be, data + 12, sizeof(uint64_t));
REVERSE64(amount_be, amount);
bn_format_uint64(amount, NULL, suffix, divisible ? BITCOIN_DIVISIBILITY : 0,
0, false, str_out, sizeof(str_out));
bn_format_uint64(amount, NULL, suffix, divisible ? 8 : 0, 0, false, str_out,
sizeof(str_out));
} else {
desc = _("Unknown transaction");
str_out[0] = 0;
@ -424,10 +422,10 @@ void layoutConfirmOpReturn(const uint8_t *data, uint32_t size) {
void layoutConfirmTx(const CoinInfo *coin, uint64_t amount_out,
uint64_t amount_fee) {
char str_out[32] = {0}, str_fee[32] = {0};
bn_format_uint64(amount_out, NULL, coin->coin_shortcut, BITCOIN_DIVISIBILITY,
0, false, str_out, sizeof(str_out));
bn_format_uint64(amount_fee, NULL, coin->coin_shortcut, BITCOIN_DIVISIBILITY,
0, false, str_fee, sizeof(str_fee));
bn_format_uint64(amount_out, NULL, coin->coin_shortcut, coin->divisibility, 0,
false, str_out, sizeof(str_out));
bn_format_uint64(amount_fee, NULL, coin->coin_shortcut, coin->divisibility, 0,
false, str_fee, sizeof(str_fee));
layoutDialogSwipe(&bmp_icon_question, _("Cancel"), _("Confirm"), NULL,
_("Really send"), str_out, _("from your wallet?"),
_("Fee included:"), str_fee, NULL);
@ -435,8 +433,8 @@ void layoutConfirmTx(const CoinInfo *coin, uint64_t amount_out,
void layoutFeeOverThreshold(const CoinInfo *coin, uint64_t fee) {
char str_fee[32] = {0};
bn_format_uint64(fee, NULL, coin->coin_shortcut, BITCOIN_DIVISIBILITY, 0,
false, str_fee, sizeof(str_fee));
bn_format_uint64(fee, NULL, coin->coin_shortcut, coin->divisibility, 0, false,
str_fee, sizeof(str_fee));
layoutDialogSwipe(&bmp_icon_question, _("Cancel"), _("Confirm"), NULL,
_("Fee"), str_fee, _("is unexpectedly high."), NULL,
_("Send anyway?"), NULL);

View File

@ -130,9 +130,6 @@ bool compute_address(const CoinInfo *coin, InputScriptType script_type,
if (!coin->has_segwit) {
return 0;
}
if (!coin->has_address_type_p2sh) {
return 0;
}
raw[0] = 0; // push version
raw[1] = 32; // push 32 bytes
memcpy(raw + 2, digest, 32); // push hash
@ -175,9 +172,6 @@ bool compute_address(const CoinInfo *coin, InputScriptType script_type,
if (!coin->has_segwit) {
return 0;
}
if (!coin->has_address_type_p2sh) {
return 0;
}
ecdsa_get_address_segwit_p2sh(
node->public_key, coin->address_type_p2sh, coin->curve->hasher_pubkey,
coin->curve->hasher_base58, address, MAX_ADDR_SIZE);
@ -270,8 +264,8 @@ int compile_output(const CoinInfo *coin, const HDNode *root, TxOutputType *in,
addr_raw_len = base58_decode_check(in->address, coin->curve->hasher_base58,
addr_raw, MAX_ADDR_RAW_SIZE);
size_t prefix_len = 0;
if (coin->has_address_type // p2pkh
&& addr_raw_len ==
// p2pkh
if (addr_raw_len ==
20 + (prefix_len = address_prefix_bytes_len(coin->address_type)) &&
address_check_prefix(addr_raw, coin->address_type)) {
out->script_pubkey.bytes[0] = 0x76; // OP_DUP
@ -281,8 +275,9 @@ int compile_output(const CoinInfo *coin, const HDNode *root, TxOutputType *in,
out->script_pubkey.bytes[23] = 0x88; // OP_EQUALVERIFY
out->script_pubkey.bytes[24] = 0xAC; // OP_CHECKSIG
out->script_pubkey.size = 25;
} else if (coin->has_address_type_p2sh // p2sh
&& addr_raw_len == 20 + (prefix_len = address_prefix_bytes_len(
} else
// p2sh
if (addr_raw_len == 20 + (prefix_len = address_prefix_bytes_len(
coin->address_type_p2sh)) &&
address_check_prefix(addr_raw, coin->address_type_p2sh)) {
out->script_pubkey.bytes[0] = 0xA9; // OP_HASH_160
@ -880,11 +875,9 @@ uint32_t tx_output_weight(const CoinInfo *coin, const TxOutputType *txoutput) {
addr_raw_len =
base58_decode_check(txoutput->address, coin->curve->hasher_base58,
addr_raw, MAX_ADDR_RAW_SIZE);
if (coin->has_address_type &&
address_check_prefix(addr_raw, coin->address_type)) {
if (address_check_prefix(addr_raw, coin->address_type)) {
output_script_size = TXSIZE_P2PKHASH;
} else if (coin->has_address_type_p2sh &&
address_check_prefix(addr_raw, coin->address_type_p2sh)) {
} else if (address_check_prefix(addr_raw, coin->address_type_p2sh)) {
output_script_size = TXSIZE_P2SCRIPT;
}
}