Skip to content

Commit 638a4c0

Browse files
committed
Merge bitcoin/bitcoin#32596: wallet, rpc, doc: various legacy wallet removal cleanups in RPCs
e5cbea4 rpc: doc: remove redundant "descriptors" parameter in `createwallet` examples (Sebastian Falbesoner) 7a05f94 rpc: doc: drop descriptor wallet mentions in fast wallet rescan related RPCs (Sebastian Falbesoner) db465a5 wallet, rpc: remove obsolete "keypoololdest" result field/code (Sebastian Falbesoner) Pull request description: This PR contains a few smaller wallet RPC cleanups based on that we only ever operate on descriptor wallets now: * remove the now obsolete "keypoololdest" field from the `getwalletinfo` RPC and the corresponding CWallet/ScriptPubKeyMan methods * in RPCs where potential fast wallet rescan is documented, remove the "descriptor wallet" mentions (back then introduced in commit ca48a46, PR #25957) * for the `createwallet` RPC examples, remove the "descriptors" parameters that always have to be true now (proposed in bitcoin/bitcoin#31250 (comment); corresponds to 86de8c1, PR #32544 which did the same for functional tests) ACKs for top commit: achow101: ACK e5cbea4 1440000bytes: ACK bitcoin/bitcoin@e5cbea4 rkrux: ACK e5cbea4 Tree-SHA512: d785f621af3f3987b258e5d7fb8309344fb13c2cf41855f8adf99ff89f581142db36e3ba59919d6abf82662caa3f7e4a2bd38eba1be9e23665e6a4a23ee52acd
2 parents 2df824f + e5cbea4 commit 638a4c0

File tree

7 files changed

+6
-37
lines changed

7 files changed

+6
-37
lines changed

src/wallet/rpc/backup.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,8 @@ RPCHelpMan restorewallet()
611611
return RPCHelpMan{
612612
"restorewallet",
613613
"Restores and loads a wallet from backup.\n"
614-
"\nThe rescan is significantly faster if a descriptor wallet is restored"
615-
"\nand block filters are available (using startup option \"-blockfilterindex=1\").\n",
614+
"\nThe rescan is significantly faster if block filters are available"
615+
"\n(using startup option \"-blockfilterindex=1\").\n",
616616
{
617617
{"wallet_name", RPCArg::Type::STR, RPCArg::Optional::NO, "The name that will be applied to the restored wallet"},
618618
{"backup_file", RPCArg::Type::STR, RPCArg::Optional::NO, "The backup file that will be used to restore the wallet."},

src/wallet/rpc/transactions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -857,8 +857,8 @@ RPCHelpMan rescanblockchain()
857857
"rescanblockchain",
858858
"Rescan the local blockchain for wallet related transactions.\n"
859859
"Note: Use \"getwalletinfo\" to query the scanning progress.\n"
860-
"The rescan is significantly faster when used on a descriptor wallet\n"
861-
"and block filters are available (using startup option \"-blockfilterindex=1\").\n",
860+
"The rescan is significantly faster if block filters are available\n"
861+
"(using startup option \"-blockfilterindex=1\").\n",
862862
{
863863
{"start_height", RPCArg::Type::NUM, RPCArg::Default{0}, "block height where the rescan should start"},
864864
{"stop_height", RPCArg::Type::NUM, RPCArg::Optional::OMITTED, "the last block height that should be scanned. If none is provided it will rescan up to the tip at return time of this call."},

src/wallet/rpc/wallet.cpp

Lines changed: 2 additions & 7 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)) {
@@ -356,8 +351,8 @@ static RPCHelpMan createwallet()
356351
RPCExamples{
357352
HelpExampleCli("createwallet", "\"testwallet\"")
358353
+ HelpExampleRpc("createwallet", "\"testwallet\"")
359-
+ HelpExampleCliNamed("createwallet", {{"wallet_name", "descriptors"}, {"avoid_reuse", true}, {"descriptors", true}, {"load_on_startup", true}})
360-
+ HelpExampleRpcNamed("createwallet", {{"wallet_name", "descriptors"}, {"avoid_reuse", true}, {"descriptors", true}, {"load_on_startup", true}})
354+
+ HelpExampleCliNamed("createwallet", {{"wallet_name", "descriptors"}, {"avoid_reuse", true}, {"load_on_startup", true}})
355+
+ HelpExampleRpcNamed("createwallet", {{"wallet_name", "descriptors"}, {"avoid_reuse", true}, {"load_on_startup", true}})
361356
},
362357
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
363358
{

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)