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

issue subSTRATA opened this issue on March 6, 2016
  1. subSTRATA commented at 2:02 PM on March 6, 2016: none

    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.

  2. jonasschnelli added the label Wallet on Mar 6, 2016
  3. MarcoFalke commented at 3:23 PM on March 6, 2016: member

    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)

  4. MarcoFalke commented at 3:24 PM on March 6, 2016: member

    @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.
    
  5. subSTRATA commented at 3:28 PM on March 6, 2016: none

    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.

  6. subSTRATA commented at 3:55 PM on March 6, 2016: none

    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.
    
  7. MarcoFalke commented at 4:45 PM on March 6, 2016: member

    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)

  8. subSTRATA commented at 4:58 PM on March 6, 2016: none

    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

  9. meshcollider commented at 6:43 PM on March 6, 2018: 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

  10. fanquake closed this on Mar 6, 2018

  11. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 21:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me