Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
v1.7.15
Browse files Browse the repository at this point in the history
  • Loading branch information
adityapk00 committed Jul 13, 2022
1 parent 059be62 commit 3e1c4f2
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zecwallet-cli"
version = "1.7.14"
version = "1.7.15"
edition = "2018"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion cli/src/version.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pub const VERSION: &str = "1.7.14";
pub const VERSION: &str = "1.7.15";
11 changes: 9 additions & 2 deletions lib/src/blaze/block_witness_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl BlockAndWitnessData {
blocks: Arc::new(RwLock::new(vec![])),
existing_blocks: Arc::new(RwLock::new(vec![])),
verification_list: Arc::new(RwLock::new(vec![])),
batch_size: 5_000,
batch_size: 1_000,
verified_tree: None,
sync_status,
sapling_activation_height: config.sapling_activation_height,
Expand Down Expand Up @@ -306,8 +306,10 @@ impl BlockAndWitnessData {
let mut last_block_expecting = end_block;

while let Some(cb) = rx.recv().await {
// We'll process 25_000 blocks at a time.
// We'll process batch_size (1_000) blocks at a time.
// println!("Recieved block # {}", cb.height);
if cb.height % batch_size == 0 {
// println!("Batch size hit at height {} with len {}", cb.height, blks.len());
if !blks.is_empty() {
// Add these blocks to the list
sync_status.write().await.blocks_done += blks.len() as u64;
Expand Down Expand Up @@ -345,6 +347,11 @@ impl BlockAndWitnessData {
blks.push(BlockData::new(cb));
}

// println!(
// "Final block size at earliest-height {} with len {}",
// earliest_block_height,
// blks.len()
// );
if !blks.is_empty() {
// We'll now dispatch these blocks for updating the witness
sync_status.write().await.blocks_done += blks.len() as u64;
Expand Down
15 changes: 9 additions & 6 deletions lib/src/lightclient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1238,10 +1238,6 @@ impl<P: consensus::Parameters + Send + Sync + 'static> LightClient<P> {
/// Start syncing in batches with the max size, so we don't consume memory more than
// wha twe can handle.
async fn start_sync(&self) -> Result<JsonValue, String> {
// We can only do one sync at a time because we sync blocks in serial order
// If we allow multiple syncs, they'll all get jumbled up.
let _lock = self.sync_lock.lock().await;

// The top of the wallet
let last_scanned_height = self.wallet.last_scanned_height().await;

Expand Down Expand Up @@ -1274,7 +1270,7 @@ impl<P: consensus::Parameters + Send + Sync + 'static> LightClient<P> {

// Re-read the last scanned height
let last_scanned_height = self.wallet.last_scanned_height().await;
let batch_size = 50_000;
let batch_size = 25_000;

let mut latest_block_batches = vec![];
let mut prev = last_scanned_height;
Expand All @@ -1297,7 +1293,14 @@ impl<P: consensus::Parameters + Send + Sync + 'static> LightClient<P> {

let mut res = Err("No batches were run!".to_string());
for (batch_num, batch_latest_block) in latest_block_batches.into_iter().enumerate() {
res = self.start_sync_batch(batch_latest_block, batch_num).await;
{
// We can only do one sync at a time because we sync blocks in serial order
// If we allow multiple syncs, they'll all get jumbled up.
let _lock = self.sync_lock.lock().await;
res = self.start_sync_batch(batch_latest_block, batch_num).await;
}

self.do_save().await?;
if res.is_err() {
return res;
}
Expand Down
5 changes: 5 additions & 0 deletions lib/src/lightclient/tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
use std::fs;
use std::path::Path;

use ff::{Field, PrimeField};
use group::GroupEncoding;
use json::JsonValue;
Expand Down Expand Up @@ -1109,6 +1112,8 @@ async fn recover_at_checkpoint() {
);

// 5: Test2: Create a new lightwallet, restoring at checkpoint + 100
// First remove the old wallet
fs::remove_file(Path::new(config.data_dir.as_ref().unwrap()).join("zecwallet-light-wallet.dat")).unwrap();
let lc = LightClient::test_new(&config, Some(TEST_SEED.to_string()), ckpt_height + 100)
.await
.unwrap();
Expand Down

0 comments on commit 3e1c4f2

Please sign in to comment.