def sync_from_steemd(): s = Steemd() lbound = db_last_block() + 1 ubound = s.last_irreversible_block_num start_num = lbound start_time = time.time() while lbound < ubound: to = min(lbound + 1000, ubound) blocks = s.get_blocks_range(lbound, to) lbound = to process_blocks(blocks) rate = (lbound - start_num) / (time.time() - start_time) print("[SYNC] Got block {} ({}/s) {}m remaining".format( to - 1, round(rate, 1), round((ubound - lbound) / rate / 60, 2)))
def test_ensured_block_ranges(): """ Post should load correctly if passed a dict or string identifier. """ s = Steemd() assert list(pluck('block_num', s.get_blocks_range(1000, 2000))) == list(range(1000, 2000))