Skip to content

Commit 4d80274

Browse files
committed
Merge #18241: wallet/refactor: refer to CWallet immutably when possible
79facb1 wallet: use constant CWallets in rpcwallet.cpp (Karl-Johan Alm) d9b0ebc wallet: make ReserveDestination pwallet ivar const (Karl-Johan Alm) 57c569e wallet: make BackupWallet() const (Karl-Johan Alm) df3a818 wallet: make getters const (Karl-Johan Alm) 227b9dd wallet/spkm: make GetOldestKeyPoolTime() const (Karl-Johan Alm) 22d329a wallet: use constant CWallets in rpcdump.cpp (Karl-Johan Alm) 7b3587b wallet/db: make IsDummy() const (Karl-Johan Alm) d366795 wallet/db: make Backup() const (Karl-Johan Alm) 8cd0b86 wallet: make CanGetAddresses() const (Karl-Johan Alm) 037fa77 wallet: make KeypoolCountExternalKeys() const (Karl-Johan Alm) ddc9355 wallet: make CanGenerateKeys() const (Karl-Johan Alm) dc2d065 make BlockUntilSyncedToCurrentChain() const (Karl-Johan Alm) Pull request description: A lot of places refer to `CWallet*`'s as `CWallet * const`, which translates to *"an immutable pointer to a mutable `CWallet` instance"*; this is 1. often not what the author meant, especially as a lot of these places do not at all modify the wallet object, and 2. confusing, as it tends to suggest that this is a proper way to refer to a constant `CWallet` instance. This PR changes references to wallets to `const CWallet* const` whenever immutability is expected. This should result in no behavioral changes at all, and improved compile-time error checking. Note from irc: > <sipa> sounds good to me; this is the sort of change that as long as it compiles, the behavior shouldn't change > <sipa> though in general it may lead to introducing automatic copying of objects sometimes (e.g. trying to std::move a const object will work, but generally result in a copy rather than an efficient move) > <sipa> CWallet objects aren't copied or moved though ACKs for top commit: laanwj: ACK 79facb1 Empact: ACK bitcoin/bitcoin@79facb1 promag: ACK 79facb1. fjahr: ACK 79facb1 Tree-SHA512: 80a80c1a52f0f788d0ccb268b53bc0f46c796643a3c5a22b55bbbde4ffa6c7e347784e5e53b1e488a3b4e14399e31d5be9417ad5b6319c74a462609e9b1a98e8
2 parents 3516a31 + 79facb1 commit 4d80274

File tree

12 files changed

+68
-68
lines changed

12 files changed

+68
-68
lines changed

src/index/base.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ void BaseIndex::ChainStateFlushed(const CBlockLocator& locator)
270270
Commit();
271271
}
272272

273-
bool BaseIndex::BlockUntilSyncedToCurrentChain()
273+
bool BaseIndex::BlockUntilSyncedToCurrentChain() const
274274
{
275275
AssertLockNotHeld(cs_main);
276276

src/index/base.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class BaseIndex : public CValidationInterface
9797
/// sync once and only needs to process blocks in the ValidationInterface
9898
/// queue. If the index is catching up from far behind, this method does
9999
/// not block and immediately returns false.
100-
bool BlockUntilSyncedToCurrentChain();
100+
bool BlockUntilSyncedToCurrentChain() const;
101101

102102
void Interrupt();
103103

src/interfaces/wallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ class WalletImpl : public Wallet
468468
}
469469
unsigned int getConfirmTarget() override { return m_wallet->m_confirm_target; }
470470
bool hdEnabled() override { return m_wallet->IsHDEnabled(); }
471-
bool canGetAddresses() override { return m_wallet->CanGetAddresses(); }
471+
bool canGetAddresses() const override { return m_wallet->CanGetAddresses(); }
472472
bool IsWalletFlagSet(uint64_t flag) override { return m_wallet->IsWalletFlagSet(flag); }
473473
OutputType getDefaultAddressType() override { return m_wallet->m_default_address_type; }
474474
OutputType getDefaultChangeType() override { return m_wallet->m_default_change_type; }

src/interfaces/wallet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ class Wallet
246246
virtual bool hdEnabled() = 0;
247247

248248
// Return whether the wallet is blank.
249-
virtual bool canGetAddresses() = 0;
249+
virtual bool canGetAddresses() const = 0;
250250

251251
// check if a certain wallet flag is set.
252252
virtual bool IsWalletFlagSet(uint64_t flag) = 0;

src/wallet/db.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ bool BerkeleyDatabase::Rewrite(const char* pszSkip)
850850
return BerkeleyBatch::Rewrite(*this, pszSkip);
851851
}
852852

853-
bool BerkeleyDatabase::Backup(const std::string& strDest)
853+
bool BerkeleyDatabase::Backup(const std::string& strDest) const
854854
{
855855
if (IsDummy()) {
856856
return false;

src/wallet/db.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class BerkeleyDatabase
157157

158158
/** Back up the entire database to a file.
159159
*/
160-
bool Backup(const std::string& strDest);
160+
bool Backup(const std::string& strDest) const;
161161

162162
/** Make sure all changes are flushed to disk.
163163
*/
@@ -193,7 +193,7 @@ class BerkeleyDatabase
193193
* Only to be used at a low level, application should ideally not care
194194
* about this.
195195
*/
196-
bool IsDummy() { return env == nullptr; }
196+
bool IsDummy() const { return env == nullptr; }
197197
};
198198

199199
/** RAII class that provides access to a Berkeley database */

src/wallet/rpcdump.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static std::string DecodeDumpString(const std::string &str) {
5454
return ret.str();
5555
}
5656

57-
static bool GetWalletAddressesForKey(LegacyScriptPubKeyMan* spk_man, CWallet* const pwallet, const CKeyID& keyid, std::string& strAddr, std::string& strLabel) EXCLUSIVE_LOCKS_REQUIRED(pwallet->cs_wallet)
57+
static bool GetWalletAddressesForKey(LegacyScriptPubKeyMan* spk_man, const CWallet* const pwallet, const CKeyID& keyid, std::string& strAddr, std::string& strLabel) EXCLUSIVE_LOCKS_REQUIRED(pwallet->cs_wallet)
5858
{
5959
bool fLabelFound = false;
6060
CKey key;
@@ -65,7 +65,7 @@ static bool GetWalletAddressesForKey(LegacyScriptPubKeyMan* spk_man, CWallet* co
6565
strAddr += ",";
6666
}
6767
strAddr += EncodeDestination(dest);
68-
strLabel = EncodeDumpString(pwallet->mapAddressBook[dest].name);
68+
strLabel = EncodeDumpString(pwallet->mapAddressBook.at(dest).name);
6969
fLabelFound = true;
7070
}
7171
}
@@ -676,7 +676,7 @@ UniValue importwallet(const JSONRPCRequest& request)
676676
UniValue dumpprivkey(const JSONRPCRequest& request)
677677
{
678678
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
679-
CWallet* const pwallet = wallet.get();
679+
const CWallet* const pwallet = wallet.get();
680680
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
681681
return NullUniValue;
682682
}
@@ -724,7 +724,7 @@ UniValue dumpprivkey(const JSONRPCRequest& request)
724724
UniValue dumpwallet(const JSONRPCRequest& request)
725725
{
726726
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
727-
CWallet* const pwallet = wallet.get();
727+
const CWallet* const pwallet = wallet.get();
728728
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
729729
return NullUniValue;
730730
}

src/wallet/rpcwallet.cpp

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
static const std::string WALLET_ENDPOINT_BASE = "/wallet/";
4242

