8 Commits

Author SHA1 Message Date
志宇
8305e64849
feat(chain): expose SpkIterator::new_with_range
Also update docs and add tests
2024-01-23 13:01:45 +08:00
志宇
81aeaba48a
feat(chain): add SpkIterator::descriptor method
Otherwise there will be no way to view the descriptor of the
`SpkIterator`.
2024-01-17 11:17:25 +08:00
Antoine Poinsot
4fd539b647
feat(chain)!: KeychainTxOutIndex uses a universal lookahead
The wallet is currently created without setting any lookahead value for
the keychain. This implicitly makes it a lookahead of 0. As this is a
high-level interface we should avoid footguns and aim for a reasonable
default.

Instead of simply patching it for wallet, we alter `KeychainTxOutIndex`
to have a default lookahead value. Additionally, instead of a
per-keychain lookahead, the constructor asks for a `lookahead` value.
This avoids the footguns of having methods which allows the caller the
decrease the `lookahead` (and therefore panicing). This also simplifies
the API.

Co-authored-by: Antoine Poisot <darosior@protonmail.com>
Co-authored-by: 志宇 <hello@evanlinjin.me>
2023-12-28 12:51:11 +08:00
Daniela Brozzoni
e48b911c8d
refactor: Make test errors more readable 2023-09-01 09:13:33 +02:00
Daniela Brozzoni
a7a1d9b2fb
fix: non-wildcard descriptors should return an..
..spk only if index is equal to 0
2023-09-01 09:12:44 +02:00
Daniela Brozzoni
cc1a43c495
fix: SpkIterator::new_with_range takes wildcards..
..into account

When you pass a non-wildcard descriptor in `new_with_range`, we make
sure that the range length is at most 1; if that's not the case, we
shorten it.
We would previously use `new_with_range` without this check and with a
non-wildcard descriptor in `spks_of_all_keychains`, this meant creating
a spkiterator that would go on producing the same spks over and over
again, causing some issues with syncing on electrum/esplora.

To reproduce the bug, run in `example-crates/example_electrum`:
```
cargo run "sh(wsh(or_d(c:pk_k(cPGudvRLDSgeV4hH9NUofLvYxYBSRjju3cpiXmBg9K8G9k1ikCMp),c:pk_k(cSBSBHRrzqSXFmrBhLkZMzQB9q4P9MnAq92v8d9a5UveBc9sLX32))))#zp9pcfs9" scan
```
2023-08-31 16:48:20 +02:00
Daniela Brozzoni
853d361751
Update bdk_chain to bitcoin 0.30.0 2023-08-03 10:58:59 +02:00
Wei
10fe32e6f1
Implement SpkIterator
SpkIterator was created with its own nth() and next() implementations
and its own new() and new_with_range() constructors.

Co-authored-by: 志宇 <hello@evanlinjin.me>
2023-05-02 17:31:40 +08:00