6#ifndef VERIBLOCK_POP_CPP_BLOCK_READER_HPP
7#define VERIBLOCK_POP_CPP_BLOCK_READER_HPP
10#include <veriblock/pop/blockchain/block_index.hpp>
11#include <veriblock/pop/entities/altblock.hpp>
12#include <veriblock/pop/entities/btcblock.hpp>
13#include <veriblock/pop/entities/vbkblock.hpp>
14#include <veriblock/pop/storage/stored_block_index.hpp>
15#include <veriblock/pop/validation_state.hpp>
17#include "block_iterator.hpp"
30 virtual bool getAltTip(AltBlock::hash_t& out)
const = 0;
36 virtual bool getBlock(
const AltBlock::prev_hash_t& hash,
47 virtual std::shared_ptr<BlockIterator<AltBlock>> getAltBlockIterator()
const = 0;
49 virtual std::shared_ptr<BlockIterator<VbkBlock>> getVbkBlockIterator()
const = 0;
51 virtual std::shared_ptr<BlockIterator<BtcBlock>> getBtcBlockIterator()
const = 0;
54 template <
typename Block>
55 std::shared_ptr<BlockIterator<Block>> getBlockIterator()
const;
57 template <
typename Block>
58 bool getTip(
typename Block::hash_t& out)
const;
63inline std::shared_ptr<BlockIterator<AltBlock>> BlockReader::getBlockIterator()
const {
64 return this->getAltBlockIterator();
68inline std::shared_ptr<BlockIterator<VbkBlock>> BlockReader::getBlockIterator()
const {
69 return this->getVbkBlockIterator();
73inline std::shared_ptr<BlockIterator<BtcBlock>> BlockReader::getBlockIterator()
const {
74 return this->getBtcBlockIterator();
79inline bool BlockReader::getTip<AltBlock>(AltBlock::hash_t& out)
const {
80 return this->getAltTip(out);
84inline bool BlockReader::getTip<VbkBlock>(VbkBlock::hash_t& out)
const {
85 return this->getVbkTip(out);
89inline bool BlockReader::getTip<BtcBlock>(BtcBlock::hash_t& out)
const {
90 return this->getBtcTip(out);
Contiguous byte array of fixed size.
An abstraction over on-disk storage iterator.