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

pull/328/head
Pavol Rusnak 5 years ago
parent 024f4d64af
commit e23bb10ec4
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -26,6 +26,7 @@ class CoinInfo:
force_bip143: bool, force_bip143: bool,
bip115: bool, bip115: bool,
decred: bool, decred: bool,
negative_fee: bool,
curve_name: str, curve_name: str,
): ):
self.coin_name = coin_name self.coin_name = coin_name
@ -45,6 +46,7 @@ class CoinInfo:
self.force_bip143 = force_bip143 self.force_bip143 = force_bip143
self.bip115 = bip115 self.bip115 = bip115
self.decred = decred self.decred = decred
self.negative_fee = negative_fee
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
@ -95,6 +97,7 @@ ATTRIBUTES = (
("force_bip143", bool), ("force_bip143", bool),
("bip115", bool), ("bip115", bool),
("decred", bool), ("decred", bool),
("negative_fee", bool),
("curve_name", lambda r: repr(r.replace("_", "-"))), ("curve_name", lambda r: repr(r.replace("_", "-"))),
) )
%>\ %>\

@ -193,8 +193,12 @@ async def check_tx_fee(tx: SignTx, keychain: seed.Keychain):
total_out += txo_bin.amount total_out += txo_bin.amount
fee = total_in - total_out fee = total_in - total_out
if fee < 0:
raise SigningError(FailureType.NotEnoughFunds, "Not enough funds") 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")
# fee > (coin.maxfee per byte * tx size) # fee > (coin.maxfee per byte * tx size)
if fee > (coin.maxfee_kb / 1000) * (weight.get_total() / 4): if fee > (coin.maxfee_kb / 1000) * (weight.get_total() / 4):

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

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

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

File diff suppressed because one or more lines are too long

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

@ -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":[]}

@ -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":[]}

@ -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":[]}
Loading…
Cancel
Save