Re-implement neededHashes with some tree-oriented functions
The old neededHashes
function was a fairly direct port from the Python implementation in Tahoe-LAFS. It relied on vector-like random access and was written without much understanding of how it really worked.
Here is a new implementation that uses the tree structure of the data and that I actually understand. It's not as much shorter as I was hoping for but it is made out of a bunch of smaller pieces instead of being a single fused lump.
Maybe it is better?