/root/bitcoin/src/test/util/validation.cpp
Line | Count | Source |
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 | | void TestChainstateManager::DisableNextWrite() |
13 | 0 | { |
14 | 0 | struct TestChainstate : public Chainstate { |
15 | 0 | void ResetNextWrite() { m_next_write = NodeClock::time_point::max() - 1s; } |
16 | 0 | }; |
17 | 0 | for (auto* cs : GetAll()) { |
18 | 0 | static_cast<TestChainstate*>(cs)->ResetNextWrite(); |
19 | 0 | } |
20 | 0 | } |
21 | | void TestChainstateManager::ResetIbd() |
22 | 0 | { |
23 | 0 | m_cached_finished_ibd = false; |
24 | 0 | assert(IsInitialBlockDownload()); |
25 | 0 | } |
26 | | |
27 | | void TestChainstateManager::JumpOutOfIbd() |
28 | 0 | { |
29 | 0 | Assert(IsInitialBlockDownload()); |
30 | 0 | m_cached_finished_ibd = true; |
31 | 0 | Assert(!IsInitialBlockDownload()); |
32 | 0 | } |
33 | | |
34 | | void ValidationInterfaceTest::BlockConnected( |
35 | | ChainstateRole role, |
36 | | CValidationInterface& obj, |
37 | | const std::shared_ptr<const CBlock>& block, |
38 | | const CBlockIndex* pindex) |
39 | 0 | { |
40 | 0 | obj.BlockConnected(role, block, pindex); |
41 | 0 | } |