]> Untitled Git - bdk/commit
fix(chain): fix off-by-one in replenish_inner_index stop bound
authorbusayo-OD <toyinoluwabusayo@gmail.com>
Thu, 10 Sep 2026 22:41:23 +0000 (23:41 +0100)
committerbusayo-OD <toyinoluwabusayo@gmail.com>
Thu, 10 Sep 2026 22:41:23 +0000 (23:41 +0100)
commitde43ac6941bd7196f1421bac3646e5dafea83290
treed7c4587ed9fd63017b6b833847c9dc4a14838910
parent803fd968d7999bda911eb2b968cd54a585fac8b4
fix(chain): fix off-by-one in replenish_inner_index stop bound

replenish_inner_index clamped stop_index (an exclusive bound) to
BIP32_MAX_INDEX, excluding the boundary itself and causing a panic
when a keychain's index was revealed exactly up to BIP32_MAX_INDEX.
The addition feeding into that clamp was also unchecked, risking
overflow if lookahead was large relative to an already-high
last_revealed.

Use saturating_add throughout, clamping to BIP32_MAX_INDEX + 1 so
the boundary value is included as documented.
crates/chain/src/indexer/keychain_txout.rs