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

core+legacy: fix KMD signing (introduce negative_fee coin field)

This commit is contained in:
Pavol Rusnak 2019-08-09 16:01:28 +02:00
parent 024f4d64af
commit e23bb10ec4
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
84 changed files with 313 additions and 55 deletions

View File

@ -34,6 +34,7 @@
"max_address_length": 34,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -34,6 +34,7 @@
"max_address_length": 34,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -43,6 +43,7 @@
"https://bch4.trezor.io",
"https://bch5.trezor.io"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -34,6 +34,7 @@
"max_address_length": 34,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -37,6 +37,7 @@
"https://bellcoin-blockbook.ilmango.work",
"https://bell.blockbook.ovh"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -43,6 +43,7 @@
"https://btg4.trezor.io",
"https://btg5.trezor.io"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -37,6 +37,7 @@
"max_address_length": 34,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -37,6 +37,7 @@
"max_address_length": 53,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -34,6 +34,7 @@
"max_address_length": 34,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -43,6 +43,7 @@
"https://btc4.trezor.io",
"https://btc5.trezor.io"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -34,6 +34,7 @@
"max_address_length": 34,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -37,6 +37,7 @@
"https://tbtc1.trezor.io",
"https://tbtc2.trezor.io"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -36,6 +36,7 @@
"https://insight.bitcore.cc"
],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -34,6 +34,7 @@
"max_address_length": 34,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -34,6 +34,7 @@
"max_address_length": 34,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -39,6 +39,7 @@
"blockbook": [
"https://zny.blockbook.ovh"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -37,6 +37,7 @@
"max_address_length": 34,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 1000,
"consensus_branch_id": null
}

View File

@ -36,6 +36,7 @@
"https://explorer.btcprivate.org"
],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -40,6 +40,7 @@
"https://blockbook1.bitcoinrh.org",
"https://blockbook2.bitcoinrh.org"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -42,6 +42,7 @@
"https://blockbook3.capricoin.org",
"https://blockbook4.capricoin.org"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -34,6 +34,7 @@
"max_address_length": 34,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -38,6 +38,7 @@
"https://insight-03.crown.tech"
],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -40,6 +40,7 @@
"https://dash4.trezor.io",
"https://dash5.trezor.io"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -34,6 +34,7 @@
"max_address_length": 34,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -36,6 +36,7 @@
"https://mainnet.decred.org"
],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -36,6 +36,7 @@
"https://testnet.decred.org"
],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -34,6 +34,7 @@
"max_address_length": 34,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -40,6 +40,7 @@
"https://dgb1.trezor.io",
"https://dgb2.trezor.io"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -40,6 +40,7 @@
"https://doge4.trezor.io",
"https://doge5.trezor.io"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -34,6 +34,7 @@
"max_address_length": 34,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -34,6 +34,7 @@
"max_address_length": 34,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -36,6 +36,7 @@
"https://bitcore.feathercoin.com"
],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -36,6 +36,7 @@
"https://livenet.flocha.in"
],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -39,6 +39,7 @@
"blockbook": [
"https://explorer.fujicoin.org"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -36,6 +36,7 @@
"blockbook": [
"https://blockbook.gamecredits.network"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -36,6 +36,7 @@
"blockbook": [
"https://blockbook.gincoin.io"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -39,6 +39,7 @@
"blockbook": [
"https://blockbook.groestlcoin.org"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -38,6 +38,7 @@
"blockbook": [
"https://blockbook-test.groestlcoin.org"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -36,6 +36,7 @@
"https://explorer.horizen.global"
],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -36,6 +36,7 @@
"https://api.kmd.dev"
],
"blockbook": [],
"negative_fee": true,
"cooldown": 100,
"consensus_branch_id": {
"1": 0,

View File

@ -36,6 +36,7 @@
"https://insight.kotocoin.info"
],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -40,6 +40,7 @@
"https://ltc4.trezor.io",
"https://ltc5.trezor.io"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -36,6 +36,7 @@
"https://testnet.litecore.io"
],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -34,6 +34,7 @@
"max_address_length": 34,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -39,6 +39,7 @@
"blockbook": [
"https://blockbook.electrum-mona.org"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -36,6 +36,7 @@
"blockbook": [
"https://blockbook.monetaryunit.org"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -37,6 +37,7 @@
"max_address_length": 34,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -37,6 +37,7 @@
"https://nmc1.trezor.io",
"https://nmc2.trezor.io"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -34,6 +34,7 @@
"max_address_length": 34,
"bitcore": ["https://blockchain.nixplatform.io"],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -37,6 +37,7 @@
"max_address_length": 34,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -34,6 +34,7 @@
"max_address_length": 34,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -36,6 +36,7 @@
"https://live.pesetacoin.info"
],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -36,6 +36,7 @@
"blockbook": [
"https://blockbook.pivx.link"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -36,6 +36,7 @@
"blockbook": [
"https://blockbook-testnet.pivx.link"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -36,6 +36,7 @@
"blockbook": [
"https://blockbook.polispay.org"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -34,6 +34,7 @@
"max_address_length": 35,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -37,6 +37,7 @@
"max_address_length": 34,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -37,6 +37,7 @@
"max_address_length": 34,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -38,6 +38,7 @@
"blockbook": [
"https://blockbook.ravencoin.org"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -38,6 +38,7 @@
"blockbook": [
"https://blockbook.ritocoin.org"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -39,6 +39,7 @@
"https://insight.smartcash.cc"
],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -37,6 +37,7 @@
"max_address_length": 35,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -37,6 +37,7 @@
"max_address_length": 47,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -36,6 +36,7 @@
"https://insight.terracoin.io"
],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -40,6 +40,7 @@
"https://vtc4.trezor.io",
"https://vtc5.trezor.io"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -39,6 +39,7 @@
"https://explorer.viacoin.org"
],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -41,6 +41,7 @@
"blockbook": [
"https://vips.blockbook.japanesecoin-pool.work"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -40,6 +40,7 @@
"https://zec4.trezor.io",
"https://zec5.trezor.io"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": {
"1": 0,

View File

@ -36,6 +36,7 @@
"https://explorer.testnet.z.cash"
],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": {
"1": 0,

View File

@ -36,6 +36,7 @@
"https://explorer.zcl.zeltrez.io"
],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -39,6 +39,7 @@
"https://insight.zcoin.io"
],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -37,6 +37,7 @@
"max_address_length": 35,
"bitcore": [],
"blockbook": [],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -36,6 +36,7 @@
"blockbook": [
"https://blockbook.zel.network"
],
"negative_fee": false,
"cooldown": 100,
"consensus_branch_id": null
}

View File

@ -26,6 +26,7 @@ class CoinInfo:
force_bip143: bool,
bip115: bool,
decred: bool,
negative_fee: bool,
curve_name: str,
):
self.coin_name = coin_name
@ -45,6 +46,7 @@ class CoinInfo:
self.force_bip143 = force_bip143
self.bip115 = bip115
self.decred = decred
self.negative_fee = negative_fee
self.curve_name = curve_name
if curve_name == "secp256k1-groestl":
self.b58_hash = groestl512d_32
@ -92,6 +94,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Testnet":
@ -113,6 +116,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Actinium":
@ -134,6 +138,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Axe":
@ -155,6 +160,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Bellcoin":
@ -176,6 +182,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "BitCash":
@ -197,6 +204,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Bitgreen":
@ -218,6 +226,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "BitZeny":
@ -239,6 +248,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Bitcloud":
@ -260,6 +270,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Bcash":
@ -281,6 +292,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=True,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Bcash Testnet":
@ -302,6 +314,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=True,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Bgold":
@ -323,6 +336,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=True,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Bgold Testnet":
@ -344,6 +358,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=True,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Bprivate":
@ -365,6 +380,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Brhodium":
@ -386,6 +402,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Bitcore":
@ -407,6 +424,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Bitsend":
@ -428,6 +446,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "BlockStamp":
@ -449,6 +468,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "CPUchain":
@ -470,6 +490,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Capricoin":
@ -491,6 +512,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Dash":
@ -512,6 +534,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Dash Testnet":
@ -533,6 +556,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Decred":
@ -554,6 +578,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=True,
negative_fee=False,
curve_name='secp256k1-decred',
)
elif name == "Decred Testnet":
@ -575,6 +600,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=True,
negative_fee=False,
curve_name='secp256k1-decred',
)
elif name == "Denarius":
@ -596,6 +622,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "DigiByte":
@ -617,6 +644,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Dogecoin":
@ -638,6 +666,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Elements":
@ -659,6 +688,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "FairCoin":
@ -680,6 +710,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Feathercoin":
@ -701,6 +732,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Florincoin":
@ -722,6 +754,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Fujicoin":
@ -743,6 +776,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Gincoin":
@ -764,6 +798,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "GameCredits":
@ -785,6 +820,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Groestlcoin":
@ -806,6 +842,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1-groestl',
)
elif name == "Groestlcoin Testnet":
@ -827,6 +864,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1-groestl',
)
elif name == "Horizen":
@ -848,6 +886,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=True,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Komodo":
@ -869,6 +908,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=True,
curve_name='secp256k1',
)
elif name == "Koto":
@ -890,6 +930,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Litecoin":
@ -911,6 +952,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Litecoin Testnet":
@ -932,6 +974,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Megacoin":
@ -953,6 +996,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Monacoin":
@ -974,6 +1018,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "MonetaryUnit":
@ -995,6 +1040,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Myriad":
@ -1016,6 +1062,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "NIX":
@ -1037,6 +1084,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Namecoin":
@ -1058,6 +1106,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "PIVX":
@ -1079,6 +1128,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "PIVX Testnet":
@ -1100,6 +1150,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Particl":
@ -1121,6 +1172,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Particl Testnet":
@ -1142,6 +1194,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Pesetacoin":
@ -1163,6 +1216,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Polis":
@ -1184,6 +1238,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Primecoin":
@ -1205,6 +1260,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Qtum":
@ -1226,6 +1282,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Qtum Testnet":
@ -1247,6 +1304,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Ravencoin":
@ -1268,6 +1326,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Regtest":
@ -1289,6 +1348,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Ritocoin":
@ -1310,6 +1370,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "SmartCash":
@ -1331,6 +1392,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1-smart',
)
elif name == "SmartCash Testnet":
@ -1352,6 +1414,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1-smart',
)
elif name == "Stakenet":
@ -1373,6 +1436,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "VIPSTARCOIN":
@ -1394,6 +1458,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Vertcoin":
@ -1415,6 +1480,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Viacoin":
@ -1436,6 +1502,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "ZClassic":
@ -1457,6 +1524,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Zcash":
@ -1478,6 +1546,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Zcash Testnet":
@ -1499,6 +1568,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Zcoin":
@ -1520,6 +1590,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "Zcoin Testnet":
@ -1541,6 +1612,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
elif name == "ZelCash":
@ -1562,6 +1634,7 @@ def by_name(name: str) -> CoinInfo:
force_bip143=False,
bip115=False,
decred=False,
negative_fee=False,
curve_name='secp256k1',
)
raise ValueError('Unknown coin name "%s"' % name)

