I am trying to create a HexaryTrie
from the database that the trie writes to.
Here is my Code:
from trie import (
HexaryTrie,
)
db = {}
trie1 = HexaryTrie(db)
trie1[b'deadbeef'] = b'deadbeef'
...
trie2 = HexaryTrie(db)
print(trie1.root_hash)
print(trie2.root_hash)
# ^ these print different root hashes :(
I saw in py-trie, that the HexaryTrie constructor is:
def __init__(self, db, root_hash=BLANK_NODE_HASH, prune=False):
self.db = db
validate_is_bytes(root_hash)
self.root_hash = root_hash
self.is_pruning = prune
Is there a way to use the db that is being created to "re"-create the trie?
Thank you in advance :)