Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get block by time stamp #3514

Merged
merged 24 commits into from
Feb 20, 2022
Merged

Get block by time stamp #3514

merged 24 commits into from
Feb 20, 2022

Conversation

enriavil1
Copy link
Contributor

No description provided.

@AlexeyAkhunov
Copy link
Contributor

Can you also add a test (can you eth_call_test.go in the same package as a guide

@tjayrush
Copy link
Contributor

From an accounting point of view you definitely want the block before the time stamp. If I ask for January 1, I want the block exactly then or before. You want transactions that were fully completed in the period.

@AskAlexSharov
Copy link
Collaborator

Do we wanna use blocksLRU for this blocks?

@enriavil1 enriavil1 marked this pull request as ready for review February 17, 2022 18:51
@AskAlexSharov
Copy link
Collaborator

@enriavil1 hi. Is it possible to use sort.Search here?

@enriavil1
Copy link
Contributor Author

@enriavil1 hi. Is it possible to use sort.Search here?

@AskAlexSharov I believe sort.Search should work identically to the one I had written.

@AlexeyAkhunov AlexeyAkhunov merged commit d12560f into devel Feb 20, 2022
@AlexeyAkhunov AlexeyAkhunov deleted the getBlockByTimeStamp branch February 20, 2022 10:45
enriavil1 added a commit that referenced this pull request Feb 24, 2022
* initial

* binary search through blocks

* snapshot

* returning highest block

* oldest block is now 0

* multiple test written for  getBlockByTimeStamp

* retrieved picked block time stamp

* added into erigon_api

* returning pointer

* reverting c37b99b

* deleted print

* proper rpc block response

* fixing test

* returning lowest block

* lint

* typo

* fixed test

* returning lowest-1

* skip while loop for times too big or small

* added to readme

* using sort.Search
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants