Created
June 11, 2019 19:27
-
-
Save dangerousfood/b7f94306d5b7ba55d819210aa28ae1e7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public List<Bytes32> getProofTreeByIndex(int index) { | |
if (dirty) calcBranches(); | |
List<Bytes32> proof = new ArrayList<Bytes32>(); | |
for (int i = 0; i < height; i++) { | |
index = index % 2 == 1 ? index - 1 : index + 1; | |
if (index < tree.get(i).size()) proof.add(tree.get(i).get(index)); | |
else proof.add(zeroHashes.get(i)); | |
index /= 2; | |
} | |
return proof; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment