private void OnShown(object sender, EventArgs e) { WebSocketHelpers.ClearCanvas(); MerkleTree tree = new DemoMerkleTree(); CreateTree(tree, (int)nudNumLeaves.Value); DrawTree(tree); }
private void btnAuditProof_Click(object sender, EventArgs e) { WebSocketHelpers.ClearCanvas(); MerkleTree tree = new DemoMerkleTree(); CreateTree(tree, (int)nudNumLeaves.Value); DrawTree(tree); int leafNum = (int)nudAuditProofNodeNumber.Value; Highlight(tree.RootNode.Leaves().Cast <DemoMerkleNode>().Single(n => n.Text == leafNum.ToString("X")), "Orange"); DrawAuditProof(leafNum.ToString("X"), tree); }
private void NumLeavesChanged(object sender, EventArgs e) { WebSocketHelpers.ClearCanvas(); MerkleTree tree = new DemoMerkleTree(); CreateTree(tree, (int)nudNumLeaves.Value); DrawTree(tree); // Adjust maximums of our "proof" explorers. nudAuditProofNodeNumber.Maximum = nudNumLeaves.Value - 1; nudConsistencyProofNumLeaves.Maximum = nudNumLeaves.Value - 1; }
private void btnConsistencyProof_Click(object sender, EventArgs e) { WebSocketHelpers.ClearCanvas(); MerkleTree tree = new DemoMerkleTree(); CreateTree(tree, (int)nudNumLeaves.Value); DrawTree(tree); int numLeaves = (int)nudConsistencyProofNumLeaves.Value; // Reconstruct the old root hash by creating a tree of "m" leaves. // We do this because in the demo, we haven't given the user the ability to append trees, so we // simulate that process here. MerkleTree oldTree = new DemoMerkleTree(); CreateTree(oldTree, numLeaves); // For demo purposes, remove any () that were created by left-only branches. ((DemoMerkleNode)oldTree.RootNode).Text = ((DemoMerkleNode)oldTree.RootNode).Text.Replace("(", "").Replace(")", ""); DrawConsistencyProof(tree, (DemoMerkleNode)oldTree.RootNode, numLeaves, null); }