This pull request adds test coverage in test/functional/tool_wallet.py
to reproduce unexpected writes to the wallet as described in #15608 and serve as a benchmark for fixing the issue:
-
Wallet tool
info
unexpectedly writes to the wallet file if the wallet file permissions are read/write. -
Wallet tool
info
raises with “Error loading . Is wallet being used by another process?” if the wallet file permissions are read-only.
Goals:
-
Reproduce the reported issue, define the current unexpected behavior, and add test coverage to guide a future fix. Add debug-level logging for sanity checking and commented-out assertions to be uncommented when fixing the issue. Add the same coverage to the wallet tool create test and the getwalletinfo test as regression tests while fixing the issue.
-
Add info log messages as there are currently none in the test file.
-
Split the tests out to separate functions as per review feedback.
Thanks to Marco Falke for pointing me in the right direction.