]> Untitled Git - bdk/commit
Merge bitcoindevkit/bdk#1601: fix(core): calling `CheckPoint::insert` with existing...
authorSteve Myers <steve@notmandatory.org>
Thu, 12 Sep 2024 21:11:37 +0000 (16:11 -0500)
committerSteve Myers <steve@notmandatory.org>
Thu, 12 Sep 2024 21:12:33 +0000 (16:12 -0500)
commit6d610bf495311af3454a56cbbf38edde3fcee037
tree9715f250eba33953c532ad7d99222891af0acac4
parent1b50d88e4f76d466de99619b8b6be758b70b2011
parent3ae9ecba8c893750fa2ed5dfdbb1f4ee84a0b228
Merge bitcoindevkit/bdk#1601: fix(core): calling `CheckPoint::insert` with existing block must succeed

3ae9ecba8c893750fa2ed5dfdbb1f4ee84a0b228 test: fix off-by-one in `checkpoint_insert_existing` (valued mammal)
e6aeaea0c69472e4c2dcf0f5e2f632f43733529d doc(core): document panic for `CheckPoint::insert` (valued mammal)
2970b83f30ca7071f0502de395327eb3671a512b fix(core): calling `CheckPoint::insert` with existing block must succeed (志宇)

Pull request description:

  ### Description

  Previously, we were panicking when the caller tried to insert a block at height 0. However, this should succeed if the block hash does not change.

  ### Notes to the reviewers

  For context:

  * https://github.com/lightningdevkit/ldk-node/pull/358
  * https://discord.com/channels/753336465005608961/978744259693916230/1283050849429356629

  ### Changelog notice

  * Fix `CheckPoint::insert` to not panic when inserting existing genesis block (same block height and hash).

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

  #### Bugfixes:

  ~~* [ ] This pull request breaks the existing API~~
  * [x] I've added tests to reproduce the issue which are now passing

ACKs for top commit:
  ValuedMammal:
    Self ACK 3ae9ecba8c893750fa2ed5dfdbb1f4ee84a0b228
  notmandatory:
    ACK 3ae9ecba8c893750fa2ed5dfdbb1f4ee84a0b228

Tree-SHA512: 638d8aacac59ad18b5ee369d08f39bb12cc37fa9b3f936404b60dbf44938ef850ca341d00566840b5a77909d31c9291ab56299d986d832005ca96cd91a0b0e55
crates/core/src/checkpoint.rs