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

wire: make all nodes reply to user requests #399

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Davidson-Souza
Copy link
Collaborator

What is the purpose of this pull request?

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

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

Until now, only the running_node could reply to user request. However, that's cumbersome and limiting. After this commit, both sync_node and chain_selector can handle user requests made from the handle.

Checklist

  • I've signed all my commits
  • I ran just lint
  • I ran cargo test
  • I've checked the integration tests
  • I've followed the contribution guidelines
  • I'm linking the issue being fixed by this PR (if any)

Until now, only the running_node could reply to user request. However,
that's cumbersome and limiting. After this commit, both sync_node and
chain_selector can handle user requests made from the handle.
@Davidson-Souza Davidson-Souza added enhancement New feature or request chore Cleaning, refactoring, reducing complexity labels Mar 7, 2025
Copy link
Contributor

@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.

A good opportunity to add docs for these functions.

Here some suggestions to see if my intuition about them are right.

Ill be locally testing them.

}
}

pub(crate) async fn check_is_user_block_and_reply(
Copy link
Contributor

Choose a reason for hiding this comment

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

/// Check if this block request is made by a user through the user interface and answer it back to the
/// user if so.
///
/// This function will return the given block if isnt.

);
}

async fn perform_user_request(&mut self, user_req: Vec<UserRequest>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

/// This function executes user requests pacing it against inflights requests.

Ok(())
}

fn handle_get_peer_info(&self) {
Copy link
Contributor

Choose a reason for hiding this comment

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

/// Executes all getpeerinfo user requests.

self.user_requests.clone()
}

pub(crate) async fn handle_user_request(&mut self) -> Result<(), WireError> {
Copy link
Contributor

Choose a reason for hiding this comment

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

/// Wrapper/Helper function that iterate over all user_requests and pass it to perform_user_request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Cleaning, refactoring, reducing complexity enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants