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

Commit 3e1c4f2

Browse files
committed
v1.7.15
1 parent 059be62 commit 3e1c4f2

File tree

6 files changed

+26
-11
lines changed

6 files changed

+26
-11
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "zecwallet-cli"
3-
version = "1.7.14"
3+
version = "1.7.15"
44
edition = "2018"
55

66
[dependencies]

cli/src/version.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pub const VERSION: &str = "1.7.14";
1+
pub const VERSION: &str = "1.7.15";

lib/src/blaze/block_witness_data.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl BlockAndWitnessData {
6060
blocks: Arc::new(RwLock::new(vec![])),
6161
existing_blocks: Arc::new(RwLock::new(vec![])),
6262
verification_list: Arc::new(RwLock::new(vec![])),
63-
batch_size: 5_000,
63+
batch_size: 1_000,
6464
verified_tree: None,
6565
sync_status,
6666
sapling_activation_height: config.sapling_activation_height,
@@ -306,8 +306,10 @@ impl BlockAndWitnessData {
306306
let mut last_block_expecting = end_block;
307307

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

350+
// println!(
351+
// "Final block size at earliest-height {} with len {}",
352+
// earliest_block_height,
353+
// blks.len()
354+
// );
348355
if !blks.is_empty() {
349356
// We'll now dispatch these blocks for updating the witness
350357
sync_status.write().await.blocks_done += blks.len() as u64;

lib/src/lightclient.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,10 +1238,6 @@ impl<P: consensus::Parameters + Send + Sync + 'static> LightClient<P> {
12381238
/// Start syncing in batches with the max size, so we don't consume memory more than
12391239
// wha twe can handle.
12401240
async fn start_sync(&self) -> Result<JsonValue, String> {
1241-
// We can only do one sync at a time because we sync blocks in serial order
1242-
// If we allow multiple syncs, they'll all get jumbled up.
1243-
let _lock = self.sync_lock.lock().await;
1244-
12451241
// The top of the wallet
12461242
let last_scanned_height = self.wallet.last_scanned_height().await;
12471243

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

12751271
// Re-read the last scanned height
12761272
let last_scanned_height = self.wallet.last_scanned_height().await;
1277-
let batch_size = 50_000;
1273+
let batch_size = 25_000;
12781274

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

12981294
let mut res = Err("No batches were run!".to_string());
12991295
for (batch_num, batch_latest_block) in latest_block_batches.into_iter().enumerate() {
1300-
res = self.start_sync_batch(batch_latest_block, batch_num).await;
1296+
{
1297+
// We can only do one sync at a time because we sync blocks in serial order
1298+
// If we allow multiple syncs, they'll all get jumbled up.
1299+
let _lock = self.sync_lock.lock().await;
1300+
res = self.start_sync_batch(batch_latest_block, batch_num).await;
1301+
}
1302+
1303+
self.do_save().await?;
13011304
if res.is_err() {
13021305
return res;
13031306
}

lib/src/lightclient/tests.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
use std::fs;
2+
use std::path::Path;
3+
14
use ff::{Field, PrimeField};
25
use group::GroupEncoding;
36
use json::JsonValue;
@@ -1109,6 +1112,8 @@ async fn recover_at_checkpoint() {
11091112
);
11101113

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

0 commit comments

Comments
 (0)