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

Simplify hash and error conversions #395

Merged

Conversation

JoseSK999
Copy link
Contributor

Description

Since BitcoinNodeHash implements From<bitcoin_hashes::sha256::Hash>, we can directly apply Into::into. Then for str conversions we can use parse instead, and map the arrays directly.

Finally in chain_state.rs and partial_chain.rs I simplify BlockchainError::BlockValidation conversions with ?.

What is the purpose of this pull request?

  • Bug fix
  • Documentation update
  • New feature
  • Test
  • Other: Simplification

Which crates are being modified?

  • floresta-chain
  • floresta-cli
  • floresta-common
  • floresta-compact-filters
  • floresta-electrum
  • floresta-watch-only
  • floresta-wire
  • floresta
  • florestad
  • Other: .

Since `BitcoinNodeHash` implements `From<bitcoin_hashes::sha256::Hash>`, we can directly apply `Into::into`. Then for str conversions we can use `parse` instead, and map the arrays directly.

Finally in `chain_state.rs` and `partial_chain.rs` I simplify `BlockchainError::BlockValidation` conversions with `?`.
@Davidson-Souza
Copy link
Collaborator

ACK 70b0216

@Davidson-Souza Davidson-Souza merged commit 3b0a243 into vinteumorg:master Mar 5, 2025
8 checks passed
@JoseSK999 JoseSK999 deleted the simplify-nodehash-conversion branch March 5, 2025 17:57
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.

2 participants