-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Description
Credit to @luke-jr for helping uncovering this bug bitcoin-core/gui#379 (comment)
This bug has no user-visible effects currently, but combined with PR bitcoin-core/gui#379 and a corrupt settings.json file that is corrupted specifically by specifying the same JSON keys multiple times, it can cause some dialog text added in that PR to be misleading. This is a basically an impossible-to-hit rube goldberg bug, but is only fixable at the util level not the GUI level, so I'm tracking this outside the GUI repository.
Simplest fix would be to just change ReadSettingsFile to call rw_settings.clear() on error. It would also be nice to add a unit test for the regression.
Code path that triggers this is:
Line 548 in d67330d
| if (!util::ReadSettings(path, m_settings.rw_settings, read_errors)) { |
Line 89 in d67330d
| errors.emplace_back(strprintf("Found duplicate key %s in settings file %s", in_keys[i], path.string())); |
Line 92 in d67330d
| return errors.empty(); |