/// <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; }
private Node(object[] children, PatriciaTrie trie) { this.children = children; this.trie = trie; }
/// <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; }
/// <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; }
/// <summary> /// Create a new empty branch node. /// </summary> public Node(PatriciaTrie trie) { this.children = new object[17]; this.Dirty = true; this.trie = trie; }