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 88#include " wallet/db.h"
99#include " wallet/wallet.h"
1010
11- CWallet * pwalletMain;
11+ std::unique_ptr< CWallet> pwalletMain;
1212
1313WalletTestingSetup::WalletTestingSetup (const std::string& chainName):
1414 TestingSetup(chainName)
@@ -17,18 +17,17 @@ WalletTestingSetup::WalletTestingSetup(const std::string& chainName):
1717
1818 bool fFirstRun ;
1919 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) ));
2121 pwalletMain->LoadWallet (fFirstRun );
22- RegisterValidationInterface (pwalletMain);
22+ RegisterValidationInterface (pwalletMain. get () );
2323
2424 RegisterWalletRPCCommands (tableRPC);
2525}
2626
2727WalletTestingSetup::~WalletTestingSetup ()
2828{
29- UnregisterValidationInterface (pwalletMain);
30- delete pwalletMain;
31- pwalletMain = nullptr ;
29+ UnregisterValidationInterface (pwalletMain.get ());
30+ pwalletMain.reset ();
3231
3332 bitdb.Flush (true );
3433 bitdb.Reset ();
You can’t perform that action at this time.
0 commit comments