From 9e45a09a0a2b5884d45baa6aaec474634286418f Mon Sep 17 00:00:00 2001 From: Nicolas Patry Date: Fri, 13 Sep 2024 18:23:06 +0200 Subject: [PATCH] Last reference. --- backends/v3/src/radix.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/backends/v3/src/radix.rs b/backends/v3/src/radix.rs index c4260e4c..a0207897 100644 --- a/backends/v3/src/radix.rs +++ b/backends/v3/src/radix.rs @@ -225,7 +225,6 @@ struct RadixAllocation { pub enum TrieError { InvalidNodeId, RefCountUnderflow, - BlockTokenCountMismatch, } pub type NodeId = DefaultKey; @@ -422,11 +421,10 @@ impl RadixTrie { // the part of the prefix that is already in the trie to detect // mismatches. - if tokens.len() != blocks.len() * self.block_size { - return Err(TrieError::BlockTokenCountMismatch); - } + assert_eq!(tokens.len(), blocks.len() * self.block_size); - if let Some(&child_id) = self.nodes[node_id].children.get(&tokens[0]) { + let node_key = hash_(&tokens[..self.block_size]); + if let Some(&child_id) = self.nodes[node_id].children.get(&node_key) { self.update_access_time(child_id); let child = self .nodes