[NebulousLabs/Sia] Persist renter cache settings, and renter bandwidth limiter settings (#3052)

lukechampine commented on this pull request.

> @@ -230,24 +241,42 @@ func (r *Renter) load() error {
}
return nil
})
— if err != nil {
+}
+
+// load fetches the saved renter data from disk.
+func (r *Renter) loadSettings() error {
+ r.persist = persistence{
+ Tracking: make(map[string]trackedFile),
+ }
+ err := persist.LoadJSON(settingsMetadata, &r.persist, filepath.Join(r.persistDir, PersistFilename))

is it necessary to initialize the map here? i.e. can you do `r.persist = persistence{}`? I would expect `LoadJSON` to take care of initializing the map.

Запись редактировалась последний раз: May 30, 2018, 9:37 pm