fn check_hash_invertibility_invariant()

in merkledb/src/merkledb_debug.rs [58:74]


    fn check_hash_invertibility_invariant(&self) -> bool {
        let mut ret = true;
        for i in 0..self.get_sequence_number() {
            // there is no requirement that IDs be sequential just monotonic
            if let Some(node) = self.find_node_by_id(i as MerkleNodeId) {
                if let Some(hashtoid) = self.hash_to_id(node.hash()) {
                    if hashtoid != (i as MerkleNodeId) {
                        eprintln!("Node {node:?} hash_to_id resolves to {hashtoid:?} which should be {i:?}");
                        ret = false;
                    }
                } else {
                    eprintln!("Node {node:?} hash_to_id resolves to None which should be {i:?}");
                }
            }
        }
        ret
    }