You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge #1963: Persist spks derived from KeychainTxOutIndex
62767f0 fix(rusqlite_impl): Fix derived spks create table statement (valued mammal)
603f133 docs(chain): Adds docs for persisting spks in `KeychainTxOutIndex` (志宇)
3126cd2 feat(chain)!: Clean up ergonomics of `IndexedTxGraph` (志宇)
a055581 feat(chain): `KeychainTxOutIndex`: Make spk cache optional (志宇)
19e3b5d feat(chain): Add `KeychainTxOutIndex::from_changeset` constructor (志宇)
d761265 feat(chain): `KeychainTxOutIndex`: Debug build checks (志宇)
76875e7 fix(chain)!: API and logical issues in `KeychainTxOutIndex` (志宇)
d299dae feat(chain)!: Persist spks derived from `KeychainTxOutIndex` (志宇)
Pull request description:
Replaces #1960Fixes#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 62767f0
notmandatory:
ACK 62767f0
Tree-SHA512: dc1aa4308ffcc6d121e0d7a1ca4ff9f641ed5db63204747fde47ac02e45dae9b65da95554541705a98b69e59f741c043485a26db736966417061a4c9d220ba29
0 commit comments