public void AuditTest2(int leafCount) { MerkleHash hash = null; var tree = new MerkleAppendTree.MerkleTree(); for (int i = 0; i < leafCount; i++) { hash = MerkleHash.Create(i.ToString()); tree.AppendLeaf(hash); } MerkleHash rootHash = tree.RootNode.Hash; foreach (var leaf in tree.RootNode.Leaves()) { Output.WriteLine(leaf.ToString()); } List <MerkleProofHash> auditTrail = tree.AuditProof(hash); Output.WriteLine("Audit Trail:"); foreach (var h in auditTrail) { Output.WriteLine(h.ToString()); } Assert.True(MerkleTree.VerifyAudit(rootHash, hash, auditTrail)); }
public void CompareCliftonMerkleToAppendMerkle_Test(int leafCount) { var cliftonTree = new Clifton.Blockchain.MerkleTree(); for (int i = 0; i < leafCount; i++) { var newLeafNode = new Clifton.Blockchain.MerkleNode(Clifton.Blockchain.MerkleHash.Create(i.ToString())); cliftonTree.AppendLeaf(newLeafNode); } cliftonTree.BuildTree(); var appendTree = new MerkleAppendTree.MerkleTree(); for (int i = 0; i < leafCount; i++) { var newLeafNode = new MerkleAppendTree.MerkleNode(MerkleAppendTree.MerkleHash.Create(i.ToString())); appendTree.AppendLeaf(newLeafNode); } Assert.Equal(cliftonTree.RootNode.Hash.ToString(), appendTree.RootNode.Hash.ToString()); }