Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

LagginTimes
Copy link
Contributor

@LagginTimes LagginTimes commented Aug 29, 2024

Implements #1757.

Description

This PR is a step towards header checkpointing for bdk_electrum. The goal is to be able to store whole headers in CheckPoint 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:

  • Change CheckPoint to take in a generic.
  • Change LocalChange to take in a generic.
  • Change spk_client types to take in generics.

Notes to the reviewers

Changelog notice

  • CheckPoint takes in a generic.
  • LocalChain and ChangeSet take in generics.
  • spk_client types can take in generics.

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

@LagginTimes LagginTimes marked this pull request as draft August 29, 2024 09:59
@LagginTimes LagginTimes changed the title refactor(core): CheckPoint takes a generic refactor(core): Implement generics for CheckPoint and LocalChain Aug 29, 2024
@LagginTimes LagginTimes force-pushed the generic_checkpoint branch 3 times, most recently from a899049 to 7c13781 Compare September 2, 2024 02:53
crates/core/src/checkpoint.rs Outdated Show resolved Hide resolved
crates/core/src/checkpoint.rs Outdated Show resolved Hide resolved
@LagginTimes LagginTimes force-pushed the generic_checkpoint branch 2 times, most recently from ea1cf8b to bf90ea5 Compare September 3, 2024 06:15
@LagginTimes LagginTimes force-pushed the generic_checkpoint branch 5 times, most recently from c278804 to 6300d7c Compare September 5, 2024 03:43
@LagginTimes LagginTimes changed the title refactor(core): Implement generics for CheckPoint and LocalChain refactor(core): Implement generics for CheckPoint, LocalChain, and spk_client types Sep 5, 2024
@LagginTimes LagginTimes force-pushed the generic_checkpoint branch 5 times, most recently from 7ef16f5 to b7c5a9a Compare September 10, 2024 15:42
@LagginTimes LagginTimes changed the title refactor(core): Implement generics for CheckPoint, LocalChain, and spk_client types refactor: Implement generics for CheckPoint, LocalChain, and spk_client types Sep 10, 2024
@LagginTimes LagginTimes force-pushed the generic_checkpoint branch 2 times, most recently from 5f2d199 to 6b3ffa9 Compare November 30, 2024 14:03
@LagginTimes LagginTimes marked this pull request as ready for review December 3, 2024 11:57
@evanlinjin evanlinjin added this to the 1.1.0 milestone Dec 3, 2024
@notmandatory notmandatory added new feature New feature or request module-blockchain labels Dec 6, 2024
/// If `header` is of the genesis block, the checkpoint won't have a `prev` node. Otherwise,
/// we return a checkpoint linked with the previous block.
#[deprecated(
since = "0.1.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Is this version correct ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out! The version number for bdk_core has been updated since this PR was created. This will need to be updated as well.

/// The effect of `insert` depends on whether a height already exists. If it doesn't the
/// `block_id` we inserted and all pre-existing blocks higher than it will be re-inserted after
/// it. If the height already existed and has a conflicting block hash then it will be purged
/// along with all block followin it. The returned chain will have a tip of the `block_id`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// along with all block followin it. The returned chain will have a tip of the `block_id`
/// along with all blocks following it. The returned chain will have a tip of the `block_id`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module-blockchain new feature New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

4 participants