Save and load exchange rates with persistent JSON file #13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #12.
The exchange rates map is now persisted in
<datadir>/exchangerates.json
whenever it is updated via the newsetfeeexchangerates
RPC.Also, the server parameter
exchangeratesjsonfile
has been renamed toinitialexchangeratesjsonfile
to distinguish it from the database file. If the initialization file isn't provided and the database file doesn't exist, it will be created at startup with a default valuation for the policy asset. And if the initialization file is provided and the database file already exists, it will be overwritten with the values in the initialization file. In any case, the initialization file will never be modified by the node unless it resolves to the same path as the database file.I also switched to using as much of the existing functionality for saving and loading settings found in
<util/settings.h>
, since settings are also persisted as a JSON file in<datadir>
. The banlist database also uses the same mechanisms.