Commit f47cb0b
committed
Merge #2174: fix(chain): prevent
be8e156 fix(chain): prevent `merge_chains` from replacing the genesis block (Elias Rohrer)
Pull request description:
### Description
Other code paths (`disconnect_from`, `CheckPoint::insert`) already protect height 0 from modification, but `merge_chains` allowed an update chain with a different genesis hash to silently replace the wallet's existing genesis block. Return `CannotConnectError` when the update attempts to change the block hash at height 0.
Co-Authored-By: HAL 9000
### 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
* [ ] I'm linking the issue being fixed by this PR
ACKs for top commit:
ValuedMammal:
ACK be8e156
evanlinjin:
ACK be8e156
Tree-SHA512: 743c95f281faf39f7f825693e684ad96a70b2994a6186721a68eacd0c3d4488092883e6dfe3b349e5241fc9a85a02dad222da7e932a50be5324df69d73cbb4a6merge_chains from replacing the genesis block2 files changed
Lines changed: 22 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
648 | 648 | | |
649 | 649 | | |
650 | 650 | | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
651 | 657 | | |
652 | 658 | | |
653 | 659 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
174 | | - | |
175 | | - | |
| 174 | + | |
| 175 | + | |
176 | 176 | | |
177 | | - | |
178 | | - | |
| 177 | + | |
| 178 | + | |
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
318 | 330 | | |
319 | 331 | | |
320 | 332 | | |
| |||
0 commit comments