digidem / mapeo-core-next

The upcoming version of Mapeo Core
MIT License
7 stars 1 forks source link

fix: sync state prior to full sync should be correct #523

Closed gmaclennan closed 5 months ago

gmaclennan commented 5 months ago

Before starting sync of data, the sync state should accurately show the data that needs to be synced. There were bugs in the code that meant the "data to sync" was not accurate until the user had already started to sync the data. This PR fixes things so that after doing an "initial" sync, the sync state should accurately show how much data there is to be synced before the user starts syncing.

This PR fixes several things, because each fix revealed other bugs:

(Note: I don't really like how this has been fixed by passing around peer sync controllers and making deriveState more complex because it relies on a more complicated state.... but all I can think of for now, so hopefully "good enough").