Simple fix change.
At the moment, during salvagewallet/recover, we rename the wallet to wallet.<timestamp>.bak
regardless of a possible custom wallet filename (-wallet=
).
This fix is “required” for multiwallet via #8694.
Simple fix change.
At the moment, during salvagewallet/recover, we rename the wallet to wallet.<timestamp>.bak
regardless of a possible custom wallet filename (-wallet=
).
This fix is “required” for multiwallet via #8694.
utACK https://github.com/bitcoin/bitcoin/pull/10457/commits/f4823abad5bd2c9a556f3ebf2b87160c94f693ed.
If I read correctly this will change the name to <something>.dat.<timestamp>.bak
but that’s okay.
Concept ACK. Not having this blocks multi-wallet.
I’d be a lot happier if the -salvagewallet test was being run. It’s currently commented out of wallet.py because of intermittent failure (#7463). I’ll spend some time seeing if I can fix those failures.
It’s currently commented out of wallet.py because of intermittent failure (#7463)
Yes I narrowed it down to a berkeleydb issue last time, and wasn’t sure how to proceed:
uncommented the salvagewallet check and run in a loop without issues
I can reproduce this by running wallet.py
50 times through test_runner.py. From debug.log:
02017-06-05 15:46:54.510473 CDBEnv::Salvage: Database salvage found errors, all data may not be recoverable.
12017-06-05 15:46:54.510639 CDBEnv::Salvage: WARNING: Number of keys in data does not match number of values.
22017-06-05 15:46:54.510648 CDBEnv::Salvage: WARNING: Unexpected end of file while reading salvage output.
32017-06-05 15:46:54.510657 Salvage(aggressive) found 102 records
Tested ACK with one small nit:
Please update the comment at the top of CDB::Recover() from:
// move wallet file to wallet.timestamp.bak
to:
// move wallet file to <wallet_name>.<timestamp>.bak
Otherwise looks good. I’ve tested f4823abad5bd2c9a556f3ebf2b87160c94f693ed and it renames the wallet backups correctly.
This reverts commit b823a4c9f6836c802803dbd265cb7451fb93b8e7.
PR title and summary are misleading because now this PR only does code cleanup without actually changing the filename.
Also, I prefer b823a4c9f6836c802803dbd265cb7451fb93b8e7 to this PR, because it prints a more meaningful log message, and I don’t think it is a big deal that the recover function now takes 2 arguments instead of 1.
I think if you wanted to clean up this code, you would just call the recover function directly or through std::function instead through a raw function pointer.
272 warningStr = strprintf(_("Warning: Wallet file corrupt, data salvaged!"
273 " Original %s saved as %s in %s; if"
274 " your balance or transactions are incorrect you should"
275 " restore from a backup."),
276- walletFile, backup_filename, dataDir);
277+ walletFile, "{walletfilename}.{timestamp}.bak", dataDir);
54@@ -55,8 +55,7 @@ class CDBEnv
55 enum VerifyResult { VERIFY_OK,
56 RECOVER_OK,
57 RECOVER_FAIL };
58- typedef bool (*recoverFunc_type)(const std::string& strFile, std::string& out_backup_filename);
PR description and title are misleading and need to be updated (especially now that PR description will go into git history) to say this is only changing the Wallet file corrupt, data salvaged!
error message (by removing the recovered filename), and making a slight code simplification.
This PR is not fixing any current bug. It’s just temporarily reintroducing a bug that was fixed a while ago, and then applying a slightly simpler fix. IMO, squashing commit history in this PR would be a good way to make it less confusing and avoid temporarily reintroducing a bug.