Follow-up to #35655. Implements the approach proposed by Sjors during review.
<details> <summary>Make the <code>SQLiteDatabase</code> internal file path optional so that subclasses — such as <code>InMemoryWalletDatabase</code> — with no on-disk persistence don't need to carry an unnecessary placeholder file path.</summary>
Replace member of
SQLiteDatabaseconst std::string m_file_pathwithconst std::optional<fs::path> m_file_path, so subclasses with no on-disk persistence — such asInMemoryWalletDatabase— passstd::nulloptinstead of storing the SQLite-internal magic string ":memory:" as a placeholder file path.An
Assertin the protected constructor enforces the invariant thatm_file_pathis absent if and only ifSQLITE_OPEN_MEMORYis set, catching any future misuse at startup.Add a private
IsOnDisk()predicate to replace bareif (m_file_path)checks inOpen(),Filename(), andFiles().Files()now returns an empty vector for in-memory databases through the base class implementation, so the redundant override inInMemoryWalletDatabaseis removed. TheFilename()override inMockableSQLiteDatabaseis also removed, as the base class now correctly returns":memory:"for in-memory databases.
</details>
<details> <summary>Add a test for <code>InMemoryWalletDatabase::Filename()</code> and <code>Files()</code>.</summary>
- Add a test case verifying that
InMemoryWalletDatabase::Filename()returns":memory:"andFiles()returns an empty vector.
</details>
<ins>Note:</ins> InMemoryWalletDatabase intentionally inherits from SQLiteDatabase rather than WalletDatabase directly — it uses real SQLite semantics in memory, so all wallet code exercising it gets faithful SQLite behaviour without having to reimplement the full database layer. The optional m_file_path formalises the existing design gap rather than introducing one.