merkle_patricia_tree v0.2.5 MerklePatriciaTree.Trie.Verifier
Function to verify the structure of a trie meets the spec as defined in http://gavwood.com/Paper.pdf.
Link to this section Summary
Functions
Runs simple tests to verify a trie matches general specs
Link to this section Functions
Link to this function
verify_trie(trie, dict)
verify_trie(MerklePatriciaTree.Trie.t, [{binary, binary}]) :: :ok | {:error, String.t}
Runs simple tests to verify a trie matches general specs.
We will check:
- Leafs have a non-empty value
- Leafs’ and branch’s value belong to a set of given values.
- Branches have at least two non-empty nodes.
- All sub-tries are valid.
- Ext’s prefixes aren’t blank.
- TODO: Ext’s can’t be extended.