From ec5d19665b8935eabac36df4ec1ba2e19ee05c25 Mon Sep 17 00:00:00 2001 From: David Gumberg Date: Wed, 4 Feb 2026 13:29:56 -0800 Subject: [PATCH] wallet: WalletBatch->WriteVersion respect argument. Previously would use global `CLIENT_VERSION` no matter what, but this is one sense a refactor since all of the places where WriteVersion is called currently call it with `CLIENT_VERSION` anyways. The `client_version` argument is kept since future test code may want to write other versions. Addresses a review comment from #32636: https://github.com/bitcoin/bitcoin/pull/32636#discussion_r2356299627 --- src/wallet/walletdb.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/wallet/walletdb.h b/src/wallet/walletdb.h index f5804ab95ba..2f5165f7e3d 100644 --- a/src/wallet/walletdb.h +++ b/src/wallet/walletdb.h @@ -271,8 +271,14 @@ public: DBErrors LoadWallet(CWallet* pwallet); - //! Write the given client_version. - bool WriteVersion(int client_version) { return m_batch->Write(DBKeys::VERSION, CLIENT_VERSION); } + /** + * Write the given `client_version` to m_batch, indicating the last version + * of client software to load this wallet. + * + * @param[in] client_version `CLIENT_VERSION` outside of test code. + * @return A bool indicating whether or not the write succeeded. + */ + bool WriteVersion(int client_version) { return m_batch->Write(DBKeys::VERSION, client_version); } //! Delete records of the given types bool EraseRecords(const std::unordered_set& types);