-
Notifications
You must be signed in to change notification settings - Fork 68
Allow to retrieve a block header by hash #17
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
Allow to retrieve a block header by hash #17
Conversation
f49cc93 to
c13d0a6
Compare
Pull Request Test Coverage Report for Build 3228020364Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
| } | ||
|
|
||
| /// Get a [`BlockHeader`] given a particular block height. | ||
| pub fn get_header(&self, block_height: u32) -> Result<BlockHeader, Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we should rename it to get_header_by_height. Also, it's rather unfortunate that this is reliant on two consecutive calls, which might be race-y and take longer than the user expects. Maybe we could just scrap this and rather align the interface more with the actual Esplora API, i.e., letting the user implement this on its own?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on removing it. If anything, an API for getting a header by block_height should be implemented by Esplora, the library should just reflect what the Esplora API offers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree get_header should be removed since it doesn't reflect an existing Esplora API. But since we have at least one user (bdk) can you just deprecate it for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deprecated with 68b9d2b.
|
Overall looks good to me, but for the new functions would be good to have at least some simple tests added in lib.rs. |
c13d0a6 to
e010611
Compare
Added a simple test case for |
e010611 to
995aa79
Compare
This deprecates `get_height` to improve alignment with the Esplora API.
995aa79 to
92606cc
Compare
|
Rebased on master after #13 landed. |
3a93ee5 Fix deprecation version of `get_header` (Elias Rohrer) Pull request description: In #17, we deprecated `get_header` and assumed the next version would be 0.1.2, but it turned out to be 0.2. Top commit has no ACKs. Tree-SHA512: 2b552730054def1dde12358527ef4c84fc225fe3359b41315318952162c8a28065620259212000bcd28364204f26b21f0e3586d5d231b11bf175db4954b813f7
… header by hash 92606cc6af93a0a2aae133d8e9d4392b78f1c5e1 Test `get_header_by_hash` rather than `get_height` (Elias Rohrer) 6673912c08ac5786c2f99641df6a9b1a7b5dbcac Deprecate `get_height` (Elias Rohrer) 9e233efa152382af66bfa936b1a790175d743911 Allow to retrieve a block header by hash (Elias Rohrer) Pull request description: ~~Based on #13 since it probably land soon.~~ This PR adds a method allowing to retrieve a `BlockHeader` via a given `BlockHash` and reuses it in `get_height`. Top commit has no ACKs. Tree-SHA512: 2be894f7e745e317b02512183e073806e90145cbde9ad89f10e5782d6bc302da6d72adb0cef0fce7cd746e4f7b93fba0844a640bc30457ccafbcf19dd5673254
Based on #13 since it probably land soon.This PR adds a method allowing to retrieve a
BlockHeadervia a givenBlockHashand reuses it inget_height.