MCPcopy Create free account
hub / github.com/bcndev/bytecoin / LegacyBlockChainReader

Method LegacyBlockChainReader

src/Core/BlockChainFileFormat.cpp:24–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22const bool multicore = true;
23
24LegacyBlockChainReader::LegacyBlockChainReader(const Currency &currency,
25 const std::string &index_file_name,
26 const std::string &item_file_name)
27 : m_currency(currency) {
28 try {
29 m_indexes_file = std::make_unique<platform::FileStream>(index_file_name, platform::O_READ_EXISTING);
30 m_items_file = std::make_unique<platform::FileStream>(item_file_name, platform::O_READ_EXISTING);
31
32 m_indexes_file->seek(0, SEEK_END);
33 uint64_t m_indexesFileSize = m_indexes_file->tellp();
34 m_indexes_file->seek(0, SEEK_SET);
35 uint64_t max_hei = (m_indexesFileSize - sizeof(uint64_t)) / sizeof(uint32_t);
36 uint64_t read_hei = 0;
37 m_indexes_file->read(reinterpret_cast<char *>(&read_hei), sizeof(uint64_t));
38 m_count = common::integer_cast<Height>(std::min(read_hei, max_hei));
39 } catch (const std::runtime_error &) {
40 }
41}
42
43LegacyBlockChainReader::~LegacyBlockChainReader() {
44 {

Callers

nothing calls this directly

Calls 4

minFunction · 0.85
seekMethod · 0.80
tellpMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected