diff --git a/chain/src/pipe.rs b/chain/src/pipe.rs index f04314e5..8247ca83 100644 --- a/chain/src/pipe.rs +++ b/chain/src/pipe.rs @@ -265,6 +265,7 @@ fn validate_block(b: &Block, if utxo_root.hash != b.header.utxo_root || rproof_root.hash != b.header.range_proof_root || kernel_root.hash != b.header.kernel_root { + ext.dump(); return Err(Error::InvalidRoot); } diff --git a/chain/src/sumtree.rs b/chain/src/sumtree.rs index 561ae4e3..abd48447 100644 --- a/chain/src/sumtree.rs +++ b/chain/src/sumtree.rs @@ -284,6 +284,16 @@ impl<'a> Extension<'a> { self.rollback = true; } + /// Dumps the state of the 3 sum trees to stdout for debugging + pub fn dump(&self) { + println!("-- outputs --"); + self.output_pmmr.dump(); + println!("-- range proofs --"); + self.rproof_pmmr.dump(); + println!("-- kernels --"); + self.kernel_pmmr.dump(); + } + // Sizes of the sum trees, used by `extending` on rollback. fn sizes(&self) -> (u64, u64, u64) { (self.output_pmmr.unpruned_size(),