]> Untitled Git - bdk/commit
feat(chain)!: `KeychainTxOutIndex` uses a universal lookahead
authorAntoine Poinsot <darosior@protonmail.com>
Tue, 28 Nov 2023 17:08:49 +0000 (18:08 +0100)
committer志宇 <hello@evanlinjin.me>
Thu, 28 Dec 2023 04:51:11 +0000 (12:51 +0800)
commit4fd539b6470f7f771e3b5e09e3287952fa7a1825
treed44a4bf17e5f65a959147930b5e4cad477c24386
parent01698ae5ec1102b02271fac83968341984eb6060
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>
crates/chain/src/keychain/txout_index.rs
crates/chain/src/spk_iter.rs
crates/chain/tests/test_indexed_tx_graph.rs
crates/chain/tests/test_keychain_txout_index.rs
example-crates/example_bitcoind_rpc_polling/src/main.rs