예제 #1
0
        protected ShaMapLeafNode GetLeaf(Hash256 id, bool invalidating)
        {
            int        ix       = id.Nibblet(this.depth);
            ShaMapNode existing = this.branches[ix];

            if (invalidating)
            {
                this.Invalidate();
            }

            if (existing == null)
            {
                return(null);
            }

            var node = existing as ShaMapLeafNode;

            if (node != null)
            {
                return(node);
            }

            return(((ShaMapInnerNode)existing).GetLeaf(id, invalidating));
        }
예제 #2
0
 protected void SetNode(int slot, ShaMapNode node)
 {
     this.slotBits       = this.slotBits | (1 << slot);
     this.branches[slot] = node;
 }