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

Method get_sparse_chain

src/Core/WalletStateBasic.cpp:286–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284}
285
286std::vector<Hash> WalletStateBasic::get_sparse_chain() const {
287 std::vector<Hash> tip_path;
288
289 Height jump = 0;
290 while (m_chain_height >= jump) {
291 api::BlockHeader bh;
292 if (!read_chain(m_chain_height - jump, &bh))
293 break;
294 tip_path.push_back(bh.hash);
295 if (tip_path.size() <= 10)
296 jump += 1;
297 else
298 jump += (1 << (tip_path.size() - 10));
299 }
300 if (tip_path.empty() || tip_path.back() != m_genesis_bid)
301 tip_path.push_back(m_genesis_bid);
302 return tip_path;
303}
304
305WalletStateBasic::UndoMap::iterator WalletStateBasic::record_undo(UndoMap &undo_map, const std::string &key) {
306 auto kit = undo_map.find(key);

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected