-
Notifications
You must be signed in to change notification settings - Fork 406
Description
Describe the enhancement
#1582 made CheckPoint
s generic so that we can attach Header
s and Block
s to a given CheckPoint
. Since these newly supported data types have prev-blockhashes, this introduced a new invariant: prev-blockhash of the current checkpoint must match the (current_checkpoint_height-1)'s checkpoint's blockhash (if it exists).
Additionally, when merging chains with prev-blockhash data means even if two chain do not have a point-of-agreement, they may be able to connect if a chain's prev-blockhash matches a checkpoint in the other chain.
Proposed Changes:
-
Extend
ToBlockHash
to have knowledge of whether the data contains a prev_blockhash.pub trait ToBlockHash { /* Other method */ fn prev_blockhash(&self) -> Option<BlockHash>; }
-
Modify
CheckPoint
to support having empty data. When a checkpoint with a prev-blockhash is inserted, also insert an empty-data checkpoint at height-1.
Use case
Ensures consistent representation of data.
Impact
We catch problems earlier. Either as the chain-source when they construct the CheckPoint
update, or when trying to apply the update to the receiving structures afterwards.
Are you using BDK in a production project?
- Yes
- No
- Not yet, but planning to
Which backend(s) are relevant (if any)?
Yes, this will affect all chain-source implementations that construct checkpoint updates. This will also affect applying updates as the problem might be caught there.
Project or organization (optional)
I get funded by the BDKF and I also work for Frostsnap.
Additional context
Original comment: #1582 (comment)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status