View File

@ -26,6 +26,7 @@ class CoinInfo:
force_bip143: bool,
bip115: bool,
decred: bool,
negative_fee: bool,
curve_name: str,
):
self.coin_name = coin_name
@ -45,6 +46,7 @@ class CoinInfo:
self.force_bip143 = force_bip143
self.bip115 = bip115
self.decred = decred
self.negative_fee = negative_fee
self.curve_name = curve_name
if curve_name == "secp256k1-groestl":
self.b58_hash = groestl512d_32
@ -95,6 +97,7 @@ ATTRIBUTES = (
("force_bip143", bool),
("bip115", bool),
("decred", bool),
("negative_fee", bool),
("curve_name", lambda r: repr(r.replace("_", "-"))),
)
%>\

View File

@ -193,6 +193,10 @@ async def check_tx_fee(tx: SignTx, keychain: seed.Keychain):
total_out += txo_bin.amount
fee = total_in - total_out
if coin.negative_fee:
pass # bypass check for negative fee coins, required for reward TX
else:
if fee < 0:
raise SigningError(FailureType.NotEnoughFunds, "Not enough funds")

View File

@ -44,6 +44,7 @@ const CoinInfo coins[COINS_COUNT] = {
.bech32_prefix = ${c_str(c.bech32_prefix)},
.cashaddr_prefix = ${c_str(c.cashaddr_prefix)},
.coin_type = (${c_int(c.slip44)} | 0x80000000),
.negative_fee = ${c_bool(c.negative_fee)},
.curve_name = ${c.curve_name.upper()}_NAME,
.curve = &${c.curve_name}_info,
},

