ssbc / ssb-db2

A new database for secure-scuttlebutt
47 stars 8 forks source link

`reindexEncrypted` and leveldb indexes #415

Open staltz opened 1 year ago

staltz commented 1 year ago

Problem: reindexEncrypted will call index.processRecord(record, seq, pValue) for every freshly-decrypted box2 msg, but leveldb indexes may build state in such a way that assumes that all records are processed in order.

For instance, take the ssb-about-self index. Every time it stumbles upon an about message, it will destructively update the state of the user profile.

So if the "latest" user profile was published on the about message at sequence 10, if we just decrypted a box2 about message at sequence 6, this one will override the actual latest information from sequence 10.