-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Implement generics for CheckPoint
, LocalChain
, and spk_client
types
#1582
base: master
Are you sure you want to change the base?
Conversation
CheckPoint
takes a genericCheckPoint
and LocalChain
a899049
to
7c13781
Compare
7c13781
to
d934a6c
Compare
ea1cf8b
to
bf90ea5
Compare
c278804
to
6300d7c
Compare
CheckPoint
and LocalChain
CheckPoint
, LocalChain
, and spk_client
types
6300d7c
to
315f687
Compare
7ef16f5
to
b7c5a9a
Compare
CheckPoint
, LocalChain
, and spk_client
typesCheckPoint
, LocalChain
, and spk_client
types
5f2d199
to
6b3ffa9
Compare
6b3ffa9
to
367099a
Compare
367099a
to
27fe3bb
Compare
27fe3bb
to
179ec5e
Compare
struct CPInner<B> { | ||
/// Block data. | ||
block_id: BlockId, | ||
/// Data. | ||
data: B, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When B
is a blockhash, won't this be storing the same block hash twice? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on this. Maybe data: Option<B>
or just keep the height as part of CPInner
?
struct CPInner<B> {
height: u32,
data: B,
prev: Option<Arc<CPinner<B>>>,
}
fn eq(&self, other: &Self) -> bool { | ||
let self_cps = self.iter().map(|cp| cp.block_id()); | ||
let other_cps = other.iter().map(|cp| cp.block_id()); | ||
let self_cps = self.iter().map(|cp| cp.0.block_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, Is there any reason to prefer the field access over the method call?
Implements #1757.
Description
This PR is a step towards header checkpointing for
bdk_electrum
. The goal is to be able to store whole headers inCheckPoint
so they do not have to be re-downloaded. Storing headers this way would be a prerequisite for caching of merkle proofs and for median time passed.TODO:
CheckPoint
to take in a generic.LocalChange
to take in a generic.spk_client
types to take in generics.Notes to the reviewers
Changelog notice
CheckPoint
takes in a generic.LocalChain
andChangeSet
take in generics.spk_client
types can take in generics.Checklists
All Submissions:
cargo fmt
andcargo clippy
before committing