Package org.ethereum.trie

Examples of org.ethereum.trie.TrieImpl.sync()


              trie.update(word1, word2);
              testerMap.put(word1, word2);
          }
 
          trie.cleanCache();
          trie.sync();
 
          // Assert the result now
          Iterator<String> keys = testerMap.keySet().iterator();
          while (keys.hasNext()){
 
View Full Code Here


    @Test
    public void testGetFromRootNode() {
        TrieImpl trie1 = new TrieImpl(mockDb);
        trie1.update(cat, LONG_STRING);
        trie1.sync();
        TrieImpl trie2 = new TrieImpl(mockDb, trie1.getRootHash());
        assertEquals(LONG_STRING, new String(trie2.get(cat)));
    }

View Full Code Here

        TrieImpl trie = new TrieImpl(mockDb);

        trie.update(dog, LONG_STRING);
        assertEquals("Expected no data in database", mockDb.getAddedItems(), 0);

        trie.sync();
        assertNotEquals("Expected data to be persisted", mockDb.getAddedItems(), 0);
    }

    @Test
    public void TestTrieDirtyTracking() {
View Full Code Here

    public void TestTrieDirtyTracking() {
        TrieImpl trie = new TrieImpl(mockDb);
        trie.update(dog, LONG_STRING);
        assertTrue("Expected trie to be dirty", trie.getCache().isDirty());

        trie.sync();
        assertFalse("Expected trie not to be dirty", trie.getCache().isDirty());

        trie.update(test, LONG_STRING);
        trie.getCache().undo();
        assertFalse("Expected trie not to be dirty", trie.getCache().isDirty());
View Full Code Here

    @Test
    public void testTrieUndo() {
        TrieImpl trie = new TrieImpl(mockDb);
        trie.update("doe", "reindeer");
        assertEquals("11a0327cfcc5b7689b6b6d727e1f5f8846c1137caaa9fc871ba31b7cce1b703e", Hex.toHexString(trie.getRootHash()));
        trie.sync();

        trie.update("dog", "puppy");
        assertEquals("05ae693aac2107336a79309e0c60b24a7aac6aa3edecaef593921500d33c63c4", Hex.toHexString(trie.getRootHash()));

        trie.undo();
View Full Code Here

              testerMap.remove(word1);
              trie.delete(word1);
          }
 
          trie.cleanCache();
          trie.sync();
 
          // Assert the result now
          Iterator<String> keys = testerMap.keySet().iterator();
          while (keys.hasNext()){
 
View Full Code Here

            else
                trie.update(keyVal[0].trim(), keyVal[1].trim());
        }

        trie.cleanCache();
        trie.sync();

        TrieImpl trie2 = new TrieImpl(mockDb, trie.getRootHash());

        for (int i = 2000; i < strData.size(); ++i){
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.