mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Use unique_ptr for pwalletMain (CWallet)
This commit is contained in:
parent
99ec12666b
commit
860e912583
@ -8,7 +8,7 @@
|
|||||||
#include "wallet/db.h"
|
#include "wallet/db.h"
|
||||||
#include "wallet/wallet.h"
|
#include "wallet/wallet.h"
|
||||||
|
|
||||||
CWallet *pwalletMain;
|
std::unique_ptr<CWallet> pwalletMain;
|
||||||
|
|
||||||
WalletTestingSetup::WalletTestingSetup(const std::string& chainName):
|
WalletTestingSetup::WalletTestingSetup(const std::string& chainName):
|
||||||
TestingSetup(chainName)
|
TestingSetup(chainName)
|
||||||
@ -17,18 +17,17 @@ WalletTestingSetup::WalletTestingSetup(const std::string& chainName):
|
|||||||
|
|
||||||
bool fFirstRun;
|
bool fFirstRun;
|
||||||
std::unique_ptr<CWalletDBWrapper> dbw(new CWalletDBWrapper(&bitdb, "wallet_test.dat"));
|
std::unique_ptr<CWalletDBWrapper> dbw(new CWalletDBWrapper(&bitdb, "wallet_test.dat"));
|
||||||
pwalletMain = new CWallet(std::move(dbw));
|
pwalletMain = std::unique_ptr<CWallet>(new CWallet(std::move(dbw)));
|
||||||
pwalletMain->LoadWallet(fFirstRun);
|
pwalletMain->LoadWallet(fFirstRun);
|
||||||
RegisterValidationInterface(pwalletMain);
|
RegisterValidationInterface(pwalletMain.get());
|
||||||
|
|
||||||
RegisterWalletRPCCommands(tableRPC);
|
RegisterWalletRPCCommands(tableRPC);
|
||||||
}
|
}
|
||||||
|
|
||||||
WalletTestingSetup::~WalletTestingSetup()
|
WalletTestingSetup::~WalletTestingSetup()
|
||||||
{
|
{
|
||||||
UnregisterValidationInterface(pwalletMain);
|
UnregisterValidationInterface(pwalletMain.get());
|
||||||
delete pwalletMain;
|
pwalletMain.reset();
|
||||||
pwalletMain = nullptr;
|
|
||||||
|
|
||||||
bitdb.Flush(true);
|
bitdb.Flush(true);
|
||||||
bitdb.Reset();
|
bitdb.Reset();
|
||||||
|
Loading…
Reference in New Issue
Block a user