View File

@ -47,6 +47,7 @@ typedef struct _CoinInfo {
const char *bech32_prefix;
const char *cashaddr_prefix;
uint32_t coin_type;
bool negative_fee;
const char *curve_name;
const curve_info *curve;
} CoinInfo;

View File

@ -686,13 +686,20 @@ static bool signing_check_output(TxOutputType *txoutput) {
}
static bool signing_check_fee(void) {
if (coin->negative_fee) {
// bypass check for negative fee coins, required for reward TX
} else {
// check fees
if (spending > to_spend) {
fsm_sendFailure(FailureType_Failure_NotEnoughFunds, _("Not enough funds"));
fsm_sendFailure(FailureType_Failure_NotEnoughFunds,
_("Not enough funds"));
signing_abort();
return false;
}
uint64_t fee = to_spend - spending;
}
uint64_t fee;
if (spending <= to_spend) {
fee = to_spend - spending;
if (fee > ((uint64_t)tx_weight * coin->maxfee_kb) / 4000) {
layoutFeeOverThreshold(coin, fee);
if (!protectButton(ButtonRequestType_ButtonRequest_FeeOverThreshold,
@ -702,6 +709,9 @@ static bool signing_check_fee(void) {
return false;
}
}
} else {
fee = 0;
}
// last confirmation
layoutConfirmTx(coin, to_spend - change_spend, fee);
if (!protectButton(ButtonRequestType_ButtonRequest_SignTx, false)) {

File diff suppressed because one or more lines are too long

View File

@ -21,43 +21,44 @@ from trezorlib.tools import parse_path
from ..support.tx_cache import tx_cache
from .common import TrezorTest
from .conftest import TREZOR_VERSION
# KMD has no usable backends, use cached TX only
TX_API = tx_cache("Komodo", allow_fetch=False)
TXHASH_339c3e = bytes.fromhex(
"339c3e78610e229f65ebc3fa722016fcb9fbde7bc196d2d876604f5257ada19c"
TXHASH_2807c = bytes.fromhex(
"2807c5b126ec8e2b078cab0f12e4c8b4ce1d7724905f8ebef8dca26b0c8e0f1d"
)
TXHASH_7b28bd = bytes.fromhex(
"7b28bd91119e9776f0d4ebd80e570165818a829bbf4477cd1afe5149dbcd34b1"
)
@pytest.mark.komodo
@pytest.mark.skip(reason="komodo is broken at the moment - issue #178")
class TestMsgSigntxKomodo(TrezorTest):
def test_one_one_fee_sapling(self):
self.setup_mnemonic_allallall()
# prevout: 339c3e78610e229f65ebc3fa722016fcb9fbde7bc196d2d876604f5257ada19c:0
# input 1: 2.9999 KMD
# prevout: 2807c5b126ec8e2b078cab0f12e4c8b4ce1d7724905f8ebef8dca26b0c8e0f1d:0
# input 1: 10.9998 KMD
inp1 = proto.TxInputType(
address_n=parse_path(
"m/Komodo/0h/0/0"
), # RDvyC66RQf7HKkUB5zyLKJhitV4ibzkKF5
amount=299990000,
prev_hash=TXHASH_339c3e,
"44'/141'/0'/0/0"
), # R9HgJZo6JBKmPvhm7whLSR8wiHyZrEDVRi
amount=1099980000,
prev_hash=TXHASH_2807c,
prev_index=0,
)
out1 = proto.TxOutputType(
address="RDvyC66RQf7HKkUB5zyLKJhitV4ibzkKF5",
amount=299990000 - 10000,
address="R9HgJZo6JBKmPvhm7whLSR8wiHyZrEDVRi",
amount=1099980000 - 10000,
script_type=proto.OutputScriptType.PAYTOADDRESS,
)
with self.client:
"""
self.client.set_expected_responses(
[
er = [
proto.TxRequest(
request_type=proto.RequestType.TXINPUT,
details=proto.TxRequestDetailsType(request_index=0),
@ -67,6 +68,10 @@ class TestMsgSigntxKomodo(TrezorTest):
details=proto.TxRequestDetailsType(request_index=0),
),
proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
]
if TREZOR_VERSION != 1: # extra screen for lock_time
er += [proto.ButtonRequest(code=proto.ButtonRequestType.SignTx)]
er += [
proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
proto.TxRequest(
request_type=proto.RequestType.TXINPUT,
@ -78,22 +83,109 @@ class TestMsgSigntxKomodo(TrezorTest):
),
proto.TxRequest(request_type=proto.RequestType.TXFINISHED),
]
)
"""
self.client.set_expected_responses(er)
details = proto.SignTx(
version=4,
overwintered=True,
version_group_id=0x892F2085,
branch_id=0x76B809BB,
lock_time=0x5C5CE16B,
lock_time=0x5D2A30B8,
)
_, serialized_tx = btc.sign_tx(
self.client, "Komodo", [inp1], [out1], details=details, prev_txes=TX_API
)
# Accepted by network: tx 92b45f54cb7c3cdfc4a88dbf088dfcc7c1417ad0955f02712e136da7fd5343d6
# Accepted by network: tx 7b28bd91119e9776f0d4ebd80e570165818a829bbf4477cd1afe5149dbcd34b1
assert (
serialized_tx.hex()
== "0400008085202f89019ca1ad57524f6076d8d296c17bdefbb9fc162072fac3eb659f220e61783e9c33000000006a47304402206972af8ff4dec4074da9edb1a741114bebda9e686bb411dd6f388aafd81f0af2022060a05d0ea66d5b8632868b6a6d377ad1a8941385d628be4631b31cc246014b8501210235ad92bb4efda1e6794890f248fa26aab75906bd496c07a6a8532b62a5bd80f7ffffffff01e054e111000000001976a91433058d6bb20e9297fc0a518e2e0262e854496a6c88ac6be15c5c000000000000000000000000000000"
== "0400008085202f89011d0f8e0c6ba2dcf8be8e5f9024771dceb4c8e4120fab8c072b8eec26b1c50728000000006a4730440220158c970ca2fc6bcc33026eb5366f0342f63b35d178f7efb334b1df78fe90b67202207bc4ff69f67cf843b08564a5adc77bf5593e28ab4d5104911824ac13fe885d8f012102a87aef7b1a8f676e452d6240767699719cd58b0261c822472c25df146938bca5ffffffff01d0359041000000001976a91400178fa0b6fc253a3a402ee2cadd8a7bfec08f6388acb8302a5d000000000000000000000000000000"
)
def test_one_one_rewards_claim(self):
self.setup_mnemonic_allallall()
# prevout: 7b28bd91119e9776f0d4ebd80e570165818a829bbf4477cd1afe5149dbcd34b1:0
# input 1: 10.9997 KMD
inp1 = proto.TxInputType(
address_n=parse_path(
"44'/141'/0'/0/0"
), # R9HgJZo6JBKmPvhm7whLSR8wiHyZrEDVRi
amount=1099970000,
prev_hash=TXHASH_7b28bd,
prev_index=0,
)
out1 = proto.TxOutputType(
address="R9HgJZo6JBKmPvhm7whLSR8wiHyZrEDVRi",
amount=1099970000 - 10000,
script_type=proto.OutputScriptType.PAYTOADDRESS,
)
# kmd interest, vout sum > vin sum
out2 = proto.TxOutputType(
address="R9HgJZo6JBKmPvhm7whLSR8wiHyZrEDVRi",
amount=79605,
script_type=proto.OutputScriptType.PAYTOADDRESS,
)
with self.client:
er = [
proto.TxRequest(
request_type=proto.RequestType.TXINPUT,
details=proto.TxRequestDetailsType(request_index=0),
),
proto.TxRequest(
request_type=proto.RequestType.TXOUTPUT,
details=proto.TxRequestDetailsType(request_index=0),
),
proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
proto.TxRequest(
request_type=proto.RequestType.TXOUTPUT,
details=proto.TxRequestDetailsType(request_index=1),
),
proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
]
if TREZOR_VERSION != 1: # extra screen for lock_time
er += [proto.ButtonRequest(code=proto.ButtonRequestType.SignTx)]
er += [
proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
proto.TxRequest(
request_type=proto.RequestType.TXINPUT,
details=proto.TxRequestDetailsType(request_index=0),
),
proto.TxRequest(
request_type=proto.RequestType.TXOUTPUT,
details=proto.TxRequestDetailsType(request_index=0),
),
proto.TxRequest(
request_type=proto.RequestType.TXOUTPUT,
details=proto.TxRequestDetailsType(request_index=1),
),
proto.TxRequest(request_type=proto.RequestType.TXFINISHED),
]
self.client.set_expected_responses(er)
details = proto.SignTx(
version=4,
overwintered=True,
version_group_id=0x892F2085,
branch_id=0x76B809BB,
lock_time=0x5D2AF1F2,
)
_, serialized_tx = btc.sign_tx(
self.client,
"Komodo",
[inp1],
[out1, out2],
details=details,
prev_txes=TX_API,
)
# Accepted by network: tx c775678ceb18277729b427c7acf2f8ce63ac02fc2366f47ce08a3f443ff0e059
assert (
serialized_tx.hex()
== "0400008085202f8901b134cddb4951fe1acd7744bf9b828a816501570ed8ebd4f076979e1191bd287b000000006a4730440220483a58f5be3a147c773c663008c992a7fcea4d03bdf4c1d4bc0535c0d98ddf0602207b19d69140dd00c7a94f048c712aeaed55dfd27f581c7212d9cc5e476fe1dc9f012102a87aef7b1a8f676e452d6240767699719cd58b0261c822472c25df146938bca5ffffffff02c00e9041000000001976a91400178fa0b6fc253a3a402ee2cadd8a7bfec08f6388acf5360100000000001976a91400178fa0b6fc253a3a402ee2cadd8a7bfec08f6388acf2f12a5d000000000000000000000000000000"
)

View File

@ -0,0 +1 @@
{"txid":"2807c5b126ec8e2b078cab0f12e4c8b4ce1d7724905f8ebef8dca26b0c8e0f1d","version":4,"locktime":0,"vin":[{"txid":"340d478f0c5750057d5f5028db8c10993578849e63f5cf8500e33ddefcd5334f","vout":0,"sequence":4294967295,"n":0,"scriptSig":{"hex":"483045022100d29433faed373d23883ace59acda117a67d6e8e3e99bc767b96a183a840b4aec0220258baef0d63360324f2a455299b2695ae2fa727a5969a25a604c22086e36c6e9012102a87aef7b1a8f676e452d6240767699719cd58b0261c822472c25df146938bca5","asm":"3045022100d29433faed373d23883ace59acda117a67d6e8e3e99bc767b96a183a840b4aec0220258baef0d63360324f2a455299b2695ae2fa727a5969a25a604c22086e36c6e9[ALL] 02a87aef7b1a8f676e452d6240767699719cd58b0261c822472c25df146938bca5"},"addr":"R9HgJZo6JBKmPvhm7whLSR8wiHyZrEDVRi","valueSat":1099990000,"value":10.9999,"doubleSpentTxID":null}],"vout":[{"value":"10.99980000","n":0,"scriptPubKey":{"hex":"76a91400178fa0b6fc253a3a402ee2cadd8a7bfec08f6388ac","asm":"OP_DUP OP_HASH160 00178fa0b6fc253a3a402ee2cadd8a7bfec08f63 OP_EQUALVERIFY OP_CHECKSIG","addresses":["R9HgJZo6JBKmPvhm7whLSR8wiHyZrEDVRi"],"type":"pubkeyhash"},"spentTxId":null,"spentIndex":null,"spentHeight":null}],"vjoinsplit":[],"blockheight":-1,"confirmations":0,"time":1563046535,"valueOut":10.9998,"size":211,"valueIn":10.9999,"fees":0.0001,"fOverwintered":true,"nVersionGroupId":2301567109,"nExpiryHeight":0,"valueBalance":0,"spendDescs":[],"outputDescs":[]}

View File

@ -1 +0,0 @@
{"txid":"339c3e78610e229f65ebc3fa722016fcb9fbde7bc196d2d876604f5257ada19c","version":4,"locktime":1549590608,"vin":[{"txid":"d41f0d442bbd63597481e329f4189e57a2ef05c92ae48f05a6c96781b947e7ca","vout":1,"sequence":4294967295,"n":0,"scriptSig":{"hex":"483045022100f81c1b71036beab189c4a3bdc5bf34ea1dc86e3bc339e5e8928defb392477a0202204e10aede405ceec43adbf0efb3032469a61976561e86d81826da833e4fdfda1f01210235ad92bb4efda1e6794890f248fa26aab75906bd496c07a6a8532b62a5bd80f7","asm":"3045022100f81c1b71036beab189c4a3bdc5bf34ea1dc86e3bc339e5e8928defb392477a0202204e10aede405ceec43adbf0efb3032469a61976561e86d81826da833e4fdfda1f[ALL] 0235ad92bb4efda1e6794890f248fa26aab75906bd496c07a6a8532b62a5bd80f7"},"addr":"RDvyC66RQf7HKkUB5zyLKJhitV4ibzkKF5","valueSat":300000000,"value":3,"doubleSpentTxID":null}],"vout":[{"value":"2.99990000","n":0,"scriptPubKey":{"hex":"76a91433058d6bb20e9297fc0a518e2e0262e854496a6c88ac","asm":"OP_DUP OP_HASH160 33058d6bb20e9297fc0a518e2e0262e854496a6c OP_EQUALVERIFY OP_CHECKSIG","addresses":["RDvyC66RQf7HKkUB5zyLKJhitV4ibzkKF5"],"type":"pubkeyhash"},"spentTxId":"92b45f54cb7c3cdfc4a88dbf088dfcc7c1417ad0955f02712e136da7fd5343d6","spentIndex":0,"spentHeight":1219089}],"vjoinsplit":[],"blockhash":"013c24f1dad6561a786c512555b99180f92d785920165df6fadb264387a75489","blockheight":1219084,"confirmations":9868,"time":1549591478,"blocktime":1549591478,"valueOut":2.9999,"size":211,"valueIn":3,"fees":0.0001,"fOverwintered":true,"nVersionGroupId":2301567109,"nExpiryHeight":0,"valueBalance":0,"spendDescs":[],"outputDescs":[]}

View File

@ -0,0 +1 @@
{"txid":"7b28bd91119e9776f0d4ebd80e570165818a829bbf4477cd1afe5149dbcd34b1","version":4,"locktime":1563046072,"vin":[{"txid":"2807c5b126ec8e2b078cab0f12e4c8b4ce1d7724905f8ebef8dca26b0c8e0f1d","vout":0,"sequence":4294967295,"n":0,"scriptSig":{"hex":"4730440220158c970ca2fc6bcc33026eb5366f0342f63b35d178f7efb334b1df78fe90b67202207bc4ff69f67cf843b08564a5adc77bf5593e28ab4d5104911824ac13fe885d8f012102a87aef7b1a8f676e452d6240767699719cd58b0261c822472c25df146938bca5","asm":"30440220158c970ca2fc6bcc33026eb5366f0342f63b35d178f7efb334b1df78fe90b67202207bc4ff69f67cf843b08564a5adc77bf5593e28ab4d5104911824ac13fe885d8f[ALL] 02a87aef7b1a8f676e452d6240767699719cd58b0261c822472c25df146938bca5"},"addr":"R9HgJZo6JBKmPvhm7whLSR8wiHyZrEDVRi","valueSat":1099980000,"value":10.9998,"doubleSpentTxID":null}],"vout":[{"value":"10.99970000","n":0,"scriptPubKey":{"hex":"76a91400178fa0b6fc253a3a402ee2cadd8a7bfec08f6388ac","asm":"OP_DUP OP_HASH160 00178fa0b6fc253a3a402ee2cadd8a7bfec08f63 OP_EQUALVERIFY OP_CHECKSIG","addresses":["R9HgJZo6JBKmPvhm7whLSR8wiHyZrEDVRi"],"type":"pubkeyhash"},"spentTxId":null,"spentIndex":null,"spentHeight":null}],"vjoinsplit":[],"blockheight":-1,"confirmations":0,"time":1563047233,"valueOut":10.9997,"size":210,"valueIn":10.9998,"fees":0.0001,"fOverwintered":true,"nVersionGroupId":2301567109,"nExpiryHeight":0,"valueBalance":0,"spendDescs":[],"outputDescs":[]}