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

feat: btclightclient: Abstract the usage of btcd types and store BTCHeaderInfo objects #58

Merged
merged 7 commits into from
Jul 11, 2022

Conversation

vitsalis
Copy link
Member

@vitsalis vitsalis commented Jul 11, 2022

This PR resolves #57.

It aims to remove the usage of *wire.BlockHeader and *chainhash.Hash objects throughout the codebase and restrict their usage towards only internal type calls. It also includes some minor fixes for queries and optimizations.

Considered converting the height into an sdk.Uint, but I believe that the extra complexity defeats the purpose. More specifically, if you look at the types provided by sdk.Uint (used by the work attribute), it does not have a MustMarshal method, addition or comparison is more complex (instead of operators there are functions) etc. The work attribute needs to have the sdk.Uint type due to it corresponding to a *big.Int instance.

@vitsalis vitsalis requested a review from aakoshh July 11, 2022 14:59
@vitsalis vitsalis marked this pull request as ready for review July 11, 2022 14:59
Copy link
Contributor

@aakoshh aakoshh left a comment

Choose a reason for hiding this comment

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

Bravo, much easier to grasp this way!

@vitsalis vitsalis merged commit fd02a3e into main Jul 11, 2022
@vitsalis vitsalis deleted the btclightclient-storage-refactor branch July 11, 2022 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

btclightclient: Store BTCHeaderInfo objects instead of BTCHeaderBytes objects
2 participants