]> Untitled Git - bdk/commit
fix(chain): prevent `merge_chains` from replacing the genesis block
authorElias Rohrer <dev@tnull.de>
Wed, 15 Apr 2026 12:41:54 +0000 (14:41 +0200)
committerElias Rohrer <dev@tnull.de>
Tue, 21 Apr 2026 09:07:35 +0000 (11:07 +0200)
commitbe8e156115e21750158d44394341f1d41dfbf90f
tree543d0e0de75394b2e440db36f2639b4e69bca9ee
parentf07423a7bab932035113bd14c4ad82017dcd4096
fix(chain): prevent `merge_chains` from replacing the genesis block

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
Signed-off-by: Elias Rohrer <dev@tnull.de>
crates/chain/src/local_chain.rs
crates/chain/tests/test_local_chain.rs