From: merge-script Date: Fri, 24 Apr 2026 06:23:36 +0000 (+0000) Subject: Merge bitcoindevkit/bdk#2167: fix(bitcoind_rpc): emit invalidated heights when start_... X-Git-Url: http://internal-gitweb-vhost/parse/wallet/error/trait.SerializeStruct.html?a=commitdiff_plain;p=bdk Merge bitcoindevkit/bdk#2167: fix(bitcoind_rpc): emit invalidated heights when start_height is above agreement point 76b653007d63803a33668dcd51f23085b71c3911 fix(bitcoind_rpc): emit invalidated heights when start_height is above agreement point (志宇) Pull request description: ### Description When a reorg drops the agreement point below `start_height`, the emitter would skip directly to `start_height`, producing a checkpoint that could not connect with the caller's local chain (`CannotConnectError`). This affects callers that create a new `Emitter` on each sync with `start_height = tip_height` — a common pattern. **Fix:** Override `start_height` to the agreement height when a reorg is detected (agreement point below both `start_height` and `last_cp`), so the emitter revisits the invalidated block heights. Context: https://discord.com/channels/753336465005608961/753367451319926827/1489544612094808235 cc @stevenroose ### Notes to the reviewers The key change is in `poll()` in `crates/bitcoind_rpc/src/lib.rs`: when `AgreementFound` is handled and the agreement point is below both `start_height` and `last_cp.height()`, we lower `start_height` to the agreement height. This ensures the emitter emits the invalidated blocks instead of skipping over them. ### Changelog notice ```md Fixed: - `Emitter` producing un-connectable checkpoints when `start_height` is above the agreement point after a reorg. ``` ### Checklists #### All Submissions: * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) #### Bugfixes: * [ ] This pull request breaks the existing API * [x] I've added tests to reproduce the issue which are now passing * [x] I'm linking the issue being fixed by this PR ACKs for top commit: luisschwab: ACK 76b653007d63803a33668dcd51f23085b71c3911 Tree-SHA512: ec9c382e8619b56284ee8ac934e5934dab3b067c0f33f79f4aa3b1a8877750093a6aeff939fe51add73dd1f71d4ce786af57a905730c150b3c112ac62ff210a8 --- 646661fa3d19ac6f2bd7bef58b321372b795433c