Esempio n. 1
0
 /// <summary>
 /// Get a node from a hash or raw RLP-encoded data.
 /// </summary>
 public Node(byte[] hashOrRlp, PatriciaTrie trie)
 {
     // If length is 32, we know it's a hash as the RLP-encoded data will always have a length greater than 32. (TODO: Verify)
     if (hashOrRlp.Length == 32)
     {
         this.Hash = hashOrRlp;
     }
     else
     {
         this.rlp = hashOrRlp;
     }
     this.trie = trie;
 }
Esempio n. 2
0
 private Node(object[] children, PatriciaTrie trie)
 {
     this.children = children;
     this.trie     = trie;
 }
Esempio n. 3
0
 /// <summary>
 /// Get a node from a parsed RLP object
 /// </summary>
 public Node(RLPCollection parsedRlp, PatriciaTrie trie)
 {
     this.parsedRlp = parsedRlp;
     this.rlp       = parsedRlp.RLPData;
     this.trie      = trie;
 }
Esempio n. 4
0
 /// <summary>
 /// Create a new key/value node.
 /// </summary>
 public Node(Key key, object valueOrNode, PatriciaTrie trie) : this(new object[] { key, valueOrNode }, trie)
 {
     this.Dirty = true;
 }
Esempio n. 5
0
 /// <summary>
 /// Create a new empty branch node.
 /// </summary>
 public Node(PatriciaTrie trie)
 {
     this.children = new object[17];
     this.Dirty    = true;
     this.trie     = trie;
 }