|
Ran
|
Files
29
|
Run time
1s
|
Badge
README BADGES
|
push
github
Merge bitcoindevkit/bdk#2167: fix(bitcoind_rpc): emit invalidated heights when start_height is above agreement point <a class=hub.com/bitcoindevkit/bdk/commit/76b653007d63803a33668dcd51f23085b71c3911">76b653007 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: ec9c382e80f33f79f4d... (continued)
418 of 554 branches covered (75.45%)
Branch coverage included in aggregate %.
4441 of 5687 relevant lines covered (78.09%)
3520.58 hits per line
| Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line | Branch Hits | Branch Misses |
|---|