mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
[wallet] Add dummy wallet init class
This commit is contained in:
parent
49baa4a462
commit
c7ec524389
@ -20,8 +20,8 @@
|
|||||||
#include <utilstrencodings.h>
|
#include <utilstrencodings.h>
|
||||||
#if ENABLE_WALLET
|
#if ENABLE_WALLET
|
||||||
#include <wallet/init.h>
|
#include <wallet/init.h>
|
||||||
#include <walletinitinterface.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
#include <walletinitinterface.h>
|
||||||
|
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
|
|
||||||
@ -65,6 +65,8 @@ bool AppInit(int argc, char* argv[])
|
|||||||
|
|
||||||
#if ENABLE_WALLET
|
#if ENABLE_WALLET
|
||||||
g_wallet_init_interface.reset(new WalletInit);
|
g_wallet_init_interface.reset(new WalletInit);
|
||||||
|
#else
|
||||||
|
g_wallet_init_interface.reset(new DummyWalletInit);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
30
src/init.cpp
30
src/init.cpp
@ -188,9 +188,7 @@ void Shutdown()
|
|||||||
StopREST();
|
StopREST();
|
||||||
StopRPC();
|
StopRPC();
|
||||||
StopHTTPServer();
|
StopHTTPServer();
|
||||||
if (g_wallet_init_interface) {
|
g_wallet_init_interface->Flush();
|
||||||
g_wallet_init_interface->Flush();
|
|
||||||
}
|
|
||||||
StopMapPort();
|
StopMapPort();
|
||||||
|
|
||||||
// Because these depend on each-other, we make sure that neither can be
|
// Because these depend on each-other, we make sure that neither can be
|
||||||
@ -248,9 +246,7 @@ void Shutdown()
|
|||||||
pcoinsdbview.reset();
|
pcoinsdbview.reset();
|
||||||
pblocktree.reset();
|
pblocktree.reset();
|
||||||
}
|
}
|
||||||
if (g_wallet_init_interface) {
|
g_wallet_init_interface->Stop();
|
||||||
g_wallet_init_interface->Stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if ENABLE_ZMQ
|
#if ENABLE_ZMQ
|
||||||
if (pzmqNotificationInterface) {
|
if (pzmqNotificationInterface) {
|
||||||
@ -270,9 +266,7 @@ void Shutdown()
|
|||||||
UnregisterAllValidationInterfaces();
|
UnregisterAllValidationInterfaces();
|
||||||
GetMainSignals().UnregisterBackgroundSignalScheduler();
|
GetMainSignals().UnregisterBackgroundSignalScheduler();
|
||||||
GetMainSignals().UnregisterWithMempoolSignals(mempool);
|
GetMainSignals().UnregisterWithMempoolSignals(mempool);
|
||||||
if (g_wallet_init_interface) {
|
g_wallet_init_interface->Close();
|
||||||
g_wallet_init_interface->Close();
|
|
||||||
}
|
|
||||||
g_wallet_init_interface.reset();
|
g_wallet_init_interface.reset();
|
||||||
globalVerifyHandle.reset();
|
globalVerifyHandle.reset();
|
||||||
ECC_Stop();
|
ECC_Stop();
|
||||||
@ -415,9 +409,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
|||||||
strUsage += HelpMessageOpt("-whitelist=<IP address or network>", _("Whitelist peers connecting from the given IP address (e.g. 1.2.3.4) or CIDR notated network (e.g. 1.2.3.0/24). Can be specified multiple times.") +
|
strUsage += HelpMessageOpt("-whitelist=<IP address or network>", _("Whitelist peers connecting from the given IP address (e.g. 1.2.3.4) or CIDR notated network (e.g. 1.2.3.0/24). Can be specified multiple times.") +
|
||||||
" " + _("Whitelisted peers cannot be DoS banned and their transactions are always relayed, even if they are already in the mempool, useful e.g. for a gateway"));
|
" " + _("Whitelisted peers cannot be DoS banned and their transactions are always relayed, even if they are already in the mempool, useful e.g. for a gateway"));
|
||||||
|
|
||||||
if (g_wallet_init_interface) {
|
strUsage += g_wallet_init_interface->GetHelpString(showDebug);
|
||||||
strUsage += g_wallet_init_interface->GetHelpString(showDebug);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if ENABLE_ZMQ
|
#if ENABLE_ZMQ
|
||||||
strUsage += HelpMessageGroup(_("ZeroMQ notification options:"));
|
strUsage += HelpMessageGroup(_("ZeroMQ notification options:"));
|
||||||
@ -1091,7 +1083,7 @@ bool AppInitParameterInteraction()
|
|||||||
return InitError(strprintf("acceptnonstdtxn is not currently supported for %s chain", chainparams.NetworkIDString()));
|
return InitError(strprintf("acceptnonstdtxn is not currently supported for %s chain", chainparams.NetworkIDString()));
|
||||||
nBytesPerSigOp = gArgs.GetArg("-bytespersigop", nBytesPerSigOp);
|
nBytesPerSigOp = gArgs.GetArg("-bytespersigop", nBytesPerSigOp);
|
||||||
|
|
||||||
if (g_wallet_init_interface && !g_wallet_init_interface->ParameterInteraction()) return false;
|
if (!g_wallet_init_interface->ParameterInteraction()) return false;
|
||||||
|
|
||||||
fIsBareMultisigStd = gArgs.GetBoolArg("-permitbaremultisig", DEFAULT_PERMIT_BAREMULTISIG);
|
fIsBareMultisigStd = gArgs.GetBoolArg("-permitbaremultisig", DEFAULT_PERMIT_BAREMULTISIG);
|
||||||
fAcceptDatacarrier = gArgs.GetBoolArg("-datacarrier", DEFAULT_ACCEPT_DATACARRIER);
|
fAcceptDatacarrier = gArgs.GetBoolArg("-datacarrier", DEFAULT_ACCEPT_DATACARRIER);
|
||||||
@ -1254,9 +1246,7 @@ bool AppInitMain()
|
|||||||
* available in the GUI RPC console even if external calls are disabled.
|
* available in the GUI RPC console even if external calls are disabled.
|
||||||
*/
|
*/
|
||||||
RegisterAllCoreRPCCommands(tableRPC);
|
RegisterAllCoreRPCCommands(tableRPC);
|
||||||
if (g_wallet_init_interface) {
|
g_wallet_init_interface->RegisterRPC(tableRPC);
|
||||||
g_wallet_init_interface->RegisterRPC(tableRPC);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Start the RPC server already. It will be started in "warmup" mode
|
/* Start the RPC server already. It will be started in "warmup" mode
|
||||||
* and not really process calls already (but it will signify connections
|
* and not really process calls already (but it will signify connections
|
||||||
@ -1273,7 +1263,7 @@ bool AppInitMain()
|
|||||||
int64_t nStart;
|
int64_t nStart;
|
||||||
|
|
||||||
// ********************************************************* Step 5: verify wallet database integrity
|
// ********************************************************* Step 5: verify wallet database integrity
|
||||||
if (g_wallet_init_interface && !g_wallet_init_interface->Verify()) return false;
|
if (!g_wallet_init_interface->Verify()) return false;
|
||||||
|
|
||||||
// ********************************************************* Step 6: network initialization
|
// ********************************************************* Step 6: network initialization
|
||||||
// Note that we absolutely cannot open any actual connections
|
// Note that we absolutely cannot open any actual connections
|
||||||
@ -1592,7 +1582,7 @@ bool AppInitMain()
|
|||||||
fFeeEstimatesInitialized = true;
|
fFeeEstimatesInitialized = true;
|
||||||
|
|
||||||
// ********************************************************* Step 8: load wallet
|
// ********************************************************* Step 8: load wallet
|
||||||
if (g_wallet_init_interface && !g_wallet_init_interface->Open()) return false;
|
if (!g_wallet_init_interface->Open()) return false;
|
||||||
|
|
||||||
// ********************************************************* Step 9: data directory maintenance
|
// ********************************************************* Step 9: data directory maintenance
|
||||||
|
|
||||||
@ -1738,9 +1728,7 @@ bool AppInitMain()
|
|||||||
SetRPCWarmupFinished();
|
SetRPCWarmupFinished();
|
||||||
uiInterface.InitMessage(_("Done loading"));
|
uiInterface.InitMessage(_("Done loading"));
|
||||||
|
|
||||||
if (g_wallet_init_interface) {
|
g_wallet_init_interface->Start(scheduler);
|
||||||
g_wallet_init_interface->Start(scheduler);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,8 @@
|
|||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
#include <wallet/init.h>
|
#include <wallet/init.h>
|
||||||
#include <wallet/wallet.h>
|
#include <wallet/wallet.h>
|
||||||
#include <walletinitinterface.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
#include <walletinitinterface.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
@ -674,6 +674,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Hook up the wallet init interface
|
// Hook up the wallet init interface
|
||||||
g_wallet_init_interface.reset(new WalletInit);
|
g_wallet_init_interface.reset(new WalletInit);
|
||||||
|
#else
|
||||||
|
g_wallet_init_interface.reset(new DummyWalletInit);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// 9. Main GUI initialization
|
/// 9. Main GUI initialization
|
||||||
|
@ -34,4 +34,18 @@ public:
|
|||||||
virtual ~WalletInitInterface() {}
|
virtual ~WalletInitInterface() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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 {return true;}
|
||||||
|
void Start(CScheduler& scheduler) override {}
|
||||||
|
void Flush() override {}
|
||||||
|
void Stop() override {}
|
||||||
|
void Close() override {}
|
||||||
|
};
|
||||||
|
|
||||||
#endif // WALLETINITINTERFACE_H
|
#endif // WALLETINITINTERFACE_H
|
||||||
|
Loading…
Reference in New Issue
Block a user