Skip to content

Commit ba93966

Browse files
committed
refactor: Remove call to ShutdownRequested from IndexWaitSynced
Use the node interrupt object instead. There is no change in behavior in this commit.
1 parent 42e5829 commit ba93966

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

src/test/blockfilter_index_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ BOOST_FIXTURE_TEST_CASE(blockfilter_index_initial_sync, BuildChainTestingSetup)
143143
BOOST_REQUIRE(filter_index.StartBackgroundSync());
144144

145145
// Allow filter index to catch up with the block index.
146-
IndexWaitSynced(filter_index);
146+
IndexWaitSynced(filter_index, *Assert(m_node.shutdown));
147147

148148
// Check that filter index has all blocks that were in the chain before it started.
149149
{

src/test/coinstatsindex_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ BOOST_FIXTURE_TEST_CASE(coinstatsindex_initial_sync, TestChain100Setup)
3535

3636
BOOST_REQUIRE(coin_stats_index.StartBackgroundSync());
3737

38-
IndexWaitSynced(coin_stats_index);
38+
IndexWaitSynced(coin_stats_index, *Assert(m_node.shutdown));
3939

4040
// Check that CoinStatsIndex works for genesis block.
4141
const CBlockIndex* genesis_block_index;
@@ -86,7 +86,7 @@ BOOST_FIXTURE_TEST_CASE(coinstatsindex_unclean_shutdown, TestChain100Setup)
8686
CoinStatsIndex index{interfaces::MakeChain(m_node), 1 << 20};
8787
BOOST_REQUIRE(index.Init());
8888
BOOST_REQUIRE(index.StartBackgroundSync());
89-
IndexWaitSynced(index);
89+
IndexWaitSynced(index, *Assert(m_node.shutdown));
9090
std::shared_ptr<const CBlock> new_block;
9191
CBlockIndex* new_block_index = nullptr;
9292
{

src/test/txindex_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ BOOST_FIXTURE_TEST_CASE(txindex_initial_sync, TestChain100Setup)
3333
BOOST_REQUIRE(txindex.StartBackgroundSync());
3434

3535
// Allow tx index to catch up with the block index.
36-
IndexWaitSynced(txindex);
36+
IndexWaitSynced(txindex, *Assert(m_node.shutdown));
3737

3838
// Check that txindex excludes genesis block transactions.
3939
const CBlock& genesis_block = Params().GenesisBlock();

src/test/util/index.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
#include <test/util/index.h>
66

77
#include <index/base.h>
8-
#include <shutdown.h>
98
#include <util/check.h>
9+
#include <util/signalinterrupt.h>
1010
#include <util/time.h>
1111

12-
void IndexWaitSynced(const BaseIndex& index)
12+
void IndexWaitSynced(const BaseIndex& index, const util::SignalInterrupt& interrupt)
1313
{
1414
while (!index.BlockUntilSyncedToCurrentChain()) {
1515
// Assert shutdown was not requested to abort the test, instead of looping forever, in case
1616
// there was an unexpected error in the index that caused it to stop syncing and request a shutdown.
17-
Assert(!ShutdownRequested());
17+
Assert(!interrupt);
1818

1919
UninterruptibleSleep(100ms);
2020
}

src/test/util/index.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
#define BITCOIN_TEST_UTIL_INDEX_H
77

88
class BaseIndex;
9+
namespace util {
10+
class SignalInterrupt;
11+
} // namespace util
912

1013
/** Block until the index is synced to the current chain */
11-
void IndexWaitSynced(const BaseIndex& index);
14+
void IndexWaitSynced(const BaseIndex& index, const util::SignalInterrupt& interrupt);
1215

1316
#endif // BITCOIN_TEST_UTIL_INDEX_H

0 commit comments

Comments
 (0)