Linux: Snapshot not extracting in the right place
See original GitHub issueWhat happened:
The app downloaded the snapshot in ~/snapshot, a little weird and unclean, also not necessarily the same partition as the defichain folder but that worked. Then the app extracted the 7z file to ~, so it created ~/blocks, ~/chainstate and ~/enhancedcs. The app then said it was going to use it, and instead just restarted the network sync.
What you expected to happen:
1- The app should extract the files in the correct folder. 2- If 1- fails, the app should be somehow aware of it and say that something went wrong not just silently ignore the error. At least it’s able to continue the download, or stop if it’s already full, and not restart it from scratch which is already that. With a clear message, the user can easily fix the issue by moving the folders to the correct place (as I did).
How to reproduce it (as minimally and precisely as possible):
Use the sync from snapshot functionality on a Linux box.
What are your environment parameters?
- DeFi Wallet Version: 2.3.3
- Operating System (OS): Arch Linux
Anything else we need to know?:
By a quick look at the code, this is what I’m thinking:
const snapshotPath = path.join(getBaseFolder(), ‘…/’, SNAPSHOT_FOLDER);
So it depends on what getBaseFolder is, if it returns ~/.defi as I guess it would indeed download to ~/.defi/snapshot… ie ~/snapshot.
Let’s take a look:
getBaseFolder returns MAINNET_BASE_FOLDER, which on Linux is BASE_FILE_PATH, which is getCustomDebugLogFilePath(CONFIG_FILE_PATH), that in turn is either the empty string or config.datadir but I don’t know where to find the ini functions. I do not have any datadir in my conf file, the only dir is walletdir, maybe that’s the problem?
Then:
try { log.info(‘Starting extraction…’); const blocksPath = path.join(getBaseFolder(), ‘…’); const child = spawn(UNZIP_FILE_PATH, [
x
,${fileSizes.downloadPath}
,-o${blocksPath}
,-aoa
, ]);
explains why I see the blocks folder in ~/, but when it syncs that’s not where it puts the blocks folder it goes to ~/.defi/ (I didn’t check it in the code, but in my FS during network sync).
I’m glad to dig more if needed, but I’m guessing something here would be obvious to people with knowledge of this app or even just electron. Maybe @thedoublejay .
Thanks!
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (5 by maintainers)
Top GitHub Comments
Yeah no worries, as I wrote I was able to easy workaround that problem myself so there is no rush on my end, just trying to get it better for people that don’t have the skills/time to fix things. Thank you!
Congratulations on fixing this issue and the engineering work to reduce download size and synchronization time. My only suggestion would be to download the snapshot file to ~/.defi/snapshot instead of ~/snapshot to decrease pollution of the home directory. Well done!