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

Move Balance out of keychain #1175

Conversation

acerbisgianluca
Copy link
Contributor

Description

Closes #1173. This PR makes Balance available at the top-level of the chain crate.

Changelog notice

All Submissions:

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

Copy link
Member

@evanlinjin evanlinjin left a comment

Choose a reason for hiding this comment

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

Thank you for taking a crack at this! However, we want to move the actual definition of Balance to lib.rs. Currently, you are just doing a re-export.

@acerbisgianluca
Copy link
Contributor Author

Hey @evanlinjin, thanks for your feedback!

I'm new to Rust development, but I see that lib.rs basically contains only modules and re-exports (correct me if I'm wrong obv), so should I move the whole Balance definiton to lib.rs anyway? I think that the issue is about re-exporting it.

@evanlinjin
Copy link
Member

My bad, I see the issue seems to suggest reexporting. However, I don't think Balance belongs in the keychain module at all as it's not keychain-specific?

cc. @danielabrozzoni

@danielabrozzoni
Copy link
Member

Sorry @evanlinjin, I initially thought you meant to just re-export Balance, my issue was wrongly phrased.

I agree with Evan that having Balance inside keychain.rs is weird, as there's no keychain-related method that uses the Balance! (When I created the issue I totally thought that was the case, which shows how little I know about bdk_chain still 😅)

I also agree with @acerbisgianluca that having it inside lib.rs is a bit weird, since it would be the only struct defined there.

From a quick git grep I see that the only structure using the balance is the TxGraph (as it should be), @evanlinjin should we move Balance inside src/tx_graph.rs? Otherwise, having it in lib.rs is fine as well for me.

@evanlinjin
Copy link
Member

After a chat with @danielabrozzoni, we concluded that it'll be better to defer these decisions.

I also mentioned that I'm also not a fan of the tx_data_traits.rs and chain_data.rs files (there doesn't seem to be a clear enough distinction between the types declared in each).

Let's continue discussion on the ticket and make sure we all agree before moving forwards. Please also provide your thoughts there!

@notmandatory
Copy link
Member

Moved to alpha.4 since this is a functional change we should figure out before the beta release.

@notmandatory notmandatory added this to the 1.0.0-alpha.4 milestone Nov 13, 2023
@wthrajat
Copy link

Hi @evanlinjin!

Let's continue discussion on the ticket and make sure we all agree before moving forwards. Please also provide your thoughts there!

Have you reached to a conclusion?

@evanlinjin
Copy link
Member

@acerbisgianluca we have reached a final conclusion for #1173

Remove the tx_data_traits.rs file and move all of it's contents into chain_data.rs. Also move the Balance struct into chain_data.rs.

Please update this PR when you have time!

@notmandatory notmandatory added the api A breaking API change label Jan 16, 2024
@notmandatory
Copy link
Member

A small change but I think we should push to 2.0 milestone.

@nondiremanuel nondiremanuel removed this from the 1.0.0-alpha milestone Mar 21, 2024
@notmandatory
Copy link
Member

Closing this one as it's replaced by #1493.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api A breaking API change module-blockchain
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Merge tx_data_traits.rs into chain_data.rs.
6 participants