]> Untitled Git - bdk/commit
Merge bitcoindevkit/bdk#2335: fix(chain): reject an occupied index in insert_spk master github/master
authormerge-script <hello@evanlinjin.me>
Sun, 18 Oct 2026 09:32:32 +0000 (20:32 +1100)
committermerge-script <hello@evanlinjin.me>
Sun, 18 Oct 2026 09:32:32 +0000 (20:32 +1100)
commit7f7f653b760f083b98beb94a5aaaa047f2c0288c
tree31e7bef6751010eb0fa5f7568c1a46cec6b0a73b
parent09eda874e3393c6abde21a42e41929306e643e4a
parentee1909efdbe53261e268819cf7d1cd9260a03df0
Merge bitcoindevkit/bdk#2335: fix(chain): reject an occupied index in insert_spk

ee1909efdbe53261e268819cf7d1cd9260a03df0 fix(chain): reject an occupied index in insert_spk (hassan)

Pull request description:

  ### Description

  Fixes #2279.

  SpkTxOutIndex::insert_spk currently accepts a different script at an existing index. The forward lookup is overwritten while the old reverse lookup remains, so the two maps disagree.

  This returns false without changing state when the index is already occupied, matching the existing behavior for an occupied script. The method documentation now covers both cases.

  ### Notes to the reviewers

  Added regressions for both lookup directions, unused scripts and previously scanned outputs. A rejected insertion preserves the old output and used status, and the rejected script is not tracked.

  Testing on the refreshed master base:
  - Rust 1.85: bdk_chain with all features, 99 tests/doctests pass, 1 ignored.
  - Changed-crate clippy with all targets and features passes with warnings denied.
  - Workspace formatting check passes.
  - Full workspace pre-push suite has not been rerun on this base.

  ### Changelog notice

  Reject duplicate indices in SpkTxOutIndex::insert_spk without changing existing script or output state.

ACKs for top commit:
  evanlinjin:
    ACK ee1909efdbe53261e268819cf7d1cd9260a03df0

Tree-SHA512: 21c1220dabc4c36cc8161eeb7f8b0284baac6c575b64aac5802dfec04416dbdf964f672b0aad36f3cfe53271709c9f698ba644c3f018bb149848866896e7c43f