/Users/eugenesiegel/btc/bitcoin/src/kernel/chain.cpp
| Line | Count | Source (jump to first uncovered line) | 
| 1 |  | // Copyright (c) 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 <chain.h> | 
| 6 |  | #include <interfaces/chain.h> | 
| 7 |  | #include <kernel/chain.h> | 
| 8 |  | #include <sync.h> | 
| 9 |  | #include <uint256.h> | 
| 10 |  |  | 
| 11 |  | class CBlock; | 
| 12 |  |  | 
| 13 |  | namespace kernel { | 
| 14 |  | interfaces::BlockInfo MakeBlockInfo(const CBlockIndex* index, const CBlock* data) | 
| 15 | 0 | { | 
| 16 | 0 |     interfaces::BlockInfo info{index ? *index->phashBlock : uint256::ZERO}; | 
| 17 | 0 |     if (index) { | 
| 18 | 0 |         info.prev_hash = index->pprev ? index->pprev->phashBlock : nullptr; | 
| 19 | 0 |         info.height = index->nHeight; | 
| 20 | 0 |         info.chain_time_max = index->GetBlockTimeMax(); | 
| 21 | 0 |         LOCK(::cs_main); | Line | Count | Source |  | 259 | 0 | #define LOCK(cs) UniqueLock UNIQUE_NAME(criticalblock)(MaybeCheckNotHeld(cs), #cs, __FILE__, __LINE__) | Line | Count | Source |  | 11 | 0 | #define UNIQUE_NAME(name) PASTE2(name, __COUNTER__) | Line | Count | Source |  | 9 | 0 | #define PASTE2(x, y) PASTE(x, y) | Line | Count | Source |  | 8 | 0 | #define PASTE(x, y) x ## y | 
 | 
 | 
 | 
 | 
| 22 | 0 |         info.file_number = index->nFile; | 
| 23 | 0 |         info.data_pos = index->nDataPos; | 
| 24 | 0 |     } | 
| 25 | 0 |     info.data = data; | 
| 26 | 0 |     return info; | 
| 27 | 0 | } | 
| 28 |  | } // namespace kernel | 
| 29 |  |  | 
| 30 | 0 | std::ostream& operator<<(std::ostream& os, const ChainstateRole& role) { | 
| 31 | 0 |     switch(role) { | 
| 32 | 0 |         case ChainstateRole::NORMAL: os << "normal"; break; | 
| 33 | 0 |         case ChainstateRole::ASSUMEDVALID: os << "assumedvalid"; break; | 
| 34 | 0 |         case ChainstateRole::BACKGROUND: os << "background"; break; | 
| 35 | 0 |         default: os.setstate(std::ios_base::failbit); | 
| 36 | 0 |     } | 
| 37 | 0 |     return os; | 
| 38 | 0 | } |