예제 #1
0
        public IHashTrieNode?GetNodeById(ulong id)
        {
            var prefix  = EntryPrefix.PersistentHashMap.BuildPrefix(id);
            var content = Get(prefix);

            if (content is null)
            {
                return(null);
            }
            return(NodeSerializer.FromBytes(content));
        }
예제 #2
0
        public bool TryGetNode(ulong id, out IHashTrieNode?trieNode)
        {
            if (_nodeCache.TryGetValue(id, out trieNode))
            {
                return(true);
            }
            var rawNode = _dbContext.Get(EntryPrefix.PersistentHashMap.BuildPrefix(id));

            trieNode = null;
            if (rawNode == null)
            {
                return(false);
            }
            trieNode = NodeSerializer.FromBytes(rawNode);
            return(true);
        }