Skip to content
This repository has been archived by the owner on Feb 21, 2019. It is now read-only.

RPC to get block ID / height at/after given timestamp #1188

Closed
theoreticalbts opened this issue Dec 26, 2014 · 4 comments
Closed

RPC to get block ID / height at/after given timestamp #1188

theoreticalbts opened this issue Dec 26, 2014 · 4 comments
Labels
Milestone

Comments

@theoreticalbts
Copy link
Contributor

External RPC scripts interested in blocks in some date range have to either play a binary search game trying to figure out the block ID that corresponds to a given date/time, or fetch a conservatively large number of blocks, many of which will end up being ignored.

So we need an RPC that takes a date/time and converts it to the block ID and height of the first block after that date/time.

@vikramrajkumar vikramrajkumar added this to the 0.9.0 milestone Jan 8, 2015
@vikramrajkumar
Copy link
Contributor

Related: #1400

@vikramrajkumar
Copy link
Contributor

@pmconrad This is low priority but you might want to consider optimizing this for the case when we have chain_interface::get_statistics_enabled() is true, because then you should be able to do a lower bound on chain_database_impl::_slot_index_to_record or chain_database_impl::_slot_timestamp_to_delegate with the timestamp and (iterate backwards until you) find the first valid block ID.

@pmconrad
Copy link
Contributor

I see, that would be slightly faster.

But AFAICS statistics are disabled by default, and the method is (as of today) rarely called, and with 98% delegate participation it should converge in 3-4 steps as it is now - so I think that would be a case of premature optimization, and therefore I'd advise against it.

@vikramrajkumar
Copy link
Contributor

Sounds good.

@vikramrajkumar vikramrajkumar modified the milestones: dvs/0.11.0, dvs/0.9.0 Mar 30, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants