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.
Concept ACK
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:
utACK f4823abad5bd2c9a556f3ebf2b87160c94f693ed (uncommented the salvagewallet check and run in a loop without issues)
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:
2017-06-05 15:46:54.510473 CDBEnv::Salvage: Database salvage found errors, all data may not be recoverable.
2017-06-05 15:46:54.510639 CDBEnv::Salvage: WARNING: Number of keys in data does not match number of values.
2017-06-05 15:46:54.510648 CDBEnv::Salvage: WARNING: Unexpected end of file while reading salvage output.
2017-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.
I think this is a much cleaner solution than was implemented in #8694. There's no need to pass around the wallet name just so it can be printed in a warning message. I think it's worth rebasing this on master and reverting the changes in https://github.com/bitcoin/bitcoin/pull/8694/commits/b823a4c9f6836c802803dbd265cb7451fb93b8e7
This reverts commit b823a4c9f6836c802803dbd265cb7451fb93b8e7.
Changed: This now reverts https://github.com/bitcoin/bitcoin/commit/b823a4c9f6836c802803dbd265cb7451fb93b8e7 and adds the identical simple fix for the static wallet name.
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.
Tested ACK e9d09f23e3a097605730988f2dcb818a57dee745. I think this is definitely an improvement.
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);
Why show a filename at all, if it's not even going to tell you which one?
I think it won't hurt. But no strong opinion.
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);
Not sure what the state of this PR is, but I just saw this change: isn't it clearer to define a type here, instead of make the function type definition in-line in the parameter definition?
And maybe use a std::function, that's more c++11 than a function pointer.
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.
I think it's better to show the actual filename, but so long as this is refactored cleanly (ie, keep the typedef), I don't care to argue against it.
I'm marginally for this change because it's a worthwhile simplification to not pass the wallet name around simply for printing in an error message. I agree with @ryanofsky that PR comment should be changed and commits squashed.
Closing this for now. I think the change in itself is worthwhile, but the diff itself seems to be controversial, the PR seems to be abandoned for a while, and it seems low priority.