MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / NextHeadersRequestLocator

Method NextHeadersRequestLocator

src/headerssync.cpp:296–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294}
295
296CBlockLocator HeadersSyncState::NextHeadersRequestLocator() const
297{
298 Assume(m_download_state != State::FINAL);
299 if (m_download_state == State::FINAL) return {};
300
301 auto chain_start_locator = LocatorEntries(&m_chain_start);
302 std::vector<uint256> locator;
303
304 if (m_download_state == State::PRESYNC) {
305 // During pre-synchronization, we continue from the last header received.
306 locator.push_back(m_last_header_received.GetHash());
307 }
308
309 if (m_download_state == State::REDOWNLOAD) {
310 // During redownload, we will download from the last received header that we stored.
311 locator.push_back(m_redownload_buffer_last_hash);
312 }
313
314 locator.insert(locator.end(), chain_start_locator.begin(), chain_start_locator.end());
315
316 return CBlockLocator{std::move(locator)};
317}

Callers 2

headerssync.cppFile · 0.80

Calls 6

LocatorEntriesFunction · 0.85
push_backMethod · 0.45
GetHashMethod · 0.45
insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected