mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-14 16:04:03 +02:00
08925d5ee7test: add coverage for loading a wallet in a non-writable directory (furszy)0218966c0dtest: add coverage for wallet creation in non-writable directory (furszy)bc0090f1d6wallet: handle non-writable db directories (furszy) Pull request description: Make wallet creation and load fail with a clear error when the db directory isn’t writable. #### 1) For Wallet Creation Before: creating a wallet would return a generic error: "SQLiteDatabase: Failed to open database: unable to open database file" After: creating a wallet returns: "SQLiteDatabase: Failed to open database in directory <dir_path>: directory is not writable" #### 2) For Wallet Loading We currently allow loading wallets located on non-writable directories. This is problematic because the node crashes on any subsequent write; generating a block is enough to trigger it. Can be verified just by running the following test on master:85fa4e2910Also, to check directory writability, this creates a tmp file rather than relying on the `permissions()` functions, since perms bits alone may not reliably reflect actual writability in some systems. Testing Note: Pushed the tests in separate commits so they can be cherry-picked on master for comparison. ACKs for top commit: rkrux: re-ACK08925d5ee7achow101: ACK08925d5ee7seduless: Tested ACK08925d5ee7Tree-SHA512: e480eab329a1d595fe0b191e83c97956e3ff1d1e335ada8ac6fe72bc4b2bb9b13b0d49db0254d34ad75f816db06d9cd0c21d3063d7d8ee6687a7ea2324c36288