summaryrefslogtreecommitdiff
path: root/src/ht.erl
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2014-06-01 17:03:00 +0200
committerLinus Nordberg <linus@nordberg.se>2014-06-01 17:03:00 +0200
commit0e7d9350d5468305193fc5772c98112b1521a13b (patch)
tree30148e5b1f5b94ed154ef6c81566eca90418f9eb /src/ht.erl
parent73bee488f683aa82c6266081be5c7bae900b5bd2 (diff)
Language.
Diffstat (limited to 'src/ht.erl')
-rw-r--r--src/ht.erl12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ht.erl b/src/ht.erl
index a72b9ac..0badb19 100644
--- a/src/ht.erl
+++ b/src/ht.erl
@@ -5,7 +5,7 @@
-record(inner, {child0 :: #leaf{} | #inner{}, % left child
child1 :: #leaf{} | #inner{}, % right child
hash :: binary()}). % hash of children's hashes
--record(head, {version :: non_neg_integer(), % number of leafs
+-record(head, {version :: non_neg_integer(), % number of leaves
tree :: tree()}). % the tree
-type head() :: #head{}.
@@ -35,7 +35,7 @@ tree_hash(#head{tree=T}) ->
#leaf{hash=H} -> H
end.
-%% @doc Return the size of a tree.
+%% @doc Return the size of a tree, i.e. its number of leaves.
-spec size(head()) -> non_neg_integer().
size(Head) ->
tree_version(Head).
@@ -46,7 +46,7 @@ size(Head) ->
%% the right sibling of that place. To find the right place, let d be
%% the depth of the tree, then go down the tree on the right hand side
%% to level l, where l is the position of the first set bit in d,
-%% looking at d from the least significant bit. l=0 is where the leafs
+%% looking at d from the least significant bit. l=0 is where the leaves
%% are and l=d-1 is the root.
%%
%% The depth of the tree is found by walking down the right path. It
@@ -124,7 +124,7 @@ consistency_proof(Head, N) ->
%% @doc Return version number of a tree.
%%
-%% The version number is the number of leafs in tree. Note that this
+%% The version number is the number of leaves in tree. Note that this
%% is set off by one (higher) compared to the history tree version as
%% explained by Crosby and Wallach.
-spec tree_version(head()) -> non_neg_integer().
@@ -322,7 +322,7 @@ consistency_proof_test_() ->
%% @doc Calculate a Merkle Tree Hash from an ordered list as specified
%% in RFC 6962.
%%
-%% K, the split point, is the number of leafs comprising the largest
+%% K, the split point, is the number of leaves comprising the largest
%% possible full tree.
%%
%% The way we calculate K is to let N be the number of entries, find
@@ -351,7 +351,7 @@ tv_bitcount(8589934591) -> [32, 0];
tv_bitcount(8589934592) -> [33, 33];
tv_bitcount(18446744073709551616) -> [64, 64].
-%% @doc Return the Merkle Tree Head for the leafs in L. Implements
+%% @doc Return the Merkle Tree Head for the leaves in L. Implements
%% the algorithm in section 2.1 of RFC 6962. Used for testing.
-spec mth(list()) -> binary().
mth([]) ->