X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fqt%2Fwalletmodel.cpp;h=47b12e9d13d3fc30f1dd2033946fdefe66fbbb4b;hb=9c9ba366ebc85b0d8eef6d962a9fa84cffe0cae7;hp=0d8b0ab47720c8afabd7971222b850bda65bc01d;hpb=2caeac8a787c69f3772c07ec166514585b8a03c6;p=novacoin.git diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 0d8b0ab..47b12e9 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -302,8 +302,8 @@ bool WalletModel::setWalletEncrypted(bool encrypted, const SecureString &passphr } else { - // Decrypt -- TODO; not supported yet - return false; + // Decrypt + return wallet->DecryptWallet(passphrase); } } @@ -332,11 +332,6 @@ bool WalletModel::changePassphrase(const SecureString &oldPass, const SecureStri 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); @@ -410,12 +405,12 @@ void WalletModel::unsubscribeFromCoreSignals() 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) { @@ -425,13 +420,14 @@ WalletModel::UnlockContext WalletModel::requestUnlock() // 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) { } @@ -439,7 +435,14 @@ WalletModel::UnlockContext::~UnlockContext() { if(valid && relock) { + if (mintflag) + { + // Restore unlock minting flag + fWalletUnlockMintOnly = mintflag; + return; + } wallet->setWalletLocked(true); + } } @@ -452,7 +455,7 @@ void WalletModel::UnlockContext::CopyFrom(const UnlockContext& rhs) 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 @@ -492,10 +495,11 @@ void WalletModel::listCoins(std::map >& mapCoins) 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); } }