Skip to content

Commit d894894

Browse files
committed
wallet: Refactor to WalletInitInterface* const g_wallet_init_interface
1 parent 39bc2fa commit d894894

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/init.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ class DummyWalletInit : public WalletInitInterface {
8888
void Close() override {}
8989
};
9090

91-
std::unique_ptr<WalletInitInterface> g_wallet_init_interface(new DummyWalletInit);
91+
static DummyWalletInit g_dummy_wallet_init;
92+
WalletInitInterface* const g_wallet_init_interface = &g_dummy_wallet_init;
9293
#endif
9394

9495
#if ENABLE_ZMQ
@@ -283,7 +284,6 @@ void Shutdown()
283284
GetMainSignals().UnregisterBackgroundSignalScheduler();
284285
GetMainSignals().UnregisterWithMempoolSignals(mempool);
285286
g_wallet_init_interface->Close();
286-
g_wallet_init_interface.reset();
287287
globalVerifyHandle.reset();
288288
ECC_Stop();
289289
LogPrintf("%s: done\n", __func__);

src/init.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class CScheduler;
1313
class CWallet;
1414

1515
class WalletInitInterface;
16-
extern std::unique_ptr<WalletInitInterface> g_wallet_init_interface;
16+
extern WalletInitInterface* const g_wallet_init_interface;
1717

1818
namespace boost
1919
{

src/wallet/init.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

66
#include <chainparams.h>
7+
#include <init.h>
78
#include <net.h>
89
#include <util.h>
910
#include <utilmoneystr.h>
@@ -46,7 +47,8 @@ class WalletInit : public WalletInitInterface {
4647
void Close() override;
4748
};
4849

49-
std::unique_ptr<WalletInitInterface> g_wallet_init_interface(new WalletInit);
50+
static WalletInit g_wallet_init;
51+
WalletInitInterface* const g_wallet_init_interface = &g_wallet_init;
5052

5153
std::string WalletInit::GetHelpString(bool showDebug)
5254
{

0 commit comments

Comments
 (0)