Interface CheckedListProof<E>
- All Superinterfaces:
CheckedProof
- All Known Implementing Classes:
CheckedListProofImpl
public interface CheckedListProof<E> extends CheckedProof
A proof that some elements exist in a proof list.
Example usage:
HashCode expectedIndexHash = // get a known index hash from block proof //
UncheckedListProof proof = new UncheckedListProofAdapter(rootProofNode, serializer);
// Check the proof
CheckedListProof checkedProof = proof.check();
// Check the index hash
if (checkedProof.isValid() && checkedProof.getIndexHash().equals(expectedIndexHash)) {
// Get and use elements
NavigableMap value = checkedProof.getElements();
}
-
Method Summary
Modifier and Type Method Description java.util.NavigableMap<java.lang.Long,E>
getElements()
Get all list proof elements.ListProofStatus
getProofStatus()
Returns the status of this proof: whether it is structurally valid.long
size()
Returns the size of the list: the total number of elements in it.Methods inherited from interface com.exonum.binding.common.proofs.CheckedProof
getIndexHash, isValid
-
Method Details
-
size
long size()Returns the size of the list: the total number of elements in it. -
getElements
java.util.NavigableMap<java.lang.Long,E> getElements()Get all list proof elements. There might be several consecutive ranges.- Returns:
- list proof elements. Empty if the proof is a proof of absence
- Throws:
java.lang.IllegalStateException
- if the proof is not valid
-
getProofStatus
ListProofStatus getProofStatus()Returns the status of this proof: whether it is structurally valid.- Specified by:
getProofStatus
in interfaceCheckedProof
-