Closed Powersource closed 4 years ago
For a lack of CI, the failing tests are
getHeads: Root-only graph
getHeads: Graph with simple merge
wait I remembered another case I want to add
Ok now I'm done
thanks so much for adding these tests @Powersource ! Sorry for the long delay. Please feel free to DM me on ssb in general (I honestly don't watch notifications anywhere else).
I notice this method isn't used anywhere in the repo currently, and I think in fact I've been using the reduce
function to do this. But I have an emerging need to just calculate heads without reducing, so will see what I can do about getting a working function.
Basically I think the API needs to include the entry point
Also, I think the file-name lib/misc-junk.js
was quite deliberately dodgy sounding. i.e. if you're using things from here ... look out!
Hey @Powersource I've written a function for finding heads in a way which I think is best. The tests should show how it can be used, let me know if it's not clear though.
NOTE - this ignores any dangling nodes, because for my needs and assumptions about tangles I'm working with, that's appropriate. If you want to include dangling nodes, perhaps check out ssb-sort
which is the old (and rough) tangle heads calculator.
published as ssb-tangle@2.1.0
Helps with solving https://github.com/ssbc/ssb-tangle/issues/7