mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-08 21:59:10 +02:00
Merge #12977: Refactor g_wallet_init_interface to const reference
6ec78f1wallet: Refactor g_wallet_init_interface to const reference (João Barbosa)1936125wallet: Make WalletInitInterface members const (João Barbosa) Pull request description: Tree-SHA512: c382156a38d4c6beaa6c48f911d7b314542b9500d88724b2b3029dae4491cb1e60e10628f6632d1366818ccf343f494650b3171593b5450149544ba198f49bb5
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user