aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/init.cpp39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp
index b6f4a0e1e1..2fd9aa1a6f 100644
--- a/src/wallet/init.cpp
+++ b/src/wallet/init.cpp
@@ -18,39 +18,38 @@ 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;
+const WalletInitInterface& g_wallet_init_interface = WalletInit();
-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 +91,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 +219,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 +228,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 +303,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 +321,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;