wallet: Make WalletInitInterface members const
This commit is contained in:
parent
39439e5ab4
commit
1936125671
3 changed files with 36 additions and 36 deletions
18
src/init.cpp
18
src/init.cpp
|
@ -76,15 +76,15 @@ std::unique_ptr<PeerLogicValidation> peerLogic;
|
|||
class DummyWalletInit : public WalletInitInterface {
|
||||
public:
|
||||
|
||||
std::string GetHelpString(bool showDebug) override {return std::string{};}
|
||||
bool ParameterInteraction() override {return true;}
|
||||
void RegisterRPC(CRPCTable &) override {}
|
||||
bool Verify() override {return true;}
|
||||
bool Open() override {LogPrintf("No wallet support compiled in!\n"); return true;}
|
||||
void Start(CScheduler& scheduler) override {}
|
||||
void Flush() override {}
|
||||
void Stop() override {}
|
||||
void Close() override {}
|
||||
std::string GetHelpString(bool showDebug) const override {return std::string{};}
|
||||
bool ParameterInteraction() const override {return true;}
|
||||
void RegisterRPC(CRPCTable &) const override {}
|
||||
bool Verify() const override {return true;}
|
||||
bool Open() const override {LogPrintf("No wallet support compiled in!\n"); return true;}
|
||||
void Start(CScheduler& scheduler) const override {}
|
||||
void Flush() const override {}
|
||||
void Stop() const override {}
|
||||
void Close() const override {}
|
||||
};
|
||||
|
||||
static DummyWalletInit g_dummy_wallet_init;
|
||||
|
|
|
@ -18,39 +18,39 @@ class WalletInit : public WalletInitInterface {
|
|||
public:
|
||||
|
||||
//! Return the wallets help message.
|
||||
std::string GetHelpString(bool showDebug) override;
|
||||
std::string GetHelpString(bool showDebug) const override;
|
||||
|
||||
//! Wallets parameter interaction
|
||||
bool ParameterInteraction() override;
|
||||
bool ParameterInteraction() const override;
|
||||
|
||||
//! Register wallet RPCs.
|
||||
void RegisterRPC(CRPCTable &tableRPC) override;
|
||||
void RegisterRPC(CRPCTable &tableRPC) const override;
|
||||
|
||||
//! Responsible for reading and validating the -wallet arguments and verifying the wallet database.
|
||||
// This function will perform salvage on the wallet if requested, as long as only one wallet is
|
||||
// being loaded (WalletParameterInteraction forbids -salvagewallet, -zapwallettxes or -upgradewallet with multiwallet).
|
||||
bool Verify() override;
|
||||
bool Verify() const override;
|
||||
|
||||
//! Load wallet databases.
|
||||
bool Open() override;
|
||||
bool Open() const override;
|
||||
|
||||
//! Complete startup of wallets.
|
||||
void Start(CScheduler& scheduler) override;
|
||||
void Start(CScheduler& scheduler) const override;
|
||||
|
||||
//! Flush all wallets in preparation for shutdown.
|
||||
void Flush() override;
|
||||
void Flush() const override;
|
||||
|
||||
//! Stop all wallets. Wallets will be flushed first.
|
||||
void Stop() override;
|
||||
void Stop() const override;
|
||||
|
||||
//! Close all wallets.
|
||||
void Close() override;
|
||||
void Close() const override;
|
||||
};
|
||||
|
||||
static WalletInit g_wallet_init;
|
||||
WalletInitInterface* const g_wallet_init_interface = &g_wallet_init;
|
||||
|
||||
std::string WalletInit::GetHelpString(bool showDebug)
|
||||
std::string WalletInit::GetHelpString(bool showDebug) const
|
||||
{
|
||||
std::string strUsage = HelpMessageGroup(_("Wallet options:"));
|
||||
strUsage += HelpMessageOpt("-addresstype", strprintf("What type of addresses to use (\"legacy\", \"p2sh-segwit\", or \"bech32\", default: \"%s\")", FormatOutputType(DEFAULT_ADDRESS_TYPE)));
|
||||
|
@ -92,7 +92,7 @@ std::string WalletInit::GetHelpString(bool showDebug)
|
|||
return strUsage;
|
||||
}
|
||||
|
||||
bool WalletInit::ParameterInteraction()
|
||||
bool WalletInit::ParameterInteraction() const
|
||||
{
|
||||
if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) {
|
||||
for (const std::string& wallet : gArgs.GetArgs("-wallet")) {
|
||||
|
@ -220,7 +220,7 @@ bool WalletInit::ParameterInteraction()
|
|||
return true;
|
||||
}
|
||||
|
||||
void WalletInit::RegisterRPC(CRPCTable &t)
|
||||
void WalletInit::RegisterRPC(CRPCTable &t) const
|
||||
{
|
||||
if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) {
|
||||
return;
|
||||
|
@ -229,7 +229,7 @@ void WalletInit::RegisterRPC(CRPCTable &t)
|
|||
RegisterWalletRPCCommands(t);
|
||||
}
|
||||
|
||||
bool WalletInit::Verify()
|
||||
bool WalletInit::Verify() const
|
||||
{
|
||||
if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) {
|
||||
return true;
|
||||
|
@ -304,7 +304,7 @@ bool WalletInit::Verify()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool WalletInit::Open()
|
||||
bool WalletInit::Open() const
|
||||
{
|
||||
if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) {
|
||||
LogPrintf("Wallet disabled!\n");
|
||||
|
@ -322,28 +322,28 @@ bool WalletInit::Open()
|
|||
return true;
|
||||
}
|
||||
|
||||
void WalletInit::Start(CScheduler& scheduler)
|
||||
void WalletInit::Start(CScheduler& scheduler) const
|
||||
{
|
||||
for (CWalletRef pwallet : vpwallets) {
|
||||
pwallet->postInitProcess(scheduler);
|
||||
}
|
||||
}
|
||||
|
||||
void WalletInit::Flush()
|
||||
void WalletInit::Flush() const
|
||||
{
|
||||
for (CWalletRef pwallet : vpwallets) {
|
||||
pwallet->Flush(false);
|
||||
}
|
||||
}
|
||||
|
||||
void WalletInit::Stop()
|
||||
void WalletInit::Stop() const
|
||||
{
|
||||
for (CWalletRef pwallet : vpwallets) {
|
||||
pwallet->Flush(true);
|
||||
}
|
||||
}
|
||||
|
||||
void WalletInit::Close()
|
||||
void WalletInit::Close() const
|
||||
{
|
||||
for (CWalletRef pwallet : vpwallets) {
|
||||
delete pwallet;
|
||||
|
|
|
@ -13,23 +13,23 @@ class CRPCTable;
|
|||
class WalletInitInterface {
|
||||
public:
|
||||
/** Get wallet help string */
|
||||
virtual std::string GetHelpString(bool showDebug) = 0;
|
||||
virtual std::string GetHelpString(bool showDebug) const = 0;
|
||||
/** Check wallet parameter interaction */
|
||||
virtual bool ParameterInteraction() = 0;
|
||||
virtual bool ParameterInteraction() const = 0;
|
||||
/** Register wallet RPC*/
|
||||
virtual void RegisterRPC(CRPCTable &) = 0;
|
||||
virtual void RegisterRPC(CRPCTable &) const = 0;
|
||||
/** Verify wallets */
|
||||
virtual bool Verify() = 0;
|
||||
virtual bool Verify() const = 0;
|
||||
/** Open wallets*/
|
||||
virtual bool Open() = 0;
|
||||
virtual bool Open() const = 0;
|
||||
/** Start wallets*/
|
||||
virtual void Start(CScheduler& scheduler) = 0;
|
||||
virtual void Start(CScheduler& scheduler) const = 0;
|
||||
/** Flush Wallets*/
|
||||
virtual void Flush() = 0;
|
||||
virtual void Flush() const = 0;
|
||||
/** Stop Wallets*/
|
||||
virtual void Stop() = 0;
|
||||
virtual void Stop() const = 0;
|
||||
/** Close wallets */
|
||||
virtual void Close() = 0;
|
||||
virtual void Close() const = 0;
|
||||
|
||||
virtual ~WalletInitInterface() {}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue