Search in sources :

Example 6 with Sha256Hash

use of org.tron.common.utils.Sha256Hash in project java-tron by tronprotocol.

the class MerkleTreeTest method testMerkleTreeTest.

@Test
public void testMerkleTreeTest() {
    Sha256Hash hash1 = getBeforeZeroHash();
    MerkleTree tree = MerkleTree.getInstance().createTree(getZeroIds());
    logger.info("Transaction[X] Compare :");
    logger.info("left: {}", hash1);
    logger.info("right: {}", tree.getRoot().getHash());
    assertEquals(hash1, tree.getRoot().getHash());
    Sha256Hash hash2 = getBeforeTxHash();
    tree.createTree(getTxIds2(blockCapsule1));
    logger.info("Transaction[O] Compare :");
    logger.info("left: {}", hash2);
    logger.info("right: {}", tree.getRoot().getHash());
    assertEquals(hash2, tree.getRoot().getHash());
}
Also used : Sha256Hash(org.tron.common.utils.Sha256Hash) Test(org.junit.Test)

Aggregations

Sha256Hash (org.tron.common.utils.Sha256Hash)6 ArrayList (java.util.ArrayList)3 BlockCapsule (org.tron.core.capsule.BlockCapsule)3 BlockId (org.tron.core.capsule.BlockCapsule.BlockId)3 FetchInvDataMessage (org.tron.core.net.message.FetchInvDataMessage)3 Iterables (com.google.common.collect.Iterables)2 ConcurrentSet (io.netty.util.internal.ConcurrentSet)2 Collection (java.util.Collection)2 Deque (java.util.Deque)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2 Entry (java.util.Map.Entry)2 Queue (java.util.Queue)2 Set (java.util.Set)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 Executors (java.util.concurrent.Executors)2 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)2 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)2