diff --git a/stackslib/src/chainstate/stacks/index/trie.rs b/stackslib/src/chainstate/stacks/index/trie.rs index 1b7b3965e1..a6df92d104 100644 --- a/stackslib/src/chainstate/stacks/index/trie.rs +++ b/stackslib/src/chainstate/stacks/index/trie.rs @@ -378,13 +378,8 @@ impl Trie { // append the new leaf and the end of the file. let new_leaf_disk_ptr = storage.last_ptr()?; let new_leaf_chr = cursor.path[cursor.tell()]; // NOTE: this is safe because !cursor.eop() - let new_leaf_path = cursor.path[(if cursor.tell() < cursor.path.len() { - cursor.tell() + 1 - } else { - cursor.path.len() - })..] - .to_vec(); - new_leaf_data.path = new_leaf_path; + new_leaf_data.path = + cursor.path[std::cmp::min(cursor.tell() + 1, cursor.path.len())..].to_vec(); let new_leaf_hash = get_leaf_hash(new_leaf_data); // put new leaf at the end of this Trie