WalletModel::UnlockContext WalletModel::requestUnlock()
{
bool was_locked = getEncryptionStatus() == Locked;
+ bool mintflag = fWalletUnlockMintOnly;
if ((!was_locked) && fWalletUnlockMintOnly)
{
- setWalletLocked(true);
- was_locked = getEncryptionStatus() == Locked;
-
+ setWalletLocked(true);
+ was_locked = getEncryptionStatus() == Locked;
}
if(was_locked)
{
// If wallet is still locked, unlock was failed or cancelled, mark context as invalid
bool valid = getEncryptionStatus() != Locked;
- return UnlockContext(this, valid, was_locked && !fWalletUnlockMintOnly);
+ return UnlockContext(this, valid, was_locked, mintflag);
}
-WalletModel::UnlockContext::UnlockContext(WalletModel *wallet, bool valid, bool relock):
+WalletModel::UnlockContext::UnlockContext(WalletModel *wallet, bool valid, bool relock, bool mintflag):
wallet(wallet),
valid(valid),
- relock(relock)
+ relock(relock),
+ mintflag(mintflag)
{
}
{
if(valid && relock)
{
+ if (mintflag)
+ {
+ // Restore unlock minting flag
+ fWalletUnlockMintOnly = mintflag;
+ return;
+ }
wallet->setWalletLocked(true);
+
}
}
bool WalletModel::getPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const
{
- return wallet->GetPubKey(address, vchPubKeyOut);
+ return wallet->GetPubKey(address, vchPubKeyOut);
}
// returns a list of COutputs from COutPoints
class UnlockContext
{
public:
- UnlockContext(WalletModel *wallet, bool valid, bool relock);
+ UnlockContext(WalletModel *wallet, bool valid, bool relock, bool mintflag);
~UnlockContext();
bool isValid() const { return valid; }
WalletModel *wallet;
bool valid;
mutable bool relock; // mutable, as it can be set to false by copying
+ bool mintflag;
void CopyFrom(const UnlockContext& rhs);
};