remove unnecessary code

This commit is contained in:
Peter Zhang 2025-09-08 19:00:03 +08:00
parent 67dbb75635
commit 65ceef322c

View File

@ -652,64 +652,3 @@ impl NodeTransaction<OptionalHash> for NodeDBTransaction {
self
}
}
// // Adapter implementation for OptionalHash that delegates to the H256 implementation
// impl NodeDatabase<OptionalHash> for FlowDBStore {
// fn get_node(&self, layer: usize, pos: usize) -> Result<Option<OptionalHash>> {
// Ok(self.get_node(layer, pos)?.map(OptionalHash::some))
// }
// fn get_layer_size(&self, layer: usize) -> Result<Option<usize>> {
// // Layer size is the same regardless of hash type
// <Self as NodeDatabase<DataRoot>>::get_layer_size(self, layer)
// }
// fn start_transaction(&self) -> Box<dyn NodeTransaction<OptionalHash>> {
// Box::new(OptionalHashNodeDBTransaction(self.start_transaction()))
// }
// fn commit(&self, tx: Box<dyn NodeTransaction<OptionalHash>>) -> Result<()> {
// let h256_tx = tx
// .into_any()
// .downcast::<OptionalHashNodeDBTransaction>()
// .map_err(|_| anyhow::anyhow!("Failed to downcast OptionalHashNodeDBTransaction"))?;
// self.commit(h256_tx.0)
// }
// }
// // Wrapper for NodeTransaction<OptionalHash> that delegates to NodeTransaction<H256>
// pub struct OptionalHashNodeDBTransaction(Box<dyn NodeTransaction<DataRoot>>);
// impl NodeTransaction<OptionalHash> for OptionalHashNodeDBTransaction {
// fn save_node(&mut self, layer: usize, pos: usize, node: &OptionalHash) {
// self.0.save_node(layer, pos, &node.unwrap());
// }
// fn save_node_list(&mut self, nodes: &[(usize, usize, &OptionalHash)]) {
// let h256_nodes: Vec<(usize, usize, DataRoot)> = nodes
// .iter()
// .map(|(layer, pos, oh)| (*layer, *pos, oh.unwrap()))
// .collect();
// let h256_node_refs: Vec<(usize, usize, &DataRoot)> = h256_nodes
// .iter()
// .map(|(layer, pos, h)| (*layer, *pos, h))
// .collect();
// self.0.save_node_list(&h256_node_refs);
// }
// fn remove_node_list(&mut self, nodes: &[(usize, usize)]) {
// self.0.remove_node_list(nodes);
// }
// fn save_layer_size(&mut self, layer: usize, size: usize) {
// self.0.save_layer_size(layer, size);
// }
// fn remove_layer_size(&mut self, layer: usize) {
// self.0.remove_layer_size(layer);
// }
// fn into_any(self: Box<Self>) -> Box<dyn Any> {
// Box::new(self)
// }
// }