use of org.aion.mcf.trie.Trie in project aion by aionnetwork.
the class TrieTestWithRootHashValues method testSecureTrie.
@Test
public void testSecureTrie() {
Trie trie = new SecureTrie(mockDb);
byte[] k1 = "do".getBytes();
byte[] v1 = "verb".getBytes();
byte[] k2 = "ether".getBytes();
byte[] v2 = "wookiedoo".getBytes();
byte[] k3 = "horse".getBytes();
byte[] v3 = "stallion".getBytes();
byte[] k4 = "shaman".getBytes();
byte[] v4 = "horse".getBytes();
byte[] k5 = "doge".getBytes();
byte[] v5 = "coin".getBytes();
byte[] k6 = "ether".getBytes();
byte[] v6 = "".getBytes();
byte[] k7 = "dog".getBytes();
byte[] v7 = "puppy".getBytes();
byte[] k8 = "shaman".getBytes();
byte[] v8 = "".getBytes();
trie.update(k1, v1);
trie.update(k2, v2);
trie.update(k3, v3);
trie.update(k4, v4);
trie.update(k5, v5);
trie.update(k6, v6);
trie.update(k7, v7);
trie.update(k8, v8);
byte[] root = trie.getRootHash();
System.out.println("root: " + Hex.toHexString(root));
Assert.assertEquals("29b235a58c3c25ab83010c327d5932bcf05324b7d6b1185e650798034783ca9d", Hex.toHexString(root));
}
Aggregations