Skip to content

Commit

Permalink
Merge bitcoin#12424: Fix rescan test failure due to unset g_address_t…
Browse files Browse the repository at this point in the history
…ype, g_change_type

b7f6002 Fix rescan test failure due to unset g_address_type, g_change_type (Russell Yanofsky)

Pull request description:

  New global variables were introduced in bitcoin#11403 and not setting them causes:

  ```
  test_bitcoin: wallet/wallet.cpp:4259: CTxDestination GetDestinationForKey(const CPubKey&, OutputType): Assertion `false' failed.
  unknown location(0): fatal error in "importwallet_rescan": signal: SIGABRT (application abort requested)
  ```

  It's possible to reproduce the failure reliably by running:

  ```
  src/test/test_bitcoin --log_level=test_suite --run_test=wallet_tests/importwallet_rescan
  ```

  Failures happen nondeterministically because boost test framework doesn't run tests in a specified order, and tests that run previously can set the global variables and mask the bug.

  This is similar to bug bitcoin#12150. Example travis failure is https://travis-ci.org/bitcoin/bitcoin/jobs/340642010

Tree-SHA512: ab40662b3356892b726f1f552e22d58d86b5e982538741e52b37ee447a0c97c76c24ae543687edf2e25d9dd925722909d37abfae95d93bf09e23fa245a4c3351
  • Loading branch information
sipa authored and PastaPastaPasta committed Jun 27, 2021
1 parent 1f180d9 commit a4c7a60
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/wallet/test/wallet_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ BOOST_FIXTURE_TEST_CASE(rescan, TestChain100Setup)
// than or equal to key birthday.
BOOST_FIXTURE_TEST_CASE(importwallet_rescan, TestChain100Setup)
{
g_address_type = OUTPUT_TYPE_DEFAULT;
g_change_type = OUTPUT_TYPE_DEFAULT;

// Create two blocks with same timestamp to verify that importwallet rescan
// will pick up both blocks, not just the first.
const int64_t BLOCK_TIME = chainActive.Tip()->GetBlockTimeMax() + 5;
Expand Down

0 comments on commit a4c7a60

Please sign in to comment.