62767f0702e6497d08fea702b747fd6e7fa72b8c fix(rusqlite_impl): Fix derived spks create table statement (valued mammal)
603f133d9adf0e933c270c40b0f5284eca7c5722 docs(chain): Adds docs for persisting spks in `KeychainTxOutIndex` (志宇)
3126cd214536db6c9636f4e7b6b92019fcee535e feat(chain)!: Clean up ergonomics of `IndexedTxGraph` (志宇)
a0555817136e4ef5a36272cb311123e0bce54657 feat(chain): `KeychainTxOutIndex`: Make spk cache optional (志宇)
19e3b5df1b25d206c3b1eecefd7befc783dce127 feat(chain): Add `KeychainTxOutIndex::from_changeset` constructor (志宇)
d761265af0586b4425c8f0ee4515e8b9f3fff247 feat(chain): `KeychainTxOutIndex`: Debug build checks (志宇)
76875e7a4ea36ed5ae4b5ae211068111d3f28813 fix(chain)!: API and logical issues in `KeychainTxOutIndex` (志宇)
d299daea4278f9c63fcf57ae7b7079c0b6f7ebc4 feat(chain)!: Persist spks derived from `KeychainTxOutIndex` (志宇)
Pull request description:
Replaces #1960
Fixes #1964
### Description
Users with large wallet and/or complex descriptors may experience slow startup of `KeychainTxOutIndex`. This PR addresses this problem by providing the option to persist derived spks so that they no longer need to be re-derived on startup.
The `IndexedTxGraph` API has been changed for better ergonomics.
Compared to #1960, this is a more longterm solution that does not depend on multi-threading logic.
### Changelog notice
```md
Changed
- `KeychainTxOutIndex::new` to take in an additional parameter `persist_spks` to control whether derived spks are cached and persisted across restarts. The default of `persist_spks` is false.
- `KeychainTxOutIndex` methods (`lookahead_to_target, `next_unused_spk`, `reveal_next_spk`) now return changesets as they may derive spks to be persisted.
- The `InsertDescriptorError` type now wraps descriptors in `Box` to reduce enum size.
Added
- `spk_cache` field to `indexer::keychain_txout::ChangeSet` which persists derived spks.
- `IndexedTxGraph::from_changeset` - allows constructing from `indexed_tx_graph::ChangeSet` and only indexing when ready.
- `IndexedTxGraph::reindex` method.
Fixed
- `KeychainTxOutIndex::reveal_to_target` so that it actually returns `None` if the `keychain` does not exist.
```
### 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 +nightly fmt` and `cargo clippy` before committing
#### New Features:
* [ ] I've added tests for the new feature
* [x] I've added docs for the new feature
ACKs for top commit:
ValuedMammal:
ACK
62767f0702e6497d08fea702b747fd6e7fa72b8c
notmandatory:
ACK
62767f0702e6497d08fea702b747fd6e7fa72b8c
Tree-SHA512: dc1aa4308ffcc6d121e0d7a1ca4ff9f641ed5db63204747fde47ac02e45dae9b65da95554541705a98b69e59f741c043485a26db736966417061a4c9d220ba29