Open leblowl opened 1 year ago
This seems like part of this existing round of work and something we should do before release.
Initially I was thinking we can use a key/value store for CSRs, however I think it's important to maintain some sense of order with the CSRs. The key/value store doesn't maintain insertion order in the version of OrbitDB we are using (the in-memory data structure is just a plain JS object). So I think we should keep this as an event store for now. However, I think this is still true:
There should only be one active CSR per pubKey.
And we don't want old CSRs piling up in memory. So at some point I think we will want to have an approach for deleting CSRs such that there is only one per public key. And for now we can just be careful to only process the most recent CSR for each public key.
This reduces the amount of CSRs loaded into memory. There should only be one active CSR per pubKey.