Skip to content

Commit

Permalink
amend
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-near committed Nov 3, 2023
1 parent 2285336 commit ee6d560
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/store/src/trie/mem/loading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ mod tests {
// Check that the accessed nodes are consistent with those from disk.
for (node_hash, serialized_node) in nodes_accessed {
let expected_serialized_node =
trie.internal_retrieve_trie_node(&node_hash, false).unwrap().to_vec();
trie.internal_retrieve_trie_node(&node_hash, false).unwrap();
assert_eq!(expected_serialized_node, serialized_node);
}
}
Expand Down
6 changes: 4 additions & 2 deletions core/store/src/trie/mem/lookup.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::sync::Arc;

use super::metrics::MEM_TRIE_NUM_LOOKUPS;
use super::node::{MemTrieNodePtr, MemTrieNodeView};
use crate::NibbleSlice;
Expand All @@ -19,7 +21,7 @@ use near_primitives::state::FlatStateValue;
pub fn memtrie_lookup(
root: MemTrieNodePtr<'_>,
key: &[u8],
mut nodes_accessed: Option<&mut Vec<(CryptoHash, Vec<u8>)>>,
mut nodes_accessed: Option<&mut Vec<(CryptoHash, Arc<[u8]>)>>,
) -> Option<FlatStateValue> {
MEM_TRIE_NUM_LOOKUPS.inc();
let mut nibbles = NibbleSlice::new(key);
Expand All @@ -29,7 +31,7 @@ pub fn memtrie_lookup(
let view = node.view();
if let Some(nodes_accessed) = &mut nodes_accessed {
let raw_node_serialized = borsh::to_vec(&view.to_raw_trie_node_with_size()).unwrap();
nodes_accessed.push((view.node_hash(), raw_node_serialized));
nodes_accessed.push((view.node_hash(), raw_node_serialized.into()));
}
match view {
MemTrieNodeView::Leaf { extension, value } => {
Expand Down

0 comments on commit ee6d560

Please sign in to comment.