diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -2972,7 +2972,8 @@ "the total number of transactions in the wallet"}, {RPCResult::Type::NUM_TIME, "keypoololdest", "the " + UNIX_EPOCH_TIME + - " of the oldest pre-generated key in the key pool"}, + " of the oldest pre-generated key in the key pool. Legacy " + "wallets only."}, {RPCResult::Type::NUM, "keypoolsize", "how many new keys are pre-generated (only counts external " "keys)"}, @@ -3025,6 +3026,7 @@ size_t kpExternalSize = pwallet->KeypoolCountExternalKeys(); const auto bal = pwallet->GetBalance(); + int64_t kp_oldest = pwallet->GetOldestKeyPoolTime(); obj.pushKV("walletname", pwallet->GetName()); obj.pushKV("walletversion", pwallet->GetVersion()); obj.pushKV("balance", ValueFromAmount(bal.m_mine_trusted)); @@ -3032,7 +3034,9 @@ ValueFromAmount(bal.m_mine_untrusted_pending)); obj.pushKV("immature_balance", ValueFromAmount(bal.m_mine_immature)); obj.pushKV("txcount", (int)pwallet->mapWallet.size()); - obj.pushKV("keypoololdest", pwallet->GetOldestKeyPoolTime()); + if (kp_oldest > 0) { + obj.pushKV("keypoololdest", kp_oldest); + } obj.pushKV("keypoolsize", (int64_t)kpExternalSize); LegacyScriptPubKeyMan *spk_man = pwallet->GetLegacyScriptPubKeyMan(); diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp --- a/src/wallet/scriptpubkeyman.cpp +++ b/src/wallet/scriptpubkeyman.cpp @@ -1914,7 +1914,10 @@ } int64_t DescriptorScriptPubKeyMan::GetOldestKeyPoolTime() const { - return GetTime(); + // This is only used for getwalletinfo output and isn't relevant to + // descriptor wallets. The magic number 0 indicates that it shouldn't be + // displayed so that's what we return. + return 0; } size_t DescriptorScriptPubKeyMan::KeypoolCountExternalKeys() const {