Conflict detection in WAL API
We currently allow arbitrary frames to be inserted to the WAL. Let's check the salt and the checksum to verify that a new frame matches the existing WAL. The tricky bit here is that the WAL we insert to needs to have the same salt as the origin WAL because salt is part of the cumulative checksum.
We could augment the libsql_wal_frame_insert() to force the WAL to have the same salt and checksum as the first frame. However, this seems a bit intrusive to SQLite itself, so perhaps a better approach is to use external checksumming.
There is a simple solution here: make the libsql_wal_insert_frame simply check if a frame already exists in the WAL. If it does not, append it; otherwise compare the existing and the new frame and only accept it if the frames have the same contents.
Fixed by https://github.com/tursodatabase/libsql/commit/f1d2eea349e46107a8676324ffb0b5b5223e3929