| 284 | } |
| 285 | |
| 286 | std::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 | |
| 305 | WalletStateBasic::UndoMap::iterator WalletStateBasic::record_undo(UndoMap &undo_map, const std::string &key) { |
| 306 | auto kit = undo_map.find(key); |