Skip to content

Commit

Permalink
tests: Make coins_tests/updatecoins_simulation_test deterministic
Browse files Browse the repository at this point in the history
Summary:
Backport of core [[bitcoin/bitcoin#16225 | PR16225]].

Depends on D6620.

Test Plan:
  ninja check

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D6621
  • Loading branch information
practicalswift authored and Fabcien committed Jun 18, 2020
1 parent d64efa6 commit 2c9b8b6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/test/coins_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ UtxoData::iterator FindRandomFrom(const std::set<COutPoint> &utxoSet) {
// overwritten at all cache levels)
BOOST_AUTO_TEST_CASE(updatecoins_simulation_test) {
SeedInsecureRand(/* deterministic */ true);
g_mock_deterministic_tests = true;

bool spent_a_duplicate_coinbase = false;
// A simple map to track what we expect the cache stack to represent.
Expand Down Expand Up @@ -505,6 +506,8 @@ BOOST_AUTO_TEST_CASE(updatecoins_simulation_test) {

// Verify coverage.
BOOST_CHECK(spent_a_duplicate_coinbase);

g_mock_deterministic_tests = false;
}

BOOST_AUTO_TEST_CASE(coin_serialization) {
Expand Down

0 comments on commit 2c9b8b6

Please sign in to comment.