Skip to content

Commit cb286cb

Browse files
Push #getHeight to the hashed entry:
Push #getHeight to the hashed entry as the element entries are always at height 0 and their height is neither requested nor included in the proof originally.
1 parent 8ecbff9 commit cb286cb

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

exonum-java-binding/common/src/main/java/com/exonum/binding/common/proofs/list/ListProofElementEntry.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@
2424
@AutoValue
2525
abstract class ListProofElementEntry implements ListProofEntry {
2626

27-
@Override
28-
public int getHeight() {
29-
// Elements are always at height 0
30-
return 0;
31-
}
32-
3327
/**
3428
* Returns a value of the element stored at this index in the list.
3529
*/

exonum-java-binding/common/src/main/java/com/exonum/binding/common/proofs/list/ListProofEntry.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@ interface ListProofEntry {
3838
*/
3939
long getIndex();
4040

41-
/**
42-
* Returns the height of the proof tree node corresponding to this entry.
43-
* The height of leaf nodes is equal to 0; the height of the root, or top node:
44-
* <em>ceil(log2(N))</em>.
45-
*/
46-
int getHeight();
47-
4841
static void checkIndex(long index) {
4942
checkArgument(0 <= index && index <= MAX_INDEX,
5043
"Entry index (%s) is out of range [0; 2^56]", index);

exonum-java-binding/common/src/main/java/com/exonum/binding/common/proofs/list/ListProofHashedEntry.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@
2424
*/
2525
@AutoValue
2626
abstract class ListProofHashedEntry implements ListProofEntry {
27-
// todo: do we need the interface (are we going to operate on the entries using the interface?)
27+
28+
/**
29+
* Returns the height of the proof tree node corresponding to this entry.
30+
* The height of leaf nodes is equal to 0; the height of the root, or top node:
31+
* <em>ceil(log2(N))</em>.
32+
*/
33+
abstract int getHeight();
2834

2935
/**
3036
* Returns the hash of the sub-tree this entry represents.

0 commit comments

Comments
 (0)