earthstar-project / earthstar

Storage for private, distributed, offline-first applications.
https://earthstar-project.org
GNU Lesser General Public License v3.0
632 stars 20 forks source link

Sqlite driver fixes #242

Closed sgwilym closed 2 years ago

sgwilym commented 2 years ago

Due to how JS interprets 0 as falsy, the Sqlite driver's maxLocalIndex property would regress to -1 when it should actually be 0. This could result in being unable to write more than one document to a replica. I hope this is the fix to #240.

Tests didn't catch this because the Sqlite test scenario was marked as persistent: false. I fixed that up.

I also made it so that drivers validate share addresses. If you'd create a driver with a bad share address, it would still get to the point where it'd persist that bad share address to a file on disk.