trezor: support v2.5.2+, add more trezor tests, fix chaingen and tests

- passphrase logic: remove backward compatibility for 2.4.3, code cleanup.
- fix LibUSB cmake for static builds on OSX
- tests: all tests now work with passphrase logic enabled. Passphrase test added with different passphrase. no_passphrase test added, Trezor pin test added. Testing wallet opening with correct and incorrect passphrase. Trezor test chain revamp, cleanup. Smaller chain, chain file versioning added.
- tests: Trezor tests support TEST_MINING_ENABLED, TEST_MINING_TIMEOUT env vars to change mining-related tests behaviour.
- requires protobuf@21 on osx for now (c++14), building with unlinked protobuf: `CMAKE_PREFIX_PATH=$(find /opt/homebrew/Cellar/protobuf@21 -maxdepth 1 -type d -name "21.*" -print -quit) \
make debug-test-trezor -j8`
This commit is contained in:
Dusan Klinec 2023-09-29 19:13:37 +02:00
parent 056c996703
commit c444a7e002
No known key found for this signature in database
GPG key ID: 6337E118CCBCE103
27 changed files with 1030 additions and 603 deletions

View file

@ -309,11 +309,10 @@ void mock_daemon::stop_p2p()
m_server.send_stop_signal();
}
void mock_daemon::mine_blocks(size_t num_blocks, const std::string &miner_address)
void mock_daemon::mine_blocks(size_t num_blocks, const std::string &miner_address, std::chrono::seconds timeout)
{
bool blocks_mined = false;
const uint64_t start_height = get_height();
const auto mining_timeout = std::chrono::seconds(360);
MDEBUG("Current height before mining: " << start_height);
start_mining(miner_address);
@ -331,14 +330,14 @@ void mock_daemon::mine_blocks(size_t num_blocks, const std::string &miner_addres
}
auto current_time = std::chrono::system_clock::now();
if (mining_timeout < current_time - mining_started)
if (timeout < current_time - mining_started)
{
break;
}
}
stop_mining();
CHECK_AND_ASSERT_THROW_MES(blocks_mined, "Mining failed in the time limit");
CHECK_AND_ASSERT_THROW_MES(blocks_mined, "Mining failed in the time limit: " << timeout.count());
}
constexpr const std::chrono::seconds mock_daemon::rpc_timeout;