Skip to content

Commit

Permalink
[Wallet] Move CStakerStatus raw pointer to unique_ptr.
Browse files Browse the repository at this point in the history
  • Loading branch information
furszy committed Jan 23, 2021
1 parent bc00fca commit 6b9088b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4280,7 +4280,6 @@ CWallet::CWallet(std::string strWalletFileIn)
CWallet::~CWallet()
{
delete pwalletdbEncryption;
delete pStakerStatus;
}

void CWallet::SetNull()
Expand All @@ -4300,7 +4299,7 @@ void CWallet::SetNull()
if (pStakerStatus) {
pStakerStatus->SetNull();
} else {
pStakerStatus = new CStakerStatus();
pStakerStatus = MakeUnique<CStakerStatus>();
}
// Stake split threshold
nStakeSplitThreshold = DEFAULT_STAKE_SPLIT_THRESHOLD;
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
int64_t nLastResend;

// Staker status (last hashed block and time)
CStakerStatus* pStakerStatus{nullptr};
std::unique_ptr<CStakerStatus> pStakerStatus;

/**
* Used to keep track of spent outpoints, and
Expand Down

0 comments on commit 6b9088b

Please sign in to comment.