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

feat(config): Allow to add keys to be scanned by the zebra-scan crate to config #7949

Merged
merged 3 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5780,8 +5780,10 @@ dependencies = [
"color-eyre",
"ff",
"group",
"indexmap 2.1.0",
"jubjub",
"rand 0.8.5",
"serde",
"tokio",
"zcash_client_backend",
"zcash_note_encryption",
Expand Down Expand Up @@ -5959,6 +5961,7 @@ dependencies = [
"zebra-network",
"zebra-node-services",
"zebra-rpc",
"zebra-scan",
"zebra-state",
"zebra-test",
"zebra-utils",
Expand Down
3 changes: 3 additions & 0 deletions zebra-scan/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ categories = ["cryptography::cryptocurrencies"]

[dependencies]

indexmap = { version = "2.0.1", features = ["serde"] }
serde = { version = "1.0.192", features = ["serde_derive"] }

[dev-dependencies]

zcash_client_backend = "0.10.0-rc.1"
Expand Down
21 changes: 21 additions & 0 deletions zebra-scan/src/config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//! Configuration for blockchain scanning tasks.

use indexmap::IndexMap;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Deserialize, Serialize)]
teor2345 marked this conversation as resolved.
Show resolved Hide resolved
#[serde(deny_unknown_fields, default)]
/// Configuration for scanning.
pub struct Config {
/// The sapling keys to scan for and the birthday height of each of them.
// TODO: any value below sapling activation as the birthday height should default to sapling activation.
pub sapling_keys_to_scan: IndexMap<String, u32>,
teor2345 marked this conversation as resolved.
Show resolved Hide resolved
}

impl Default for Config {
fn default() -> Self {
Self {
sapling_keys_to_scan: IndexMap::new(),
}
}
}
2 changes: 2 additions & 0 deletions zebra-scan/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
#![doc(html_logo_url = "https://zfnd.org/wp-content/uploads/2022/03/zebra-icon.png")]
#![doc(html_root_url = "https://docs.rs/zebra_scan")]

pub mod config;

#[cfg(test)]
mod tests;
4 changes: 4 additions & 0 deletions zebrad/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ getblocktemplate-rpcs = [
"zebra-chain/getblocktemplate-rpcs",
]

# Experimental zebra-scan indexing
zebra-scan = []
teor2345 marked this conversation as resolved.
Show resolved Hide resolved

# Experimental elasticsearch indexing
elasticsearch = [
"zebra-state/elasticsearch",
Expand Down Expand Up @@ -151,6 +154,7 @@ zebra-network = { path = "../zebra-network", version = "1.0.0-beta.31" }
zebra-node-services = { path = "../zebra-node-services", version = "1.0.0-beta.31" }
zebra-rpc = { path = "../zebra-rpc", version = "1.0.0-beta.31" }
zebra-state = { path = "../zebra-state", version = "1.0.0-beta.31" }
zebra-scan = { path = "../zebra-scan", version = "0.1.0-alpha.0" }
teor2345 marked this conversation as resolved.
Show resolved Hide resolved

# Required for crates.io publishing, but it's only used in tests
zebra-utils = { path = "../zebra-utils", version = "1.0.0-beta.31", optional = true }
Expand Down
4 changes: 4 additions & 0 deletions zebrad/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@ pub struct ZebradConfig {
#[serde(skip_serializing_if = "zebra_rpc::config::mining::Config::skip_getblocktemplate")]
/// Mining configuration
pub mining: zebra_rpc::config::mining::Config,

#[cfg(feature = "zebra-scan")]
/// Scanner configuration
pub scan: zebra_scan::config::Config,
teor2345 marked this conversation as resolved.
Show resolved Hide resolved
teor2345 marked this conversation as resolved.
Show resolved Hide resolved
}
Loading