Merge bitcoin/bitcoin#25896: wallet: Log when Wallet::SetMinVersion sets a different minversion

835bd27e9a0dd627f266e3dc0a7422d8d0612eff Wallet::SetMinVersion - Log the new minversion (Ali Sherief)

Pull request description:

  This change prints a single additional line in the debug.log when bitcoin-cli loads a wallet using `loadwallet` (*not* `createwallet`).

  When Bitcoin Core creates a wallet, it's `minversion` is set to `FEATURE_BASE`, which is 10500. However, once the wallet is unloaded using `unloadwallet` or through program termination, and subsequently loaded again, `loadwallet` updates the `minversion` in the wallet.dat file to `FEATURE_LATEST`, currently 169900.

  The current logging format prints the very old wallet version during `createwallet`, and then the actual version in calls to `loadwallet`. This has confused at least one person ([reference](https://bitcointalk.org/index.php?topic=5410650.0) - I was the one who asked there if there were plans to change that behavior, and was subsequently redirected here by achow), so it will be very helpful to users to explicitly specify in the logs what the walletdb is doing.

ACKs for top commit:
  achow101:
    ACK 835bd27e9a0dd627f266e3dc0a7422d8d0612eff

Tree-SHA512: 967c8c617e06a84915ddb147378ec3c8b0343e45f43145ec78df9cbc0201867f49c8e11cd068c403eb5ec06e07d38c3c0d3864dad8edc5efbb134a3fb30be41f
This commit is contained in:
Andrew Chow 2022-08-26 16:41:29 -04:00 committed by pasta
parent 12b438cb46
commit c72ef299da
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -470,6 +470,7 @@ void CWallet::SetMinVersion(enum WalletFeature nVersion, WalletBatch* batch_in)
LOCK(cs_wallet); LOCK(cs_wallet);
if (nWalletVersion >= nVersion) if (nWalletVersion >= nVersion)
return; return;
WalletLogPrintf("Setting minversion to %d\n", nVersion);
nWalletVersion = nVersion; nWalletVersion = nVersion;
{ {