diff options
author | Dusan Klinec <dusan.klinec@gmail.com> | 2018-11-20 14:40:51 +0100 |
---|---|---|
committer | Dusan Klinec <dusan.klinec@gmail.com> | 2019-03-05 14:02:45 +0100 |
commit | 5ea17909caec3ca9f96e3dbd360ee952528de43c (patch) | |
tree | 93743fabffa0cfe5678395d11003600b45ddb629 /src/device_trezor/device_trezor.cpp | |
parent | Merge pull request #4988 (diff) | |
download | monero-5ea17909caec3ca9f96e3dbd360ee952528de43c.tar.xz |
device/trezor: debugging features, trezor tests
Diffstat (limited to 'src/device_trezor/device_trezor.cpp')
-rw-r--r-- | src/device_trezor/device_trezor.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/device_trezor/device_trezor.cpp b/src/device_trezor/device_trezor.cpp index 8868fb995..e1b079044 100644 --- a/src/device_trezor/device_trezor.cpp +++ b/src/device_trezor/device_trezor.cpp @@ -97,7 +97,14 @@ namespace trezor { auto res = get_view_key(); CHECK_AND_ASSERT_MES(res->watch_key().size() == 32, false, "Trezor returned invalid view key"); + // Trezor does not make use of spendkey of the device API. + // Ledger loads encrypted spendkey, Trezor loads null key (never leaves device). + // In the test (debugging mode) we need to leave this field intact as it is already set by + // the debugging code and need to remain same for the testing purposes. +#ifndef WITH_TREZOR_DEBUGGING spendkey = crypto::null_skey; // not given +#endif + memcpy(viewkey.data, res->watch_key().data(), 32); return true; @@ -362,13 +369,9 @@ namespace trezor { CHECK_AND_ASSERT_THROW_MES(m_features, "Device state not initialized"); // make sure the caller did not reset features const bool nonce_required = init_msg->tsx_data().has_payment_id() && init_msg->tsx_data().payment_id().size() > 0; - if (nonce_required){ + if (nonce_required && init_msg->tsx_data().payment_id().size() == 8){ // Versions 2.0.9 and lower do not support payment ID - CHECK_AND_ASSERT_THROW_MES(m_features->has_major_version() && m_features->has_minor_version() && m_features->has_patch_version(), "Invalid Trezor firmware version information"); - const uint32_t vma = m_features->major_version(); - const uint32_t vmi = m_features->minor_version(); - const uint32_t vpa = m_features->patch_version(); - if (vma < 2 || (vma == 2 && vmi == 0 && vpa <= 9)) { + if (get_version() <= pack_version(2, 0, 9)) { throw exc::TrezorException("Trezor firmware 2.0.9 and lower does not support transactions with short payment IDs or integrated addresses. Please update."); } } |