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
This commit is contained in:
David Gumberg
2026-02-04 13:29:56 -08:00
committed by fanquake
parent f72537037d
commit ec5d19665b

View File

@@ -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<std::string>& types);