Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected handling of wallet.(timestamp).bak file #7647

Closed
subSTRATA opened this issue Mar 6, 2016 · 7 comments
Closed

Unexpected handling of wallet.(timestamp).bak file #7647

subSTRATA opened this issue Mar 6, 2016 · 7 comments
Labels

Comments

@subSTRATA
Copy link

For some reason wallet.(timestamp).bak file which was created after user messed with wallet.dat file name WHILE Bitcoin Core was running is missing, any traces of file are gone. It is actualy more complicated so please check the thread at https://bitcointalk.org/index.php?topic=1389123.0 and follow procedure at https://bitcointalk.org/index.php?topic=1389123.msg14114474#msg14114474 to replicate the issue.

@maflcko
Copy link
Member

maflcko commented Mar 6, 2016

I can't reproduce...

Indeed, moving the wallet file to another destination while Bitcoin Core is running will cause

2016-03-06 15:07:22 Shutdown: In progress...
2016-03-06 15:07:22 StopNode()
2016-03-06 15:07:22 *** System error while flushing: CDB: Error 2, can't open database 
2016-03-06 15:07:27 CDBEnv::EnvShutdown: Error 2 shutting down database environment: No such file or directory
2016-03-06 15:07:27 Shutdown: done

in the debug log on shutdown. Though, I fail to see how someone could lose the wallet file by this: The wallet file should still be at the location you moved it to. (Even though it might be slightly corrupt)

@maflcko
Copy link
Member

maflcko commented Mar 6, 2016

@subSTRATA Please provide exact steps to reproduce, preferably from the command line. Something like

>bitcoin-qt.exe -regtest -datadir=New_folder
>move "New_folder\regtest\wallet.dat" New_folder\regtest\wallet.dat_bak
        1 file(s) moved.

@subSTRATA
Copy link
Author

Read https://bitcointalk.org/index.php?topic=1389123.msg14114474#msg14114474 very carefuly, it is not about moving wallet.dat file while Bitcoin Core is running.

@subSTRATA
Copy link
Author

Issue occurs ONLY if wallet.dat file was created and renamed within the same session. If Bitcoin Core was restarted between creation of a new wallet.dat file and renaming of it then no problems occur, see step 2b. and consequently different outcome at step 5.

1. Shutdown Bitcoin Core then move existing wallet.dat to some other directory.
2. Start Bitcoin Core, it will create a new wallet.dat file.
2b. Restart Bitcoin Core.
3. While Bitcoin Core is running, rename newly created wallet.dat to whatever else.
4. Shutdown Bitcoin Core, it will throw an error and exit.
5. Rename file back to wallet.dat and start Bitcoin Core again, no problems whatsoever.

@maflcko
Copy link
Member

maflcko commented Mar 6, 2016

I see; This is not reproducible always. Pretty much you rename a corrupt wallet.(timestamp).bak file to wallet.dat until you get a __db* file, which will be deleted on the next start. I could reproduce once but I forgot to save the wallet.(ts).bak file. Would you mind uploading one? (Make sure it is for testnet/regnet or does not contain any relevant keys)

@subSTRATA
Copy link
Author

I can reproduce it always, just follow procedure exactly. Just in case it realy does not work for you every time, here is .bak file which Bitcoin Core just created, mainnet private keys but no worries, wallet was created just for this test.

https://mega.nz/#!yAZzSQbZ!mZK0q43dm1BIXvIQAx2ZiuCXZRk3_o9shiv2pTcTmrk

@meshcollider
Copy link
Contributor

I've tried to reproduce this following the steps from the bitcointalk thread on 0.16 and using the downloadable wallet above, and cannot reproduce, so this can be closed

@fanquake fanquake closed this as completed Mar 6, 2018
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants