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