mirror of https://github.com/bitcoin/bitcoin
parent
7ee41217b3
commit
fa086248e5
@ -0,0 +1,18 @@
|
||||
// Copyright (c) 2020-2022 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <test/util/index.h>
|
||||
|
||||
#include <index/base.h>
|
||||
#include <util/check.h>
|
||||
#include <util/time.h>
|
||||
|
||||
void IndexWaitSynced(BaseIndex& index)
|
||||
{
|
||||
const auto timeout{SteadyClock::now() + 120s};
|
||||
while (!index.BlockUntilSyncedToCurrentChain()) {
|
||||
Assert(timeout > SteadyClock::now());
|
||||
UninterruptibleSleep(100ms);
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
// Copyright (c) 2020-2022 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_TEST_UTIL_INDEX_H
|
||||
#define BITCOIN_TEST_UTIL_INDEX_H
|
||||
|
||||
class BaseIndex;
|
||||
|
||||
/** Block until the index is synced to the current chain */
|
||||
void IndexWaitSynced(BaseIndex& index);
|
||||
|
||||
#endif // BITCOIN_TEST_UTIL_INDEX_H
|
Loading…
Reference in new issue