parent
adea7d6b35
commit
ffdb299c61
@ -1,51 +0,0 @@
|
||||
{
|
||||
"coin_name": "Capricoin",
|
||||
"coin_shortcut": "CPC",
|
||||
"coin_label": "Capricoin",
|
||||
"website": "https://capricoin.org",
|
||||
"github": "https://github.com/Capricoinofficial/Capricoin",
|
||||
"maintainer": "Jozef Knaperek <jknaperek@gmail.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"decimals": 8,
|
||||
"address_type": 28,
|
||||
"address_type_p2sh": 35,
|
||||
"maxfee_kb": 2000000,
|
||||
"minfee_kb": 1000,
|
||||
"signed_message_header": "Capricoin Signed Message:\n",
|
||||
"hash_genesis_block": "00000d23fa0fc52c90893adb1181c9ddffb6c797a3e41864b9a23aa2f2981fe3",
|
||||
"xprv_magic": 76066276,
|
||||
"xpub_magic": 76067358,
|
||||
"xpub_magic_segwit_p2sh": null,
|
||||
"xpub_magic_segwit_native": null,
|
||||
"bech32_prefix": null,
|
||||
"cashaddr_prefix": null,
|
||||
"slip44": 289,
|
||||
"segwit": false,
|
||||
"decred": false,
|
||||
"fork_id": null,
|
||||
"force_bip143": false,
|
||||
"default_fee_b": {
|
||||
"Low": 1,
|
||||
"Economy": 7,
|
||||
"Normal": 14,
|
||||
"High": 20
|
||||
},
|
||||
"dust_limit": 546,
|
||||
"blocktime_seconds": 60,
|
||||
"uri_prefix": "capricoin",
|
||||
"min_address_length": 27,
|
||||
"max_address_length": 34,
|
||||
"bitcore": [],
|
||||
"blockbook": [
|
||||
"https://blockbook.capricoin.org",
|
||||
"https://blockbook2.capricoin.org",
|
||||
"https://blockbook3.capricoin.org",
|
||||
"https://blockbook4.capricoin.org"
|
||||
],
|
||||
"negative_fee": false,
|
||||
"cooldown": 100,
|
||||
"consensus_branch_id": null,
|
||||
"extra_data": false,
|
||||
"timestamp": true,
|
||||
"confidential_assets": null
|
||||
}
|
Before Width: | Height: | Size: 14 KiB |
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,149 +0,0 @@
|
||||
# This file is part of the Trezor project.
|
||||
#
|
||||
# Copyright (C) 2012-2019 SatoshiLabs and contributors
|
||||
#
|
||||
# This library is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License version 3
|
||||
# as published by the Free Software Foundation.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the License along with this library.
|
||||
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
||||
|
||||
import pytest
|
||||
|
||||
from trezorlib import btc, messages
|
||||
from trezorlib.exceptions import TrezorFailure
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from ..tx_cache import tx_cache
|
||||
|
||||
TXHASH_3bf506 = bytes.fromhex(
|
||||
"3bf506c81ce84eda891679ddc797d162c17c60b15d6c0ac23be5e31369e7235f"
|
||||
)
|
||||
|
||||
TXHASH_f3a6e6 = bytes.fromhex(
|
||||
"f3a6e6411f1b2dffd76d2729bae8e056f8f9ecf8996d3f428e75a6f23f2c5e8c"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.capricoin
|
||||
@pytest.mark.skip_t1 # T1 support is not planned
|
||||
def test_timestamp_included(client):
|
||||
# tx: 3bf506c81ce84eda891679ddc797d162c17c60b15d6c0ac23be5e31369e7235f
|
||||
# input 0: 0.01 CPC
|
||||
# tx: f3a6e6411f1b2dffd76d2729bae8e056f8f9ecf8996d3f428e75a6f23f2c5e8c
|
||||
# input 0: 0.02 CPC
|
||||
|
||||
inp1 = messages.TxInputType(
|
||||
address_n=parse_path("m/44'/289'/0'/0/0"), prev_hash=TXHASH_3bf506, prev_index=0
|
||||
)
|
||||
|
||||
inp2 = messages.TxInputType(
|
||||
address_n=parse_path("m/44'/289'/0'/0/0"), prev_hash=TXHASH_f3a6e6, prev_index=1
|
||||
)
|
||||
|
||||
out1 = messages.TxOutputType(
|
||||
address="CUGi8RGPWxbHM6FxF4eMEfqmQ6Bs5VjCdr",
|
||||
amount=3000000 - 20000,
|
||||
script_type=messages.OutputScriptType.PAYTOADDRESS,
|
||||
)
|
||||
|
||||
details = messages.SignTx(version=1, timestamp=0x5BCF5C66)
|
||||
_, timestamp_tx = btc.sign_tx(
|
||||
client,
|
||||
"Capricoin",
|
||||
[inp1, inp2],
|
||||
[out1],
|
||||
details=details,
|
||||
prev_txes=tx_cache("Capricoin"),
|
||||
)
|
||||
|
||||
# Accepted by network https://insight.capricoin.org/tx/1bf227e6e24fe1f8ac98849fe06a2c5b77762e906fcf7e82787675f7f3a10bb8
|
||||
accepted_txhex = "01000000665ccf5b025f23e76913e3e53bc20a6c5db1607cc162d197c7dd791689da4ee81cc806f53b000000006b483045022100fce7ccbeb9524f36d118ebcfebcb133a05c236c4478e2051cfd5c9632920aee602206921b7be1a81f30cce3d8e7dba4597fc16a2761c42321c49d65eeacdfe3781250121021fcf98aee04939ec7df5762f426dc2d1db8026e3a73c3bbe44749dacfbb61230ffffffff8c5e2c3ff2a6758e423f6d99f8ecf9f856e0e8ba29276dd7ff2d1b1f41e6a6f3010000006a473044022015d967166fe9f89fbed8747328b1c4658aa1d7163e731c5fd5908feafe08e9a6022028af30801098418bd298cc60b143c52c48466f5791256721304b6eba4fdf0b3c0121021fcf98aee04939ec7df5762f426dc2d1db8026e3a73c3bbe44749dacfbb61230ffffffff01a0782d00000000001976a914818437acfd15780debd31f3fd21d4ca678bb36d188ac00000000"
|
||||
assert timestamp_tx.hex() == accepted_txhex
|
||||
|
||||
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.capricoin
|
||||
@pytest.mark.skip_ui
|
||||
@pytest.mark.skip_t1 # T1 support is not planned
|
||||
def test_timestamp_missing(client):
|
||||
inp1 = messages.TxInputType(
|
||||
address_n=parse_path("m/44'/289'/0'/0/0"), prev_hash=TXHASH_3bf506, prev_index=0
|
||||
)
|
||||
out1 = messages.TxOutputType(
|
||||
address="CUGi8RGPWxbHM6FxF4eMEfqmQ6Bs5VjCdr",
|
||||
amount=3000000 - 20000,
|
||||
script_type=messages.OutputScriptType.PAYTOADDRESS,
|
||||
)
|
||||
details = messages.SignTx(version=1, timestamp=None)
|
||||
with pytest.raises(TrezorFailure) as e:
|
||||
btc.sign_tx(
|
||||
client,
|
||||
"Capricoin",
|
||||
[inp1],
|
||||
[out1],
|
||||
details=details,
|
||||
prev_txes=tx_cache("Capricoin"),
|
||||
)
|
||||
assert e.value.failure.message.endswith("Timestamp must be set.")
|
||||
|
||||
details = messages.SignTx(version=1, timestamp=0)
|
||||
with pytest.raises(TrezorFailure) as e:
|
||||
btc.sign_tx(
|
||||
client,
|
||||
"Capricoin",
|
||||
[inp1],
|
||||
[out1],
|
||||
details=details,
|
||||
prev_txes=tx_cache("Capricoin"),
|
||||
)
|
||||
assert e.value.failure.message.endswith("Timestamp must be set.")
|
||||
|
||||
|
||||
@pytest.mark.altcoin
|
||||
@pytest.mark.capricoin
|
||||
@pytest.mark.skip_ui
|
||||
@pytest.mark.skip_t1 # T1 support is not planned
|
||||
def test_timestamp_missing_prevtx(client):
|
||||
inp1 = messages.TxInputType(
|
||||
address_n=parse_path("m/44'/289'/0'/0/0"), prev_hash=TXHASH_3bf506, prev_index=0
|
||||
)
|
||||
out1 = messages.TxOutputType(
|
||||
address="CUGi8RGPWxbHM6FxF4eMEfqmQ6Bs5VjCdr",
|
||||
amount=3000000 - 20000,
|
||||
script_type=messages.OutputScriptType.PAYTOADDRESS,
|
||||
)
|
||||
details = messages.SignTx(version=1, timestamp=0x5BCF5C66)
|
||||
|
||||
prevtx = tx_cache("Capricoin")[TXHASH_3bf506]
|
||||
prevtx.timestamp = 0
|
||||
|
||||
with pytest.raises(TrezorFailure) as e:
|
||||
btc.sign_tx(
|
||||
client,
|
||||
"Capricoin",
|
||||
[inp1],
|
||||
[out1],
|
||||
details=details,
|
||||
prev_txes={TXHASH_3bf506: prevtx},
|
||||
)
|
||||
assert e.value.failure.message.endswith("Timestamp must be set.")
|
||||
|
||||
prevtx.timestamp = None
|
||||
with pytest.raises(TrezorFailure) as e:
|
||||
btc.sign_tx(
|
||||
client,
|
||||
"Capricoin",
|
||||
[inp1],
|
||||
[out1],
|
||||
details=details,
|
||||
prev_txes={TXHASH_3bf506: prevtx},
|
||||
)
|
||||
assert e.value.failure.message.endswith("Timestamp must be set.")
|
Loading…
Reference in new issue