mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 23:29:12 +01:00
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.
This commit is contained in:
@@ -46,7 +46,6 @@ static RPCHelpMan getwalletinfo()
|
||||
{RPCResult::Type::STR_AMOUNT, "unconfirmed_balance", "DEPRECATED. Identical to getbalances().mine.untrusted_pending"},
|
||||
{RPCResult::Type::STR_AMOUNT, "immature_balance", "DEPRECATED. Identical to getbalances().mine.immature"},
|
||||
{RPCResult::Type::NUM, "txcount", "the total number of transactions in the wallet"},
|
||||
{RPCResult::Type::NUM_TIME, "keypoololdest", /*optional=*/true, "the " + UNIX_EPOCH_TIME + " 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)"},
|
||||
{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)"},
|
||||
{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()
|
||||
obj.pushKV("unconfirmed_balance", ValueFromAmount(bal.m_mine_untrusted_pending));
|
||||
obj.pushKV("immature_balance", ValueFromAmount(bal.m_mine_immature));
|
||||
obj.pushKV("txcount", (int)pwallet->mapWallet.size());
|
||||
const auto kp_oldest = pwallet->GetOldestKeyPoolTime();
|
||||
if (kp_oldest.has_value()) {
|
||||
obj.pushKV("keypoololdest", kp_oldest.value());
|
||||
}
|
||||
obj.pushKV("keypoolsize", (int64_t)kpExternalSize);
|
||||
|
||||
if (pwallet->CanSupportFeature(FEATURE_HD_SPLIT)) {
|
||||
|
||||
@@ -1189,13 +1189,6 @@ bool DescriptorScriptPubKeyMan::HaveCryptedKeys() const
|
||||
return !m_map_crypted_keys.empty();
|
||||
}
|
||||
|
||||
std::optional<int64_t> DescriptorScriptPubKeyMan::GetOldestKeyPoolTime() const
|
||||
{
|
||||
// This is only used for getwalletinfo output and isn't relevant to descriptor wallets.
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
||||
unsigned int DescriptorScriptPubKeyMan::GetKeyPoolSize() const
|
||||
{
|
||||
LOCK(cs_desc_man);
|
||||
|
||||
@@ -133,8 +133,6 @@ public:
|
||||
//! The action to do when the DB needs rewrite
|
||||
virtual void RewriteDB() {}
|
||||
|
||||
virtual std::optional<int64_t> GetOldestKeyPoolTime() const { return GetTime(); }
|
||||
|
||||
virtual unsigned int GetKeyPoolSize() const { return 0; }
|
||||
|
||||
virtual int64_t GetTimeFirstKey() const { return 0; }
|
||||
@@ -364,7 +362,6 @@ public:
|
||||
std::optional<CKey> GetKey(const CKeyID& keyid) const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man);
|
||||
bool HaveCryptedKeys() const override;
|
||||
|
||||
std::optional<int64_t> GetOldestKeyPoolTime() const override;
|
||||
unsigned int GetKeyPoolSize() const override;
|
||||
|
||||
int64_t GetTimeFirstKey() const override;
|
||||
|
||||
@@ -2506,20 +2506,6 @@ util::Result<CTxDestination> CWallet::GetNewChangeDestination(const OutputType t
|
||||
return op_dest;
|
||||
}
|
||||
|
||||
std::optional<int64_t> CWallet::GetOldestKeyPoolTime() const
|
||||
{
|
||||
LOCK(cs_wallet);
|
||||
if (m_spk_managers.empty()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<int64_t> oldest_key{std::numeric_limits<int64_t>::max()};
|
||||
for (const auto& spk_man_pair : m_spk_managers) {
|
||||
oldest_key = std::min(oldest_key, spk_man_pair.second->GetOldestKeyPoolTime());
|
||||
}
|
||||
return oldest_key;
|
||||
}
|
||||
|
||||
void CWallet::MarkDestinationsDirty(const std::set<CTxDestination>& destinations) {
|
||||
for (auto& entry : mapWallet) {
|
||||
CWalletTx& wtx = entry.second;
|
||||
|
||||
@@ -733,8 +733,6 @@ public:
|
||||
size_t KeypoolCountExternalKeys() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
bool TopUpKeyPool(unsigned int kpSize = 0);
|
||||
|
||||
std::optional<int64_t> GetOldestKeyPoolTime() const;
|
||||
|
||||
// Filter struct for 'ListAddrBookAddresses'
|
||||
struct AddrBookFilter {
|
||||
// Fetch addresses with the provided label
|
||||
|
||||
Reference in New Issue
Block a user