]> Untitled Git - bdk/commit
fix(chain): fix integer overflow in lookahead_to_target
authorbusayo-OD <toyinoluwabusayo@gmail.com>
Thu, 10 Sep 2026 22:42:56 +0000 (23:42 +0100)
committerbusayo-OD <toyinoluwabusayo@gmail.com>
Thu, 10 Sep 2026 22:42:56 +0000 (23:42 +0100)
commit1ca8d29854d41269982a1f47b03603a98a221d99
tree6f05e1d3447144436ec19a302404881c90a7baad
parentde43ac6941bd7196f1421bac3646e5dafea83290
fix(chain): fix integer overflow in lookahead_to_target

lookahead_to_target treated an out-of-range target_index as a
silent no-op, which is wrong — it should clamp to BIP32_MAX_INDEX
and replenish up to that point, matching reveal_to_target's
best-effort semantics.

Use saturating_add/saturating_sub, which no longer needs checked
arithmetic since replenish_inner_index's stop_index now clamps
correctly on its own.
crates/chain/src/indexer/keychain_txout.rs