diff --git a/chain/src/txhashset.rs b/chain/src/txhashset.rs index 98723e68c..eef74ac9d 100644 --- a/chain/src/txhashset.rs +++ b/chain/src/txhashset.rs @@ -622,6 +622,8 @@ impl<'a> Extension<'a> { pub fn dump_output_pmmr(&self) { debug!(LOGGER, "-- outputs --"); self.output_pmmr.dump_from_file(false); + debug!(LOGGER, "--"); + self.output_pmmr.dump_stats(); debug!(LOGGER, "-- end of outputs --"); } diff --git a/core/src/core/pmmr.rs b/core/src/core/pmmr.rs index 103fc9a38..db45de363 100644 --- a/core/src/core/pmmr.rs +++ b/core/src/core/pmmr.rs @@ -81,6 +81,9 @@ where /// sit well with the design, but TxKernels have to be summed and the /// fastest way to to be able to allow direct access to the file fn get_data_file_path(&self) -> String; + + /// For debugging purposes so we can see how compaction is doing. + fn dump_stats(&self); } /// A Merkle proof. @@ -566,6 +569,11 @@ where } } + pub fn dump_stats(&self) { + debug!(LOGGER, "pmmr: unpruned - {}", self.unpruned_size()); + self.backend.dump_stats(); + } + /// Debugging utility to print information about the MMRs. Short version /// only prints the last 8 nodes. /// Looks in the underlying hash file and so ignores the remove log. @@ -1034,6 +1042,8 @@ mod test { fn get_data_file_path(&self) -> String { "".to_string() } + + fn dump_stats(&self) {} } impl VecBackend diff --git a/store/src/pmmr.rs b/store/src/pmmr.rs index 29bc48999..81f7cf45f 100644 --- a/store/src/pmmr.rs +++ b/store/src/pmmr.rs @@ -97,7 +97,7 @@ where impl Backend for PMMRBackend where - T: PMMRable, + T: PMMRable + ::std::fmt::Debug, { /// Append the provided Hashes to the backend storage. #[allow(unused_variables)] @@ -210,6 +210,16 @@ where fn get_data_file_path(&self) -> String { self.data_file.path() } + + fn dump_stats(&self) { + debug!( + LOGGER, + "pmmr backend: unpruned - {}, hashes - {}, data - {}", + self.unpruned_size().unwrap_or(0), + self.hash_size().unwrap_or(0), + self.data_size().unwrap_or(0) + ); + } } impl PMMRBackend