File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 8
8
#include " wallet/db.h"
9
9
#include " wallet/wallet.h"
10
10
11
- CWallet * pwalletMain;
11
+ std::unique_ptr< CWallet> pwalletMain;
12
12
13
13
WalletTestingSetup::WalletTestingSetup (const std::string& chainName):
14
14
TestingSetup(chainName)
@@ -17,18 +17,17 @@ WalletTestingSetup::WalletTestingSetup(const std::string& chainName):
17
17
18
18
bool fFirstRun ;
19
19
std::unique_ptr<CWalletDBWrapper> dbw (new CWalletDBWrapper (&bitdb, " wallet_test.dat" ));
20
- pwalletMain = new CWallet (std::move (dbw));
20
+ pwalletMain = std::unique_ptr<CWallet>( new CWallet (std::move (dbw) ));
21
21
pwalletMain->LoadWallet (fFirstRun );
22
- RegisterValidationInterface (pwalletMain);
22
+ RegisterValidationInterface (pwalletMain. get () );
23
23
24
24
RegisterWalletRPCCommands (tableRPC);
25
25
}
26
26
27
27
WalletTestingSetup::~WalletTestingSetup ()
28
28
{
29
- UnregisterValidationInterface (pwalletMain);
30
- delete pwalletMain;
31
- pwalletMain = nullptr ;
29
+ UnregisterValidationInterface (pwalletMain.get ());
30
+ pwalletMain.reset ();
32
31
33
32
bitdb.Flush (true );
34
33
bitdb.Reset ();
You can’t perform that action at this time.
0 commit comments