refactor!: Implement generics for CheckPoint, LocalChain, and spk_client types#1582
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 LocalChainCheckPoint, LocalChain, and spk_client types
6300d7c to
315f687
Compare
8906806 to
0a39fa7
Compare
There was a problem hiding this comment.
ACK 0a39fa7 pending a CI fix.
I left comments mostly for discussion. Also there was a comment #1582 (review) suggesting to use B instead of D. I don't have much preference though.
|
I haven't done a deep review but I support merging this now that we're done with the |
0a39fa7 to
d4bd7e5
Compare
There was a problem hiding this comment.
utACK d4bd7e5
The code looks good to me, I only left a minor question and nit. I didn't test it on a complicated example yet.
|
ACK 4dce5ad |
notmandatory
left a comment
There was a problem hiding this comment.
utACK 4dce5ad
I also re-read through the whole history and this one has certainly been a journey so thanks to @LagginTimes and all the reviewers for sticking with it.
I look forward to the followup PRs to integrate chain client specific data in the checkpoints. I expect custom data will break existing persistence so being able to persist the data in a generic way and having a good persistence test suite such as #2012 will be handy.
|
Looking back through the codebase, I noticed that we've introduced a condition that wasn't there before, and I’m wondering about the best way to handle it. Since a One idea is to modify pub trait ToBlockHash {
/* OTHER METHODS */
/// Returns `None` if the type has no knowledge of the previous blockhash.
fn prev_blockhash(&self) -> Option<BlockHash>;
}Then we need to modify
|
Yes in principle I agree with this if the update is strictly extending the parent chain by the next consecutive block. If the type doesn't know the previous hash, like in the case of |
|
I've started experimenting with my suggestion in #1582 (comment). This is the WIP commit: evanlinjin@8f374cc. I'm quite happy with the implementation of it (unless proven otherwise). What is missing:
Feel free to continue this work as you see fit. I'm wondering if we should merge this PR as is, and introduce "ghost-checkpoint"s in a separate PR? |
I think it makes sense to merge #1582 as it is now. The additional work around ghost-checkpoints, backref checks, and more docs/tests can be done in a follow-up PR to keep the scope focused and avoid resetting review. I would be happy to continue the work in a follow-up PR. |
|
@LagginTimes I'll be happy with that. Do we have a plan for back-porting the non-merged chain-source fixes (#2005, #2011, #2000)? Note that the |
For this I would look at things we already have such as |
4dce5ad to
b93dcd6
Compare
b93dcd6 to
8bc2391
Compare
Implements #1937.
Description
This PR is a step towards header checkpointing for
bdk_electrum. The goal is to be able to store whole headers inCheckPointso 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.Notes to the reviewers
Changelog notice
CheckPointtakes in a generic.LocalChainandChangeSettake in generics.spk_clienttypes can take in generics.Checklists
All Submissions:
cargo fmtandcargo clippybefore committing