TryQuiet / libp2p-poc

A proof of concept for off-chain p2p messaging in Zbay
0 stars 0 forks source link

All users in a channel should converge to have all messages eventually (ideally, soon) #9

Open holmesworcester opened 4 years ago

holmesworcester commented 4 years ago

We want to make sure everyone in a channel is eventually in sync. We should be aggressive about this!

We should create edge cases to try to break sync. (e.g., network gets split, morning crew talks and go offline, evening crew appears, as soon as two from both are online they should sync.)

One approach:

  1. every message includes HEAD of repo. If HEAD shows that user has more messages than you, you git fetch. Git fetch retries if that user is busy with exponential backoff.
  2. If you see someone with a HEAD behind you, you reply in a hidden message with your HEAD.
  3. Users send a special message on join to the channel so others can see they are online. This announces their HEAD. If their head is behind, they'll get replies with a later HEAD, which will trigger fetch.