Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation to SHAMap #341

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/ripple_app/shamap/SHAMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,28 @@ enum SHAMapState
smsInvalid = 4, // Map is known not to be valid (usually synching a corrupt ledger)
};

/** A SHAMap is both a radix tree with a fan-out of 16 and a Merkle tree.

A radix tree is a tree with two properties:

1. The key for a node is represented by the node's position in the tree
(the "prefix property").
2. A node with only one child is merged with that child
(the "merge property")

These properties in a significantly smaller memory footprint for a radix tree.

And a fan-out of 16 means that each node in the tree has at most 16 children.
See https://en.wikipedia.org/wiki/Radix_tree

A Merkle tree is a tree where each non-leaf node is labelled with the hash
of the combined labels of its children nodes.

A key property of a Merkle tree is that testing for node inclusion is
O(log(N)) where N is the number of nodes in the tree.

See https://en.wikipedia.org/wiki/Merkle_tree
*/
class SHAMap
// : public CountedObject <SHAMap>
{
Expand Down