* Instead of implementing `ChainPosition` for `ObservedIn<BlockId>` to
use `FullTxOut` methods (`is_spendable_at` and `is_mature`), we create
alternative versions of those methods that require bounds with `Anchor`.
This removes all `ObservedIn<A>: ChainPosition` bounds for methods of
`IndexedTxGraph`.
* Various improvements to comments and names.
Introduce `chain_oracle::Cache` which is a cache for requests to the
chain oracle. `ChainOracle` has also been moved to the `chain_oracle`
module.
Introduce `get_tip_in_best_chain` method to the `ChainOracle` trait.
This allows for guaranteeing that chain state can be consistent across
operations with `IndexedTxGraph`.
When constructing the `Condition` struct we recursively call
`get_condition` on all the items in a threshold and short-circuit if
there's an error somewhere (for example, because the policy-path hasn't
been provided for a specific threshold).
This can cause issues when the user doesn't care about a subtree, because
we still try to call `get_condition` on all the items and fail if
something is missing, even if the specific subtree isn't selected and
won't be used later on.
This commit changes the logic so that we first filter only the `selected`
items, and then unwrap the error using the question mark. If errors
happened somewhere else they will be ignored, as it should.
Methods of old structures that return transaction(s) no longer return
`TxNode`, but `Transaction` as done previously.
`TxInGraph` is renamed to `TxNode`, while the internal `TxNode` is
renamed to `TxNodeInternal`.
Methods that list chain data have try and non-try versions. Both of
these versions now return an `Iterator`.
* Try versions return `Iterator<Item = Result>`.
* Non-try versions require the `ChainOracle` implementation to be
`ChainOracle<Error = Infallible>`.
The chain oracle keeps track of the best chain, while the transaction
index indexes transaction data in relation to script pubkeys.
This commit also includes initial work on `IndexedTxGraph`.
* Introduce `GraphedTx` struct to access transaction data of graphed
transactions.
* Ability to insert/access anchors and "seen at" values for graphed
transactions.
* `Additions` now records changes to anchors and last_seen_at.
Fixes include:
* Allow `bdk_esplora` to use async with tls
* Reorganize `bdk_esplora` crate to have separate files for
async vs blocking
* Use optional dependencies for `bdk_esplora` async
Creates a separate async EsploraAsyncExt trait for the
async client using async-trait crate. It has thesame
methods as the EsploraExt trait for the blocking client.
This trait is implemented on the AsyncClient of the
rust-esplora-client crate.
As mentioned by @LLFourn:
1. We have a "sparse chain" from which there is a subset of txids M that are missing from graph.
2. There is also another subset C that are in the graph but their positions have changed.
3. We used the Cow to avoid copying/duplicating in memory transactions in subset C and M
Instead in inflate_update we could remove transactions in subset M and just clone data in subset C (which is usually tiny).