-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store peers in the database #2439
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automatically approving tomaka's pull requests. This auto-approval will be removed once more maintainers are active.
twiggy diff reportDifference in .wasm size before and after this pull request.
|
bin/light-base/src/lib.rs
Outdated
serde_json::from_str(&encoded).unwrap() | ||
} | ||
None => { | ||
// If the database can't be obtained, we just return a dummy value that will |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you saying services.sync_service.serialize_chain_information()
above obtains the database? maybe you thought to say "If the chain information can't be obtained"?
Close #1768
We currently store the finalized state of the chain in the database as a JSON text.
This PR modifies the format and wraps this finalized state of the chain within another object.
The format of the database now looks like
{chain:{...}, nodes:{...}}
.The
nodes
entry stores the list of nodes that we know are part of the network.The next time a chain is added with a database, we immediately insert the nodes in the k-buckets.
Because the database format is intentionally not stable, we simply ignore faulty values. This PR breaks the format of the database, but database coming from previous versions will simply be ignored.