mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-05-20 15:58:46 +00:00
tests: update tx_cache usages
This commit is contained in:
parent
d2dd78f979
commit
b3569a53e6
@ -20,7 +20,7 @@ from trezorlib import btc, messages as proto
|
||||
from trezorlib.tools import H_, CallException, btc_hash, parse_path
|
||||
|
||||
from ..common import MNEMONIC12
|
||||
from ..tx_cache import tx_cache
|
||||
from ..tx_cache import TxCache
|
||||
|
||||
TXHASH_157041 = bytes.fromhex(
|
||||
"1570416eb4302cf52979afd5e6909e37d8fdd874301f7cc87e547e509cb1caa6"
|
||||
@ -78,7 +78,7 @@ def check_sign_tx(
|
||||
__tracebackhide__ = True
|
||||
expected_responses = []
|
||||
|
||||
txes = tx_cache(coin_name)
|
||||
txes = TxCache(coin_name)
|
||||
|
||||
t = proto.RequestType
|
||||
b = proto.ButtonRequestType
|
||||
@ -611,7 +611,7 @@ class TestMsgSigntx:
|
||||
"Bitcoin",
|
||||
[inp1, inp2],
|
||||
[out1, out2],
|
||||
prev_txes=tx_cache("Bitcoin"),
|
||||
prev_txes=TxCache("Bitcoin"),
|
||||
)
|
||||
assert exc.value.args[0] in (
|
||||
proto.FailureType.ProcessError,
|
||||
@ -663,7 +663,7 @@ class TestMsgSigntx:
|
||||
|
||||
with pytest.raises(CallException) as exc:
|
||||
btc.sign_tx(
|
||||
client, "Testnet", [inp1], [out1, out2], prev_txes=tx_cache("Testnet")
|
||||
client, "Testnet", [inp1], [out1, out2], prev_txes=TxCache("Testnet")
|
||||
)
|
||||
|
||||
assert exc.value.args[0] in (
|
||||
@ -768,7 +768,7 @@ class TestMsgSigntx:
|
||||
"Testnet",
|
||||
[inp1],
|
||||
[out1, out2],
|
||||
prev_txes=tx_cache("Testnet"),
|
||||
prev_txes=TxCache("Testnet"),
|
||||
)
|
||||
|
||||
assert exc.value.args[0] == proto.FailureType.ProcessError
|
||||
|
@ -19,9 +19,9 @@ import pytest
|
||||
from trezorlib import btc, messages as proto
|
||||
from trezorlib.tools import H_, CallException, parse_path
|
||||
|
||||
from ..tx_cache import tx_cache
|
||||
from ..tx_cache import TxCache
|
||||
|
||||
TX_API = tx_cache("Bcash")
|
||||
TX_API = TxCache("Bcash")
|
||||
|
||||
|
||||
@pytest.mark.altcoin
|
||||
|
@ -19,9 +19,9 @@ import pytest
|
||||
from trezorlib import btc, messages as proto
|
||||
from trezorlib.tools import H_, CallException, parse_path
|
||||
|
||||
from ..tx_cache import tx_cache
|
||||
from ..tx_cache import TxCache
|
||||
|
||||
TX_API = tx_cache("Bgold")
|
||||
TX_API = TxCache("Bgold")
|
||||
|
||||
|
||||
# All data taken from T1
|
||||
|
@ -19,7 +19,7 @@ import pytest
|
||||
from trezorlib import btc, messages
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from ..tx_cache import tx_cache
|
||||
from ..tx_cache import TxCache
|
||||
|
||||
TXHASH_3bf506 = bytes.fromhex(
|
||||
"3bf506c81ce84eda891679ddc797d162c17c60b15d6c0ac23be5e31369e7235f"
|
||||
@ -61,7 +61,7 @@ def test_timestamp_included(client):
|
||||
[inp1, inp2],
|
||||
[out1],
|
||||
details=details,
|
||||
prev_txes=tx_cache("Capricoin"),
|
||||
prev_txes=TxCache("Capricoin"),
|
||||
)
|
||||
|
||||
# Accepted by network https://insight.capricoin.org/tx/1bf227e6e24fe1f8ac98849fe06a2c5b77762e906fcf7e82787675f7f3a10bb8
|
||||
|
@ -19,9 +19,9 @@ import pytest
|
||||
from trezorlib import btc, messages as proto
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from ..tx_cache import tx_cache
|
||||
from ..tx_cache import TxCache
|
||||
|
||||
TX_API = tx_cache("Dash")
|
||||
TX_API = TxCache("Dash")
|
||||
|
||||
|
||||
@pytest.mark.altcoin
|
||||
|
@ -19,9 +19,9 @@ import pytest
|
||||
from trezorlib import btc, messages as proto
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from ..tx_cache import tx_cache
|
||||
from ..tx_cache import TxCache
|
||||
|
||||
TX_API = tx_cache("Decred Testnet")
|
||||
TX_API = TxCache("Decred Testnet")
|
||||
|
||||
|
||||
TXHASH_e16248 = bytes.fromhex(
|
||||
|
@ -19,9 +19,9 @@ import pytest
|
||||
from trezorlib import btc, messages as proto
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from ..tx_cache import tx_cache
|
||||
from ..tx_cache import TxCache
|
||||
|
||||
TX_API = tx_cache("Groestlcoin")
|
||||
TX_API = TxCache("Groestlcoin")
|
||||
|
||||
|
||||
@pytest.mark.altcoin
|
||||
|
@ -19,10 +19,9 @@ import pytest
|
||||
from trezorlib import btc, messages as proto
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from ..tx_cache import tx_cache
|
||||
from ..tx_cache import TxCache
|
||||
|
||||
# KMD has no usable backends, use cached TX only
|
||||
TX_API = tx_cache("Komodo", allow_fetch=False)
|
||||
TX_API = TxCache("Komodo")
|
||||
|
||||
TXHASH_2807c = bytes.fromhex(
|
||||
"2807c5b126ec8e2b078cab0f12e4c8b4ce1d7724905f8ebef8dca26b0c8e0f1d"
|
||||
|
@ -19,7 +19,7 @@ import pytest
|
||||
from trezorlib import btc, messages
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from ..tx_cache import tx_cache
|
||||
from ..tx_cache import TxCache
|
||||
|
||||
TXHASH_41b29a = bytes.fromhex(
|
||||
"41b29ad615d8eea40a4654a052d18bb10cd08f203c351f4d241f88b031357d3d"
|
||||
@ -50,7 +50,7 @@ def test_timestamp_included(client):
|
||||
[inp1],
|
||||
[out1],
|
||||
details=details,
|
||||
prev_txes=tx_cache("Peercoin", allow_fetch=False),
|
||||
prev_txes=TxCache("Peercoin"),
|
||||
)
|
||||
|
||||
# Accepted by network https://explorer.peercoin.net/api/getrawtransaction?txid=f7e3624c143b6a170cc44f9337d0fa8ea8564a211de9c077c6889d8c78f80909&decrypt=1
|
||||
|
@ -19,9 +19,9 @@ import pytest
|
||||
from trezorlib import btc, messages as proto
|
||||
from trezorlib.tools import H_, CallException, parse_path
|
||||
|
||||
from ..tx_cache import tx_cache
|
||||
from ..tx_cache import TxCache
|
||||
|
||||
TX_API = tx_cache("Testnet")
|
||||
TX_API = TxCache("Testnet")
|
||||
|
||||
|
||||
class TestMsgSigntxSegwit:
|
||||
|
@ -20,9 +20,9 @@ from trezorlib import btc, messages as proto
|
||||
from trezorlib.ckd_public import deserialize
|
||||
from trezorlib.tools import H_, parse_path
|
||||
|
||||
from ..tx_cache import tx_cache
|
||||
from ..tx_cache import TxCache
|
||||
|
||||
TX_API = tx_cache("Testnet")
|
||||
TX_API = TxCache("Testnet")
|
||||
|
||||
|
||||
class TestMsgSigntxSegwitNative:
|
||||
|
@ -19,9 +19,9 @@ import pytest
|
||||
from trezorlib import btc, messages as proto
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
from ..tx_cache import tx_cache
|
||||
from ..tx_cache import TxCache
|
||||
|
||||
TX_API = tx_cache("Zcash Testnet")
|
||||
TX_API = TxCache("Zcash Testnet")
|
||||
|
||||
TXHASH_aaf51e = bytes.fromhex(
|
||||
"aaf51e4606c264e47e5c42c958fe4cf1539c5172684721e38e69f4ef634d75dc"
|
||||
|
@ -20,9 +20,9 @@ from trezorlib import btc, ckd_public as bip32, messages as proto
|
||||
from trezorlib.tools import CallException, parse_path
|
||||
|
||||
from ..common import MNEMONIC12
|
||||
from ..tx_cache import tx_cache
|
||||
from ..tx_cache import TxCache
|
||||
|
||||
TX_API = tx_cache("Bitcoin")
|
||||
TX_API = TxCache("Bitcoin")
|
||||
|
||||
TXHASH_c6091a = bytes.fromhex(
|
||||
"c6091adf4c0c23982a35899a6e58ae11e703eacd7954f588ed4b9cdefc4dba52"
|
||||
|
@ -20,9 +20,9 @@ from trezorlib import btc, ckd_public as bip32, messages as proto
|
||||
from trezorlib.tools import H_, parse_path
|
||||
|
||||
from ..common import MNEMONIC12
|
||||
from ..tx_cache import tx_cache
|
||||
from ..tx_cache import TxCache
|
||||
|
||||
TX_API = tx_cache("Testnet")
|
||||
TX_API = TxCache("Testnet")
|
||||
|
||||
|
||||
class TestMultisigChange:
|
||||
|
@ -19,9 +19,9 @@ import pytest
|
||||
from trezorlib import btc, messages as proto
|
||||
from trezorlib.tools import CallException, parse_path
|
||||
|
||||
from ..tx_cache import tx_cache
|
||||
from ..tx_cache import TxCache
|
||||
|
||||
TX_API = tx_cache("Bitcoin")
|
||||
TX_API = TxCache("Bitcoin")
|
||||
|
||||
TXHASH_d5f65e = bytes.fromhex(
|
||||
"d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"
|
||||
|
@ -20,7 +20,7 @@ from trezorlib import btc, device, messages as proto, misc
|
||||
from trezorlib.exceptions import TrezorFailure
|
||||
|
||||
from ..common import MNEMONIC12
|
||||
from ..tx_cache import tx_cache
|
||||
from ..tx_cache import TxCache
|
||||
|
||||
TXHASH_d5f65e = bytes.fromhex(
|
||||
"d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"
|
||||
@ -246,9 +246,7 @@ class TestProtectionLevels:
|
||||
proto.TxRequest(request_type=proto.RequestType.TXFINISHED),
|
||||
]
|
||||
)
|
||||
btc.sign_tx(
|
||||
client, "Bitcoin", [inp1], [out1], prev_txes=tx_cache("Bitcoin")
|
||||
)
|
||||
btc.sign_tx(client, "Bitcoin", [inp1], [out1], prev_txes=TxCache("Bitcoin"))
|
||||
|
||||
# def test_firmware_erase(self):
|
||||
# pass
|
||||
|
@ -19,7 +19,7 @@ import pytest
|
||||
from trezorlib import btc, messages as proto
|
||||
|
||||
from ..common import MNEMONIC12
|
||||
from ..tx_cache import tx_cache
|
||||
from ..tx_cache import TxCache
|
||||
|
||||
TXHASH_d5f65e = bytes.fromhex(
|
||||
"d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882"
|
||||
@ -46,7 +46,7 @@ class TestZerosig:
|
||||
)
|
||||
|
||||
_, serialized_tx = btc.sign_tx(
|
||||
client, "Bitcoin", [inp1], [out1], prev_txes=tx_cache("Bitcoin")
|
||||
client, "Bitcoin", [inp1], [out1], prev_txes=TxCache("Bitcoin")
|
||||
)
|
||||
siglen = serialized_tx[44]
|
||||
|
||||
@ -70,7 +70,7 @@ class TestZerosig:
|
||||
)
|
||||
|
||||
_, serialized_tx = btc.sign_tx(
|
||||
client, "Bitcoin", [inp1], [out1], prev_txes=tx_cache("Bitcoin")
|
||||
client, "Bitcoin", [inp1], [out1], prev_txes=TxCache("Bitcoin")
|
||||
)
|
||||
siglen = serialized_tx[44]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user