Closed tnull closed 2 years ago
@tnull , is it not better to have a method for getting the block hash given a particular block height? I think it will provide a more general API. This is what we currently do here: https://github.com/bitcoindevkit/bdk/blob/master/src/blockchain/esplora/reqwest.rs#L121
@tnull , is it not better to have a method for getting the block hash given a particular block height? I think it will provide a more general API. This is what we currently do here: https://github.com/bitcoindevkit/bdk/blob/master/src/blockchain/esplora/reqwest.rs#L121
Well, we already have that API, but it may have some drawbacks in certain scenarios: as it is currently implemented, it requires to make two requests (one to get current tip height, one to get the hash), and could even be a bit race-y (i.e., when we make the second call, the block height could just have increased so we don't get the tip, but tip-1).
Generally I think EsploraClient
should strive to implement all of Esplora's API methods comprehensively, allowing a user to pick-and-choose what's required. What of these methods then should be used by/exposed through BDK is a different discussion.
This PR adds support for getting the
BlockHash
of the current blockchain tip.While this is currently not strictly necessary for LDK integration, it might be nice to have in the future.