}
else
{
- // Decrypt -- TODO; not supported yet
- return false;
+ // Decrypt
+ return wallet->DecryptWallet(passphrase);
}
}
return retval;
}
-void WalletModel::getStakeStats(float &nKernelsRate, float &nCoinDaysRate)
-{
- wallet->GetStakeStats(nKernelsRate, nCoinDaysRate);
-}
-
void WalletModel::getStakeWeightFromValue(const int64_t& nTime, const int64_t& nValue, uint64_t& nWeight)
{
wallet->GetStakeWeightFromValue(nTime, nValue, nWeight);
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
cout = COutput(&wallet->mapWallet[cout.tx->vin[0].prevout.hash], cout.tx->vin[0].prevout.n, 0, true);
}
- CTxDestination address;
- if(!out.fSpendable || !ExtractDestination(cout.tx->vout[cout.i].scriptPubKey, address))
+ std::string address;
+ if(!out.fSpendable || !wallet->ExtractAddress(cout.tx->vout[cout.i].scriptPubKey, address))
continue;
- mapCoins[CBitcoinAddress(address).ToString().c_str()].push_back(out);
+
+ mapCoins[address.c_str()].push_back(out);
}
}