Currently, Orion keeps the list of peers in memory. This works ok for a standalone node but it creates a failure point when using Orion in a cluster setup (e.g. behind a load balancer).
If we move the peer table to the storage, it won't change the way standalone Orion behaves. However, it will bring a lot of value when using 2 or more nodes with a shared relational database.
The peer table is represented by a mapping <key, url>, mapping a public key to a node url.
When updating the peer list, we should follow the same algorithm that we have today (improving the algorithm is out-of-scope). This is the current algorithm:
For each node <key,url> in the list received in the /partyinfo request:
If the key exists in the database, do nothing, else
If the key doesn't exist, create a <key,url> entry
(note that we don't override existing mappings to avoid malicious nodes trying to screw with the peer table)
Orion storing its peer list into storage, either LevelDB or relational database
No extra config needed, it should just happen
On subsequent starts, Orion should use the previously existing list of peers
Should we have a config option to say "Delete the existing table and start fresh"?