cryptoadvance / cryptoadvance/specter-desktop
Power outage resulted in server error on restart (blank config.json, steps taken to recover)
- Dominant language
- Python
- Stars
- 847
- Forks
- 259
- Avg merge
- 6d 18h
- Merged PRs (30d)
- 2
Description
_My setup: Running specter-desktop on a Raspi4 via supervisord for auto restarts. Using the "Multiple Users" feature to keep different wallets more separated so I don't accidentally mix funds._
Power went out last night. Accessing today via browser just returns a server error.
The ~/.specter/config.json is blank. So is the .bkp. I delete both and restart specter-desktop.
A new, usable config.json is generated but watching the logs it's saying it can't load any of my wallets:
```Couldn't load wallet xxxxx into core.Silently ignored! RPC error: Request error: Wallet specterac151d0eb190f435/xxxxx not found.```
Ah, that specter UID is brand new, courtesy of the new config.json. So I find my previous UID by looking at the my bitcoin node's wallet dir (~/.bitcoin/wallet). The specter wallets are "specter***********" where that's the UID appended. I edit the specter config.json and change the UID back to what it had been. Restart specter-desktop.
Good, specter logs no longer complain and bitcoin node logs show that the wallets are loaded.
But I need to reinitialize the "Multiple Users" setting to restore access. Once I do so specter immediately picks up my user accounts. And I'm now I'm good.
Documenting all this here since there were some non-obvious steps.
Remaining work:
- No clue right now how the config.json AND its backup got wiped out.
- Need more bulletproofing around persistence.py; its json errors are what caused the server errors (though thankfully the stack trace made it pretty obvious what the problem was). If I don't get around to submitting a fix, should be a relatively easy one for someone to tackle.
```
File "/home/kdmukai/.virtualenvs/specter-desktop-env/lib/python3.7/site-packages/cryptoadvance/specter/persistence.py", line 37, in read_json_file
content = json.load(f)
File "/usr/lib/python3.7/json/__init__.py", line 296, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.7/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
```
Contributor guide
Assessment
This issue has not been assessed yet.