Skip to content

Commit db465a5

Browse files
committed
wallet, rpc: remove obsolete "keypoololdest" result field/code
This `getwalletinfo()` result field was only ever returned for legacy wallets and is hence not relevant anymore, so we can delete it and the corresponding CWallet/ScriptPubKeyMan code behind it.
1 parent 2df824f commit db465a5

File tree

5 files changed

+0
-31
lines changed

5 files changed

+0
-31
lines changed

src/wallet/rpc/wallet.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ static RPCHelpMan getwalletinfo()
4646
{RPCResult::Type::STR_AMOUNT, "unconfirmed_balance", "DEPRECATED. Identical to getbalances().mine.untrusted_pending"},
4747
{RPCResult::Type::STR_AMOUNT, "immature_balance", "DEPRECATED. Identical to getbalances().mine.immature"},
4848
{RPCResult::Type::NUM, "txcount", "the total number of transactions in the wallet"},
49-
{RPCResult::Type::NUM_TIME, "keypoololdest", /*optional=*/true, "the " + UNIX_EPOCH_TIME + " of the oldest pre-generated key in the key pool. Legacy wallets only."},
5049
{RPCResult::Type::NUM, "keypoolsize", "how many new keys are pre-generated (only counts external keys)"},
5150
{RPCResult::Type::NUM, "keypoolsize_hd_internal", /*optional=*/true, "how many new keys are pre-generated for internal use (used for change outputs, only appears if the wallet is using this feature, otherwise external keys are used)"},
5251
{RPCResult::Type::NUM_TIME, "unlocked_until", /*optional=*/true, "the " + UNIX_EPOCH_TIME + " until which the wallet is unlocked for transfers, or 0 if the wallet is locked (only present for passphrase-encrypted wallets)"},
@@ -91,10 +90,6 @@ static RPCHelpMan getwalletinfo()
9190
obj.pushKV("unconfirmed_balance", ValueFromAmount(bal.m_mine_untrusted_pending));
9291
obj.pushKV("immature_balance", ValueFromAmount(bal.m_mine_immature));
9392
obj.pushKV("txcount", (int)pwallet->mapWallet.size());
94-
const auto kp_oldest = pwallet->GetOldestKeyPoolTime();
95-
if (kp_oldest.has_value()) {
96-
obj.pushKV("keypoololdest", kp_oldest.value());
97-
}
9893
obj.pushKV("keypoolsize", (int64_t)kpExternalSize);
9994

10095
if (pwallet->CanSupportFeature(FEATURE_HD_SPLIT)) {

src/wallet/scriptpubkeyman.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,13 +1189,6 @@ bool DescriptorScriptPubKeyMan::HaveCryptedKeys() const
11891189
return !m_map_crypted_keys.empty();
11901190
}
11911191

1192-
std::optional<int64_t> DescriptorScriptPubKeyMan::GetOldestKeyPoolTime() const
1193-
{
1194-
// This is only used for getwalletinfo output and isn't relevant to descriptor wallets.
1195-
return std::nullopt;
1196-
}
1197-
1198-
11991192
unsigned int DescriptorScriptPubKeyMan::GetKeyPoolSize() const
12001193
{
12011194
LOCK(cs_desc_man);

src/wallet/scriptpubkeyman.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ class ScriptPubKeyMan
133133
//! The action to do when the DB needs rewrite
134134
virtual void RewriteDB() {}
135135

136-
virtual std::optional<int64_t> GetOldestKeyPoolTime() const { return GetTime(); }
137-
138136
virtual unsigned int GetKeyPoolSize() const { return 0; }
139137

140138
virtual int64_t GetTimeFirstKey() const { return 0; }
@@ -364,7 +362,6 @@ class DescriptorScriptPubKeyMan : public ScriptPubKeyMan
364362
std::optional<CKey> GetKey(const CKeyID& keyid) const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man);
365363
bool HaveCryptedKeys() const override;
366364

367-
std::optional<int64_t> GetOldestKeyPoolTime() const override;
368365
unsigned int GetKeyPoolSize() const override;
369366

370367
int64_t GetTimeFirstKey() const override;

src/wallet/wallet.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2506,20 +2506,6 @@ util::Result<CTxDestination> CWallet::GetNewChangeDestination(const OutputType t
25062506
return op_dest;
25072507
}
25082508

2509-
std::optional<int64_t> CWallet::GetOldestKeyPoolTime() const
2510-
{
2511-
LOCK(cs_wallet);
2512-
if (m_spk_managers.empty()) {
2513-
return std::nullopt;
2514-
}
2515-
2516-
std::optional<int64_t> oldest_key{std::numeric_limits<int64_t>::max()};
2517-
for (const auto& spk_man_pair : m_spk_managers) {
2518-
oldest_key = std::min(oldest_key, spk_man_pair.second->GetOldestKeyPoolTime());
2519-
}
2520-
return oldest_key;
2521-
}
2522-
25232509
void CWallet::MarkDestinationsDirty(const std::set<CTxDestination>& destinations) {
25242510
for (auto& entry : mapWallet) {
25252511
CWalletTx& wtx = entry.second;

src/wallet/wallet.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,8 +733,6 @@ class CWallet final : public WalletStorage, public interfaces::Chain::Notificati
733733
size_t KeypoolCountExternalKeys() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
734734
bool TopUpKeyPool(unsigned int kpSize = 0);
735735

736-
std::optional<int64_t> GetOldestKeyPoolTime() const;
737-
738736
// Filter struct for 'ListAddrBookAddresses'
739737
struct AddrBookFilter {
740738
// Fetch addresses with the provided label

0 commit comments

Comments
 (0)