43-
static inline bool GetAvoidReuseFlag(CWallet * const pwallet, const UniValue& param) {
43+
static inline bool GetAvoidReuseFlag(const CWallet* const pwallet, const UniValue& param) {
4444
bool can_avoid_reuse = pwallet->IsWalletFlagSet(WALLET_FLAG_AVOID_REUSE);
4545
bool avoid_reuse = param.isNull() ? can_avoid_reuse : param.get_bool();
4646

@@ -458,7 +458,7 @@ static UniValue sendtoaddress(const JSONRPCRequest& request)
458458
static UniValue listaddressgroupings(const JSONRPCRequest& request)
459459
{
460460
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
461-
CWallet* const pwallet = wallet.get();
461+
const CWallet* const pwallet = wallet.get();
462462

463463
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
464464
return NullUniValue;
@@ -520,7 +520,7 @@ static UniValue listaddressgroupings(const JSONRPCRequest& request)
520520
static UniValue signmessage(const JSONRPCRequest& request)
521521
{
522522
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
523-
CWallet* const pwallet = wallet.get();
523+
const CWallet* const pwallet = wallet.get();
524524

525525
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
526526
return NullUniValue;
@@ -590,7 +590,7 @@ static UniValue signmessage(const JSONRPCRequest& request)
590590
static UniValue getreceivedbyaddress(const JSONRPCRequest& request)
591591
{
592592
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
593-
CWallet* const pwallet = wallet.get();
593+
const CWallet* const pwallet = wallet.get();
594594

595595
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
596596
return NullUniValue;
@@ -660,7 +660,7 @@ static UniValue getreceivedbyaddress(const JSONRPCRequest& request)
660660
static UniValue getreceivedbylabel(const JSONRPCRequest& request)
661661
{
662662
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
663-
CWallet* const pwallet = wallet.get();
663+
const CWallet* const pwallet = wallet.get();
664664

665665
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
666666
return NullUniValue;
@@ -728,7 +728,7 @@ static UniValue getreceivedbylabel(const JSONRPCRequest& request)
728728
static UniValue getbalance(const JSONRPCRequest& request)
729729
{
730730
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
731-
CWallet* const pwallet = wallet.get();
731+
const CWallet* const pwallet = wallet.get();
732732

733733
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
734734
return NullUniValue;
@@ -786,7 +786,7 @@ static UniValue getbalance(const JSONRPCRequest& request)
786786
static UniValue getunconfirmedbalance(const JSONRPCRequest &request)
787787
{
788788
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
789-
CWallet* const pwallet = wallet.get();
789+
const CWallet* const pwallet = wallet.get();
790790

791791
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
792792
return NullUniValue;
@@ -1041,7 +1041,7 @@ struct tallyitem
10411041
}
10421042
};
10431043

1044-
static UniValue ListReceived(interfaces::Chain::Lock& locked_chain, CWallet * const pwallet, const UniValue& params, bool by_label) EXCLUSIVE_LOCKS_REQUIRED(pwallet->cs_wallet)
1044+
static UniValue ListReceived(interfaces::Chain::Lock& locked_chain, const CWallet* const pwallet, const UniValue& params, bool by_label) EXCLUSIVE_LOCKS_REQUIRED(pwallet->cs_wallet)
10451045
{
10461046
// Minimum confirmations
10471047
int nMinDepth = 1;
@@ -1190,7 +1190,7 @@ static UniValue ListReceived(interfaces::Chain::Lock& locked_chain, CWallet * co
11901190
static UniValue listreceivedbyaddress(const JSONRPCRequest& request)
11911191
{
11921192
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
1193-
CWallet* const pwallet = wallet.get();
1193+
const CWallet* const pwallet = wallet.get();
11941194

11951195
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
11961196
return NullUniValue;
@@ -1242,7 +1242,7 @@ static UniValue listreceivedbyaddress(const JSONRPCRequest& request)
12421242
static UniValue listreceivedbylabel(const JSONRPCRequest& request)
12431243
{
12441244
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
1245-
CWallet* const pwallet = wallet.get();
1245+
const CWallet* const pwallet = wallet.get();
12461246

12471247
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
12481248
return NullUniValue;
@@ -1302,7 +1302,7 @@ static void MaybePushAddress(UniValue & entry, const CTxDestination &dest)
13021302
* @param filter_ismine The "is mine" filter flags.
13031303
* @param filter_label Optional label string to filter incoming transactions.
13041304
*/
1305-
static void ListTransactions(interfaces::Chain::Lock& locked_chain, CWallet* const pwallet, const CWalletTx& wtx, int nMinDepth, bool fLong, UniValue& ret, const isminefilter& filter_ismine, const std::string* filter_label) EXCLUSIVE_LOCKS_REQUIRED(pwallet->cs_wallet)
1305+
static void ListTransactions(interfaces::Chain::Lock& locked_chain, const CWallet* const pwallet, const CWalletTx& wtx, int nMinDepth, bool fLong, UniValue& ret, const isminefilter& filter_ismine, const std::string* filter_label) EXCLUSIVE_LOCKS_REQUIRED(pwallet->cs_wallet)
13061306
{
13071307
CAmount nFee;
13081308
std::list<COutputEntry> listReceived;
@@ -1325,7 +1325,7 @@ static void ListTransactions(interfaces::Chain::Lock& locked_chain, CWallet* con
13251325
entry.pushKV("category", "send");
13261326
entry.pushKV("amount", ValueFromAmount(-s.amount));
13271327
if (pwallet->mapAddressBook.count(s.destination)) {
1328-
entry.pushKV("label", pwallet->mapAddressBook[s.destination].name);
1328+
entry.pushKV("label", pwallet->mapAddressBook.at(s.destination).name);
13291329
}
13301330
entry.pushKV("vout", s.vout);
13311331
entry.pushKV("fee", ValueFromAmount(-nFee));
@@ -1342,7 +1342,7 @@ static void ListTransactions(interfaces::Chain::Lock& locked_chain, CWallet* con
13421342
{
13431343
std::string label;
13441344
if (pwallet->mapAddressBook.count(r.destination)) {
1345-
label = pwallet->mapAddressBook[r.destination].name;
1345+
label = pwallet->mapAddressBook.at(r.destination).name;
13461346
}
13471347
if (filter_label && label != *filter_label) {
13481348
continue;
@@ -1402,7 +1402,7 @@ static const std::vector<RPCResult> TransactionDescriptionString()
14021402
UniValue listtransactions(const JSONRPCRequest& request)
14031403
{
14041404
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
1405-
CWallet* const pwallet = wallet.get();
1405+
const CWallet* const pwallet = wallet.get();
14061406

14071407
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
14081408
return NullUniValue;
@@ -1516,7 +1516,7 @@ UniValue listtransactions(const JSONRPCRequest& request)
15161516
static UniValue listsinceblock(const JSONRPCRequest& request)
15171517
{
15181518
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
1519-
CWallet* const pwallet = wallet.get();
1519+
const CWallet* const pwallet = wallet.get();
15201520

15211521
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
15221522
return NullUniValue;
@@ -1658,7 +1658,7 @@ static UniValue listsinceblock(const JSONRPCRequest& request)
16581658
static UniValue gettransaction(const JSONRPCRequest& request)
16591659
{
16601660
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
1661-
CWallet* const pwallet = wallet.get();
1661+
const CWallet* const pwallet = wallet.get();
16621662

16631663
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
16641664
return NullUniValue;
@@ -1817,7 +1817,7 @@ static UniValue abandontransaction(const JSONRPCRequest& request)
18171817
static UniValue backupwallet(const JSONRPCRequest& request)
18181818
{
18191819
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
1820-
CWallet* const pwallet = wallet.get();
1820+
const CWallet* const pwallet = wallet.get();
18211821

18221822
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
18231823
return NullUniValue;
@@ -2266,7 +2266,7 @@ static UniValue lockunspent(const JSONRPCRequest& request)
22662266
static UniValue listlockunspent(const JSONRPCRequest& request)
22672267
{
22682268
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
2269-
CWallet* const pwallet = wallet.get();
2269+
const CWallet* const pwallet = wallet.get();
22702270

22712271
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
22722272
return NullUniValue;
@@ -2432,7 +2432,7 @@ static UniValue getbalances(const JSONRPCRequest& request)
24322432
static UniValue getwalletinfo(const JSONRPCRequest& request)
24332433
{
24342434
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
2435-
CWallet* const pwallet = wallet.get();
2435+
const CWallet* const pwallet = wallet.get();
24362436

24372437
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
24382438
return NullUniValue;
@@ -2814,7 +2814,7 @@ static UniValue unloadwallet(const JSONRPCRequest& request)
28142814
static UniValue listunspent(const JSONRPCRequest& request)
28152815
{
28162816
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
2817-
CWallet* const pwallet = wallet.get();
2817+
const CWallet* const pwallet = wallet.get();
28182818

28192819
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
28202820
return NullUniValue;
@@ -3248,7 +3248,7 @@ static UniValue fundrawtransaction(const JSONRPCRequest& request)
32483248
UniValue signrawtransactionwithwallet(const JSONRPCRequest& request)
32493249
{
32503250
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
3251-
CWallet* const pwallet = wallet.get();
3251+
const CWallet* const pwallet = wallet.get();
32523252

32533253
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
32543254
return NullUniValue;
@@ -3728,7 +3728,7 @@ class DescribeWalletAddressVisitor : public boost::static_visitor<UniValue>
37283728
UniValue operator()(const WitnessUnknown& id) const { return UniValue(UniValue::VOBJ); }
37293729
};
37303730

3731-
static UniValue DescribeWalletAddress(CWallet* pwallet, const CTxDestination& dest)
3731+
static UniValue DescribeWalletAddress(const CWallet* const pwallet, const CTxDestination& dest)
37323732
{
37333733
UniValue ret(UniValue::VOBJ);
37343734
UniValue detail = DescribeAddress(dest);
@@ -3756,7 +3756,7 @@ static UniValue AddressBookDataToJSON(const CAddressBookData& data, const bool v
37563756
UniValue getaddressinfo(const JSONRPCRequest& request)
37573757
{
37583758
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
3759-
CWallet* const pwallet = wallet.get();
3759+
const CWallet* const pwallet = wallet.get();
37603760

37613761
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
37623762
return NullUniValue;
@@ -3858,7 +3858,7 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
38583858
// be associated with an address, so the label should be equivalent to the
38593859
// value of the name key/value pair in the labels array below.
38603860
if ((pwallet->chain().rpcEnableDeprecated("label")) && (pwallet->mapAddressBook.count(dest))) {
3861-
ret.pushKV("label", pwallet->mapAddressBook[dest].name);
3861+
ret.pushKV("label", pwallet->mapAddressBook.at(dest).name);
38623862
}
38633863

38643864
ret.pushKV("ischange", pwallet->IsChange(scriptPubKey));
@@ -3881,7 +3881,7 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
38813881
// stable if we allow multiple labels to be associated with an address in
38823882
// the future.
38833883
UniValue labels(UniValue::VARR);
3884-
std::map<CTxDestination, CAddressBookData>::iterator mi = pwallet->mapAddressBook.find(dest);
3884+
std::map<CTxDestination, CAddressBookData>::const_iterator mi = pwallet->mapAddressBook.find(dest);
38853885
if (mi != pwallet->mapAddressBook.end()) {
38863886
// DEPRECATED: The previous behavior of returning an array containing a
38873887
// JSON object of `name` and `purpose` key/value pairs is deprecated.
@@ -3899,7 +3899,7 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
38993899
static UniValue getaddressesbylabel(const JSONRPCRequest& request)
39003900
{
39013901
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
3902-
CWallet* const pwallet = wallet.get();
3902+
const CWallet* const pwallet = wallet.get();
39033903

39043904
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
39053905
return NullUniValue;
@@ -3958,7 +3958,7 @@ static UniValue getaddressesbylabel(const JSONRPCRequest& request)
39583958
static UniValue listlabels(const JSONRPCRequest& request)
39593959
{
39603960
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
3961-
CWallet* const pwallet = wallet.get();
3961+
const CWallet* const pwallet = wallet.get();
39623962

39633963
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
39643964
return NullUniValue;
@@ -4091,7 +4091,7 @@ UniValue sethdseed(const JSONRPCRequest& request)
40914091
UniValue walletprocesspsbt(const JSONRPCRequest& request)
40924092
{
40934093
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
4094-
CWallet* const pwallet = wallet.get();
4094+
const CWallet* const pwallet = wallet.get();
40954095

40964096
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
40974097
return NullUniValue;

src/wallet/scriptpubkeyman.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ bool LegacyScriptPubKeyMan::IsHDEnabled() const
358358
return !hdChain.seed_id.IsNull();
359359
}
360360

361-
bool LegacyScriptPubKeyMan::CanGetAddresses(bool internal)
361+
bool LegacyScriptPubKeyMan::CanGetAddresses(bool internal) const
362362
{
363363
LOCK(cs_KeyStore);
364364
// Check if the keypool has keys
@@ -441,7 +441,7 @@ static int64_t GetOldestKeyTimeInPool(const std::set<int64_t>& setKeyPool, Walle
441441
return keypool.nTime;
442442
}
443443

444-
int64_t LegacyScriptPubKeyMan::GetOldestKeyPoolTime()
444+
int64_t LegacyScriptPubKeyMan::GetOldestKeyPoolTime() const
445445
{
446446
LOCK(cs_KeyStore);
447447

@@ -459,7 +459,7 @@ int64_t LegacyScriptPubKeyMan::GetOldestKeyPoolTime()
459459
return oldestKey;
460460
}
461461

462-
size_t LegacyScriptPubKeyMan::KeypoolCountExternalKeys()
462+
size_t LegacyScriptPubKeyMan::KeypoolCountExternalKeys() const
463463
{
464464
LOCK(cs_KeyStore);
465465
return setExternalKeyPool.size() + set_pre_split_keypool.size();
@@ -973,7 +973,7 @@ void LegacyScriptPubKeyMan::LoadKeyPool(int64_t nIndex, const CKeyPool &keypool)
973973
mapKeyMetadata[keyid] = CKeyMetadata(keypool.nTime);
974974
}
975975

976-
bool LegacyScriptPubKeyMan::CanGenerateKeys()
976+
bool LegacyScriptPubKeyMan::CanGenerateKeys() const
977977
{
978978
// A wallet can generate keys if it has an HD seed (IsHDEnabled) or it is a non-HD wallet (pre FEATURE_HD)
979979
LOCK(cs_KeyStore);

0 commit comments

Comments
 (0)