Skip to content

Conversation

@JoseSK999
Copy link
Contributor

@JoseSK999 JoseSK999 commented Jul 2, 2025

What is the purpose of this pull request?

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

Which crates are being modified?

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

Description

Very simple refactor. It makes sense to have the data directory path creation in its own function, especially since the Florestad::start method is already quite long.

Behavior is changed to (directly) parse the data directory with all '/' or '\' at the end trimmed. Also if no home directory is found we use ./.floresta. Added tests.

@luisschwab
Copy link
Contributor

Concept ACK. I would rename it to create_data_dir.

@Davidson-Souza Davidson-Souza added chore Cleaning, refactoring, reducing complexity code quality Generally improves code readability and maintainability labels Jul 2, 2025
@JoseSK999
Copy link
Contributor Author

Concept ACK. I would rename it to create_data_dir.

I think it can be confusing because we are not creating the directory but the path (and below we call create_dir_all).

I think we could use data_dir_path

It makes sense to have the data directory creation in its own function, especially since the `Florestad::start` method is already quite long.

Behavior is changed to parse the data directory with all '/' or '\' at the end trimmed. Also if no home directory is found we use `./.florestad`. Added tests.
@JoseSK999 JoseSK999 force-pushed the refactor-get-data-dir branch from f30d241 to 8ace492 Compare July 2, 2025 15:34
@JoseSK999 JoseSK999 changed the title Florestad: refactor data_dir creation Florestad: refactor data_dir path creation Jul 2, 2025
Copy link
Member

@Davidson-Souza Davidson-Souza left a comment

Choose a reason for hiding this comment

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

ACK 8ace492

Strong concept ack for refactoring Floresta::start. I also think we need to stop panic/exit-ing and return proper error (florestad is also a library). But this is for another PR.

Copy link
Collaborator

@jaoleal jaoleal left a comment

Choose a reason for hiding this comment

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

Concept ACK

@jaoleal
Copy link
Collaborator

jaoleal commented Jul 2, 2025

ACK 8ace492

@Davidson-Souza Davidson-Souza merged commit ad7f49d into vinteumorg:master Jul 2, 2025
10 checks passed
@JoseSK999 JoseSK999 deleted the refactor-get-data-dir branch July 4, 2025 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Cleaning, refactoring, reducing complexity code quality Generally improves code readability and maintainability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants