Skip to content

Commit

Permalink
Add (not working yet) test for root hash
Browse files Browse the repository at this point in the history
  • Loading branch information
popzxc committed Mar 1, 2019
1 parent 53d39ce commit 454987c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,17 @@ def test_delete_many(self):
new_root_hash = trie.root_hash()

self.assertEqual(root_hash, new_root_hash)

def test_root_hash(self):
storage = {}

trie = mpt.MerklePatriciaTrie(storage)

trie.update(b'do', b'verb')
trie.update(b'dog', b'puppy')
trie.update(b'doge', b'coin')
trie.update(b'horse', b'stallion')

root_hash = trie.root_hash()

self.assertEqual(root_hash, bytes.fromhex('5991bb8c6514148a29db676a14ac506cd2cd5775ace63c30a4fe457715e9ac84'))

0 comments on commit 454987c

Please sign in to comment.