Branch data Line data Source code
1 : : // Copyright (c) 2020-2022 The Bitcoin Core developers
2 : : // Distributed under the MIT software license, see the accompanying
3 : : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 : :
5 : : #include <test/util/validation.h>
6 : :
7 : : #include <util/check.h>
8 : : #include <util/time.h>
9 : : #include <validation.h>
10 : : #include <validationinterface.h>
11 : :
12 : 0 : void TestChainstateManager::DisableNextWrite()
13 : : {
14 : 0 : struct TestChainstate : public Chainstate {
15 : 0 : void ResetNextWrite() { m_next_write = NodeClock::time_point::max() - 1s; }
16 : : };
17 [ # # ]: 0 : for (auto* cs : GetAll()) {
18 : 0 : static_cast<TestChainstate*>(cs)->ResetNextWrite();
19 : 0 : }
20 : 0 : }
21 : 2 : void TestChainstateManager::ResetIbd()
22 : : {
23 : 2 : m_cached_finished_ibd = false;
24 [ - + ]: 2 : assert(IsInitialBlockDownload());
25 : 2 : }
26 : :
27 : 1 : void TestChainstateManager::JumpOutOfIbd()
28 : : {
29 : 1 : Assert(IsInitialBlockDownload());
30 : 1 : m_cached_finished_ibd = true;
31 : 1 : Assert(!IsInitialBlockDownload());
32 : 1 : }
33 : :
34 : 1 : void ValidationInterfaceTest::BlockConnected(
35 : : ChainstateRole role,
36 : : CValidationInterface& obj,
37 : : const std::shared_ptr<const CBlock>& block,
38 : : const CBlockIndex* pindex)
39 : : {
40 : 1 : obj.BlockConnected(role, block, pindex);
41 : 1 : }
|