mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
Merge bitcoin-core/gui#711: refactor: Disable unused special members functions in UnlockContext
9fa43b5af6refactor: Disable unused special members functions in `UnlockContext` (Hennadii Stepanov) Pull request description: Also `UnlockContext::valid` and `UnlockContext::relock` are `const` now. ACKs for top commit: achow101: ACK9fa43b5af6john-moffett: ACK9fa43b5af6furszy: ACK9fa43b5aTree-SHA512: 6d9fa8208676b9bd5d85b73cb2d3136e7f28ef59e68ee34915ec598458868e302a80b9ef1384c0bf7a4c42f936830c3add9662ca0bae73860a55a25cc374b699
This commit is contained in:
commit
54742532ce
2 changed files with 8 additions and 17 deletions
|
|
@ -477,13 +477,6 @@ WalletModel::UnlockContext::~UnlockContext()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WalletModel::UnlockContext::CopyFrom(UnlockContext&& rhs)
|
|
||||||
{
|
|
||||||
// Transfer context; old object no longer relocks wallet
|
|
||||||
*this = rhs;
|
|
||||||
rhs.relock = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool WalletModel::bumpFee(uint256 hash, uint256& new_hash)
|
bool WalletModel::bumpFee(uint256 hash, uint256& new_hash)
|
||||||
{
|
{
|
||||||
CCoinControl coin_control;
|
CCoinControl coin_control;
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ public:
|
||||||
bool setWalletLocked(bool locked, const SecureString &passPhrase=SecureString());
|
bool setWalletLocked(bool locked, const SecureString &passPhrase=SecureString());
|
||||||
bool changePassphrase(const SecureString &oldPass, const SecureString &newPass);
|
bool changePassphrase(const SecureString &oldPass, const SecureString &newPass);
|
||||||
|
|
||||||
// RAI object for unlocking wallet, returned by requestUnlock()
|
// RAII object for unlocking wallet, returned by requestUnlock()
|
||||||
class UnlockContext
|
class UnlockContext
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -120,18 +120,16 @@ public:
|
||||||
|
|
||||||
bool isValid() const { return valid; }
|
bool isValid() const { return valid; }
|
||||||
|
|
||||||
// Copy constructor is disabled.
|
// Disable unused copy/move constructors/assignments explicitly.
|
||||||
UnlockContext(const UnlockContext&) = delete;
|
UnlockContext(const UnlockContext&) = delete;
|
||||||
// Move operator and constructor transfer the context
|
UnlockContext(UnlockContext&&) = delete;
|
||||||
UnlockContext(UnlockContext&& obj) { CopyFrom(std::move(obj)); }
|
UnlockContext& operator=(const UnlockContext&) = delete;
|
||||||
UnlockContext& operator=(UnlockContext&& rhs) { CopyFrom(std::move(rhs)); return *this; }
|
UnlockContext& operator=(UnlockContext&&) = delete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WalletModel *wallet;
|
WalletModel *wallet;
|
||||||
bool valid;
|
const bool valid;
|
||||||
mutable bool relock; // mutable, as it can be set to false by copying
|
const bool relock;
|
||||||
|
|
||||||
UnlockContext& operator=(const UnlockContext&) = default;
|
|
||||||
void CopyFrom(UnlockContext&& rhs);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
UnlockContext requestUnlock();
|
UnlockContext requestUnlock();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue