diff --git a/Cargo.lock b/Cargo.lock index 6a9070b05..4e1765a95 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -384,7 +384,7 @@ dependencies = [ [[package]] name = "cuckoo_miner" version = "0.1.0" -source = "git+https://github.com/mimblewimble/cuckoo-miner?tag=grin_integration_24#d017db6d70061f566a65f35513dc0252bb5b4ee1" +source = "git+https://github.com/mimblewimble/cuckoo-miner?tag=grin_integration_25#40cb3146a56d338452b350bbfab18bf0805d1d9d" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -772,7 +772,7 @@ name = "grin_pow" version = "0.2.0" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", - "cuckoo_miner 0.1.0 (git+https://github.com/mimblewimble/cuckoo-miner?tag=grin_integration_24)", + "cuckoo_miner 0.1.0 (git+https://github.com/mimblewimble/cuckoo-miner?tag=grin_integration_25)", "grin_core 0.2.0", "grin_util 0.2.0", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2281,7 +2281,7 @@ dependencies = [ "checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" "checksum crossbeam-utils 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d636a8b3bcc1b409d7ffd3facef8f21dcb4009626adbd0c5e6c4305c07253c7b" "checksum csv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7ef22b37c7a51c564a365892c012dc0271221fdcc64c69b19ba4d6fa8bd96d9c" -"checksum cuckoo_miner 0.1.0 (git+https://github.com/mimblewimble/cuckoo-miner?tag=grin_integration_24)" = "" +"checksum cuckoo_miner 0.1.0 (git+https://github.com/mimblewimble/cuckoo-miner?tag=grin_integration_25)" = "" "checksum cursive 0.8.2-alpha.0 (git+https://github.com/yeastplume/Cursive?tag=grin_integration_1)" = "" "checksum daemonize 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0239832c1b4ca406d5ec73728cf4c7336d25cf85dd32db9e047e9e706ee0e935" "checksum dtoa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0dd841b58510c9618291ffa448da2e4e0f699d984d436122372f446dae62263d" diff --git a/store/src/lib.rs b/store/src/lib.rs index 5a47a7a70..8b073da85 100644 --- a/store/src/lib.rs +++ b/store/src/lib.rs @@ -22,6 +22,7 @@ extern crate byteorder; extern crate env_logger; +#[macro_use] extern crate grin_core as core; extern crate grin_util as util; extern crate libc; diff --git a/store/src/pmmr.rs b/store/src/pmmr.rs index ebe32d1b6..38228ea4e 100644 --- a/store/src/pmmr.rs +++ b/store/src/pmmr.rs @@ -368,13 +368,10 @@ where { let record_len = 32; - let off_to_rm = pos_to_rm - .iter() - .map(|&pos| { - let shift = self.pruned_nodes.get_shift(pos); - (pos - 1 - shift.unwrap()) * record_len - }) - .collect(); + let off_to_rm = map_vec!(pos_to_rm, |&pos| { + let shift = self.pruned_nodes.get_shift(pos).unwrap(); + (pos - 1 - shift) * record_len + }); self.hash_file.save_prune( tmp_prune_file_hash.clone(), @@ -388,13 +385,10 @@ where { let record_len = T::len() as u64; - let off_to_rm = leaf_pos_to_rm - .iter() - .map(|pos| { - let shift = self.pruned_nodes.get_leaf_shift(*pos); - (pmmr::n_leaves(pos - shift.unwrap()) - 1) * record_len - }) - .collect::>(); + let off_to_rm = map_vec!(leaf_pos_to_rm, |pos| { + let shift = self.pruned_nodes.get_leaf_shift(*pos); + (pmmr::n_leaves(pos - shift.unwrap()) - 1) * record_len + }); self.data_file.save_prune( tmp_prune_file_data.clone(), diff --git a/store/src/types.rs b/store/src/types.rs index c10c3b5c1..84bd19c24 100644 --- a/store/src/types.rs +++ b/store/src/types.rs @@ -187,7 +187,7 @@ impl AppendOnlyFile { // in which case we skip let mut buf_start = 0; while prune_offs[prune_pos] >= read && prune_offs[prune_pos] < read + len { - let prune_at = prune_offs[prune_pos] as usize; + let prune_at = (prune_offs[prune_pos] - read) as usize; if prune_at != buf_start { writer.write_all(&buf[buf_start..prune_at])?; } else {