zebra_node_services/scan_service/response.rs
1//! `zebra_scan::service::ScanService` response types.
2
3use std::collections::BTreeMap;
4
5use zebra_chain::{block::Height, transaction};
6
7/// A relevant transaction for a key and the block height where it was found.
8#[derive(Debug, Clone, PartialEq, Eq)]
9pub struct ScanResult {
10 /// The key that successfully decrypts the transaction
11 pub key: String,
12
13 /// The height of the block with the transaction
14 pub height: Height,
15
16 /// A transaction ID, which uniquely identifies mined v5 transactions,
17 /// and all v1-v4 transactions.
18 pub tx_id: transaction::Hash,
19}
20
21#[derive(Debug)]
22/// Response types for `zebra_scan::service::ScanService`
23pub enum Response {
24 /// Response to the [`Info`](super::request::Request::Info) request
25 Info {
26 /// The minimum sapling birthday height for the shielded scanner
27 min_sapling_birthday_height: Height,
28 },
29
30 /// Response to [`RegisterKeys`](super::request::Request::RegisterKeys) request
31 ///
32 /// Contains the keys that the scanner accepted.
33 RegisteredKeys(Vec<String>),
34
35 /// Response to [`Results`](super::request::Request::Results) request
36 ///
37 /// We use the nested `BTreeMap` so we don't repeat any piece of response data.
38 Results(BTreeMap<String, BTreeMap<Height, Vec<transaction::Hash>>>),
39
40 /// Response to [`DeleteKeys`](super::request::Request::DeleteKeys) request
41 DeletedKeys,
42
43 /// Response to [`ClearResults`](super::request::Request::ClearResults) request
44 ClearedResults,
45
46 /// Response to [`SubscribeResults`](super::request::Request::SubscribeResults) request
47 SubscribeResults(tokio::sync::mpsc::Receiver<ScanResult>),
48}