[][src]Crate ssb_causal_sort

Causally sort a collection of messages.

Returns messages sorted from newest to oldest.

If message b includes a reference to message a then we say that message b must have been published after message a, assuming these assumptions hold:

  • The hash function is not broken (Two different sets of bytes return the same hash.)
  • The person publishing message b has not guessed a valid hash of a message before it was published (extremely unlikely.)
  • The person publishing message b is not a time traveller.

This function uses daggy to build a dag of references between messages and then topologically sorts them.

If a message is not referenced by any messages you can expect it to be sorted to the start of the results (it is so new no one has referenced it yet).

Functions

causal_sort