cf0c3337446b1de19ad6be9e68f5a9cb848d5773 doc(electrum_ext): fix docs for `RelevantTxids::into_confirmation_time_tx_graph` (vmammal)
Pull request description:
Note also, the bit referring to Electrum's API sounds more like a developer note, so I made it a regular code comment.
### Checklists
#### All Submissions:
* [x] I've signed all my commits
* [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
* [x] I ran `cargo fmt` and `cargo clippy` before committing
ACKs for top commit:
danielabrozzoni:
ACK cf0c3337446b1de19ad6be9e68f5a9cb848d5773
Tree-SHA512: 0ebd6a753c8a0c573510a4d866068cb6e1c7e356c43b20b5179331a1b7d567e4dfbf7012c63ba9b7b9566bf6564a2d957d12e54d5c0232b7be9869dfe0958e85
Previously `SpkTxOutIndex` methods can be called from
`KeychainTxOutIndex` due to the `DeRef` implementation. However, the
internal `SpkTxOut` will also contain lookahead spks resulting in an
error-prone API.
`SpkTxOutIndex` methods are now not directly callable from
`KeychainTxOutIndex`. Methods of `KeychainTxOutIndex` are renamed for
clarity. I.e. methods that return an unbounded spk iter are prefixed
with `unbounded`.
0112c67b6031b55a6c73f797db52d64a1b4ee38a chore: rename `ConfirmationTimeAnchor` to `ConfirmationTimeHeightAnchor` (Wei Chen)
Pull request description:
### Description
Closes#1187.
An `Anchor` implementation that records both height and time should have both attributes included in the name.
### Checklists
#### All Submissions:
* [x] I've signed all my commits
* [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
* [x] I ran `cargo fmt` and `cargo clippy` before committing
ACKs for top commit:
notmandatory:
ACK 0112c67b6031b55a6c73f797db52d64a1b4ee38a
Tree-SHA512: 024cbc83c8aca36baeaf2ce36979d62f235ffea7702e7ac8d4e7669cbc1730f7e1469ba78bf3da6c5a14abedbf1a9e832bdd66fdaa154ad2bef29cb187e1c504
Fixed a logic error in `construct_update_tip` in `electrum_ext.rs` that caused
the local chain tip to always be a block behind the newest confirmed block.
We remove `ElectrumUpdate` and return tuples instead for `ElectrumExt`
methods. We introduce the `IncompleteTxGraph` structure to specifically
hodl the incomplete `TxGraph`.
This change is motivated by @LLFourn's comment: 794bf37e63 (r1305432603)
Thank you @vladimirfomene for these suggestions.
* Rename `LocalUpdate::keychain` to `LocalUpdate::last_active_indices`.
* Change docs for `CheckPoint` to be more descriptive.
* Fix incorrect logic in `update_local_chain` for `EsploraExt` and
`EsploraAsyncExt`.
This commit changes the `LocalChain` implementation to have blocks
stored as a linked-list. This allows the data-src thread to hold a
shared ref to a single checkpoint and have access to the whole history
of checkpoints without cloning or keeping a lock on `LocalChain`.
The APIs of `bdk::Wallet`, `esplora` and `electrum` are also updated to
reflect these changes. Note that the `esplora` crate is rewritten to
anchor txs in the confirmation block (using the esplora API's tx status
block_hash). This guarantees 100% consistency between anchor blocks and
their transactions (instead of anchoring txs to the latest tip).
`ExploraExt` now has separate methods for updating the `TxGraph` and
`LocalChain`.
A new method `TxGraph::missing_blocks` is introduced for finding
"floating anchors" of a `TxGraph` update (given a chain).
Additional changes:
* `test_local_chain.rs` is refactored to make test cases easier to
write. Additional tests are also added.
* Examples are updated.
* Fix `tempfile` dev dependency of `bdk_file_store` to work with MSRV
Co-authored-by: LLFourn <lloyd.fourn@gmail.com>
Other changes:
* The `async-https` feature of `bdk_esplora` is no longer default.
* Rename `ObservedAs` to `ChainPosition`.
* Set temporary MSRV to 1.60.0 to compile all workspace members will all
features.
* `ElectrumUpdate::missing_full_txs` now returns a `Vec<Txid>` so we
don't keep a reference to the passed-in `graph`.
* `ElectrumUpdate::finalize*` methods now takes in `missing` txids
instead of `full_txs`. `Client::batch_transaction_get` is called
within the methods.
Other changes:
* `wallet::ChangeSet` is now made public externally. This is required as
a wallet db should implement `PersistBackend<wallet::ChangeSet>`.
There are a number of improvements that can be done, but it is in a
decent state to be usable.
Possible improvements:
* Remove requirement to retry obtaining ALL data after reorg is
detected. Transactions can be anchored to a lower block (not block
tip), and an `assume_final_depth` value can be used.
* The logic to finalize an update with confirmation time can be improved
during reorgs to not require returning an error.
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).