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

Implement RegisterKeys scan service request to register new keys #8203

Closed
arya2 opened this issue Jan 29, 2024 · 0 comments · Fixed by #8251
Closed

Implement RegisterKeys scan service request to register new keys #8203

arya2 opened this issue Jan 29, 2024 · 0 comments · Fixed by #8251
Assignees
Labels
A-blockchain-scanner Area: Blockchain scanner of shielded transactions C-feature Category: New features S-needs-triage Status: A bug report needs triage

Comments

@arya2
Copy link
Contributor

arya2 commented Jan 29, 2024

Motivation

We want a scan service request for adding new keys to the scanner task.

Possible Design

  • Pass cmd_receiver in ScanTask::spawn() down to zebra_scan::scan::start()
  • Update RegisterKeys(Vec<()>) to RegisterKey(String) or RegisterKey { key, parsed_keys } (or a vector of them)
  • Call try_recv() at the top of the scanner loop, example:
    loop {
        loop {
            let cmd = match cmd_receiver.try_recv() {
                Ok(cmd) => cmd,

                Err(TryRecvError::Empty) => break,
                Err(TryRecvError::Disconnected) => {
                    return Err(eyre!("command channel disconnected"))
                }
            };

            match cmd {
                ScanTaskCommand::RegisterKey(key) => {
                    let Ok(parsed_key) = sapling_key_to_scan_block_keys(&key, network) else {
                        continue;
                    };

                    let mut new_parsed_keys =
                        Arc::try_unwrap(parsed_keys).unwrap_or_else(|arc| (*arc).clone());
                    new_parsed_keys.insert(key.clone(), parsed_key);
                    parsed_keys = Arc::new(new_parsed_keys);
                }

                _ => continue,
            }
        }

        let scanned_height = scan_height_and_store_results(
  • Accept a String in the RegisterKey scan service request
  • Call cmd_sender.send(ScanTaskCommand::RegisterKey(key))
    • Possibly after decoding/validating the viewing key
  • Respond to the service request once the message has been sent to the channel
@github-project-automation github-project-automation bot moved this to New in Zebra Jan 29, 2024
@arya2 arya2 added S-needs-triage Status: A bug report needs triage C-feature Category: New features A-blockchain-scanner Area: Blockchain scanner of shielded transactions labels Jan 29, 2024
@mpguerra mpguerra moved this from New to Sprint Backlog in Zebra Jan 29, 2024
@upbqdn upbqdn self-assigned this Jan 30, 2024
@mergify mergify bot closed this as completed in #8251 Feb 9, 2024
@github-project-automation github-project-automation bot moved this from Sprint Backlog to Done in Zebra Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-blockchain-scanner Area: Blockchain scanner of shielded transactions C-feature Category: New features S-needs-triage Status: A bug report needs triage
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants