Example #1
0
 public MerkleNode AppendMerkleNode(MerkleNode node)
 {
     if (RightNode == null)
     {
         SetRightNode(node);
         EventMerkleTree.Output($"Node {((EventMerkleNode)node).Text} set as right node on {this.Text}");
         MergeText();
         return(this);
     }
     if (Parent == null)
     {
         EventMerkleTree.Output($"Parent of {this} was null on {((EventMerkleNode)node).Text}, will create new parent.");
         var newParent = new EventMerkleNode((EventMerkleNode)node, null);
         new EventMerkleNode(this, newParent);
         return(newParent);
     }
     else // Parent exists
     {
         EventMerkleTree.Output($"Parent of {this} was NOT null:{((EventMerkleNode)Parent).Text} on {((EventMerkleNode)node).Text}");
         var newParent = new EventMerkleNode((EventMerkleNode)node, null);
         ((EventMerkleNode)Parent).AppendMerkleNode(newParent);
         return(newParent);
     }
 }
Example #2
0
 }                                // Useful for diagramming.
 public EventMerkleNode(EventMerkleNode left, EventMerkleNode right = null) : base(left, right)
 {
     MergeText(left, right);
     EventMerkleTree.Output($"New node:{Text}, L:{left.Text}, R:{right?.Text}");
 }
Example #3
0
 protected void MergeText()
 {
     EventMerkleTree.Output($"Updating Text from L:{((EventMerkleNode)LeftNode).Text}, R:{((EventMerkleNode)RightNode)?.Text}");
     MergeText(LeftNode, RightNode);
     ((EventMerkleNode)Parent)?.MergeText();
 }