Skip to content

Commit

Permalink
Merge pull request #142 from idky137/get_block_range
Browse files Browse the repository at this point in the history
Get block range
  • Loading branch information
AloeareV authored Jan 8, 2025
2 parents f55173f + 195135e commit c64d830
Show file tree
Hide file tree
Showing 13 changed files with 1,149 additions and 277 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/target
/db
/docs/cargo_docs/debug
/.helix
/test_binaries/bins/*
/integration-tests/chain_cache/*
!/integration-tests/chain_cache/testnet_get_subtree_roots_sapling
Expand Down
8 changes: 7 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions integration-tests/tests/wallet_to_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ mod wallet_basic {
}

async fn connect_to_node_get_info(validator: &str) {
let mut test_manager = TestManager::launch(validator, None, true, true)
let mut test_manager = TestManager::launch(validator, None, None, true, true)
.await
.unwrap();
let clients = test_manager
Expand All @@ -46,7 +46,7 @@ mod wallet_basic {
}

async fn send_to_orchard(validator: &str) {
let mut test_manager = TestManager::launch(validator, None, true, true)
let mut test_manager = TestManager::launch(validator, None, None, true, true)
.await
.unwrap();
let clients = test_manager
Expand Down Expand Up @@ -101,7 +101,7 @@ mod wallet_basic {
}

async fn send_to_sapling(validator: &str) {
let mut test_manager = TestManager::launch(validator, None, true, true)
let mut test_manager = TestManager::launch(validator, None, None, true, true)
.await
.unwrap();
let clients = test_manager
Expand Down Expand Up @@ -157,7 +157,7 @@ mod wallet_basic {
}

async fn send_to_transparent(validator: &str) {
let mut test_manager = TestManager::launch(validator, None, true, true)
let mut test_manager = TestManager::launch(validator, None, None, true, true)
.await
.unwrap();
let clients = test_manager
Expand Down Expand Up @@ -261,7 +261,7 @@ mod wallet_basic {
}

async fn send_to_all(validator: &str) {
let mut test_manager = TestManager::launch(validator, None, true, true)
let mut test_manager = TestManager::launch(validator, None, None, true, true)
.await
.unwrap();
let clients = test_manager
Expand Down Expand Up @@ -363,7 +363,7 @@ mod wallet_basic {
}

async fn shield(validator: &str) {
let mut test_manager = TestManager::launch(validator, None, true, true)
let mut test_manager = TestManager::launch(validator, None, None, true, true)
.await
.unwrap();
let clients = test_manager
Expand Down Expand Up @@ -434,7 +434,7 @@ mod wallet_basic {
}

async fn monitor_unverified_mempool(validator: &str) {
let mut test_manager = TestManager::launch(validator, None, true, true)
let mut test_manager = TestManager::launch(validator, None, None, true, true)
.await
.unwrap();
let clients = test_manager
Expand Down
20 changes: 12 additions & 8 deletions zaino-fetch/src/chain/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ impl FullBlock {
let header = Vec::new();

let compact_block = CompactBlock {
proto_version: 0,
proto_version: 4,
height: self.height as u64,
hash: self.hdr.cached_hash.clone(),
prev_hash: self.hdr.raw_block_header.hash_prev_block.clone(),
Expand Down Expand Up @@ -432,13 +432,10 @@ impl FullBlock {
pub async fn get_block_from_node(
zebra_uri: &http::Uri,
height: &u32,
user: Option<String>,
password: Option<String>,
) -> Result<CompactBlock, BlockCacheError> {
let zebrad_client = JsonRpcConnector::new(
zebra_uri.clone(),
Some("xxxxxx".to_string()),
Some("xxxxxx".to_string()),
)
.await?;
let zebrad_client = JsonRpcConnector::new(zebra_uri.clone(), user, password).await?;
let block_1 = zebrad_client.get_block(height.to_string(), Some(1)).await;
match block_1 {
Ok(GetBlockResponse::Object {
Expand Down Expand Up @@ -489,7 +486,14 @@ pub async fn get_nullifiers_from_node(
zebra_uri: &http::Uri,
height: &u32,
) -> Result<CompactBlock, BlockCacheError> {
match get_block_from_node(zebra_uri, height).await {
match get_block_from_node(
zebra_uri,
height,
Some("xxxxxx".to_string()),
Some("xxxxxx".to_string()),
)
.await
{
Ok(block) => Ok(CompactBlock {
proto_version: block.proto_version,
height: block.height,
Expand Down
5 changes: 4 additions & 1 deletion zaino-serve/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ authors = { workspace = true }
license = { workspace = true }
repository = { workspace = true }

[features]
state_service = []

[dependencies]
zaino-proto = { path = "../zaino-proto" }
zaino-fetch = { path = "../zaino-fetch" }
zaino-state = { path = "../zaino-state" }

# Zebra
zebra-chain = { workspace = true }
zebra-state = { workspace = true }
zebra-rpc = { workspace = true }

# Miscellaneous Workspace
Expand All @@ -24,7 +28,6 @@ thiserror = { workspace = true }
# Miscellaneous Crate
prost = { workspace = true }
hex = { workspace = true, features = ["serde"] }
tokio-stream = { workspace = true }
futures = { workspace = true }
async-stream = { workspace = true }
crossbeam-channel = { workspace = true }
Expand Down
Loading

0 comments on commit c64d830

Please sign in to comment.