Skip to content

Commit

Permalink
1.6.4.2.
Browse files Browse the repository at this point in the history
Closes #45.
Closes #42.
Implements a temporary fix for #41.
  • Loading branch information
nlg-buildbot committed May 24, 2017
1 parent 964b6fe commit 6e350f8
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/qt/_Gulden/guldensendcoinsentry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,14 @@ SendCoinsRecipient GuldenSendCoinsEntry::getValue(bool showWarningDialogs)
recipient.fSubtractFeeFromAmount = false;
recipient.amount = ui->payAmount->valueForCurrency();

if (recipient.amount >= (pwalletMain->GetBalance(model->getActiveAccount()) + pwalletMain->GetUnconfirmedBalance(model->getActiveAccount()))) {
if (recipient.amount >= (pwalletMain->GetBalance(model->getActiveAccount(), true) + pwalletMain->GetUnconfirmedBalance(model->getActiveAccount(), true))) {
if (showWarningDialogs) {
QString message = tr("The amount you want to send exceeds your balance, amount has been automatically adjusted downwards to match your balance. Please ensure this is what you want before proceeding to avoid short payment of your recipient.");
QDialog* d = GuldenGUI::createDialog(this, message, tr("Okay"), "", 400, 180);
d->exec();
}

recipient.amount = pwalletMain->GetBalance(model->getActiveAccount()) + pwalletMain->GetUnconfirmedBalance(model->getActiveAccount());
recipient.amount = pwalletMain->GetBalance(model->getActiveAccount(), true) + pwalletMain->GetUnconfirmedBalance(model->getActiveAccount(), true);
recipient.fSubtractFeeFromAmount = true;
}

Expand Down
13 changes: 11 additions & 2 deletions src/qt/_Gulden/receivecoinsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,14 @@ void ReceiveCoinsDialog::gotoReceievePage()

void ReceiveCoinsDialog::showBuyGuldenDialog()
{
#ifdef WIN32
if (WIN32) {

QDesktopServices::openUrl(QUrl("https://gulden.com/purchase"));
return;
}
#endif

#if defined(HAVE_WEBENGINE_VIEW) || defined(HAVE_WEBKIT)
ui->receiveCoinsStackedWidget->setCurrentIndex(1);

Expand All @@ -277,7 +285,7 @@ void ReceiveCoinsDialog::showBuyGuldenDialog()
ui->accountBuyButton->setVisible(true);

QMovie* movie = new QMovie(":/Gulden/loading_animation");
if (movie->isValid()) {
if (movie && movie->isValid()) {
ui->loadingAnimationLabel->setVisible(true);
buyView->setVisible(false);
movie->setScaledSize(QSize(30, 30));
Expand All @@ -286,7 +294,8 @@ void ReceiveCoinsDialog::showBuyGuldenDialog()
} else {
ui->loadingAnimationLabel->setVisible(false);
buyView->setVisible(true);
delete movie;
if (movie)
delete movie;
}

buyView->load(QUrl("https://gulden.com/purchase"));
Expand Down
3 changes: 2 additions & 1 deletion src/rpc/rawtransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,8 @@ UniValue signrawtransaction(const UniValue& params, bool fHelp)
}

#ifdef ENABLE_WALLET
const CKeyStore& keystore = ((fGivenKeys || !pwalletMain->activeAccount) ? tempKeystore : *(pwalletMain->activeAccount));

const CKeyStore& keystore = ((fGivenKeys || !pwalletMain->activeAccount) ? tempKeystore : pwalletMain->activeAccount->externalKeyStore);
#else
const CKeyStore& keystore = tempKeystore;
#endif
Expand Down
24 changes: 21 additions & 3 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <boost/filesystem.hpp>
#include <boost/thread.hpp>
#include <boost/uuid/nil_generator.hpp>
#include <fstream>

#include <Gulden/Common/scrypt.h>
#include <Gulden/guldenapplication.h>
Expand Down Expand Up @@ -2010,7 +2011,7 @@ void CWallet::ResendWalletTransactions(int64_t nBestBlockTime)
* @{
*/

CAmount CWallet::GetBalance(const CAccount* forAccount) const
CAmount CWallet::GetBalance(const CAccount* forAccount, bool includeChildren) const
{
CAmount nTotal = 0;
{
Expand All @@ -2019,16 +2020,25 @@ CAmount CWallet::GetBalance(const CAccount* forAccount) const
const CWalletTx* pcoin = &(*it).second;

if (!forAccount || ::IsMine(forAccount, *pcoin)) {
if (pcoin->IsTrusted())
if (pcoin->IsTrusted()) {
nTotal += pcoin->GetAvailableCredit(true, forAccount);
}
}
}
}
if (forAccount && includeChildren) {
for (const auto& accountItem : mapAccounts) {
const auto& childAccount = accountItem.second;
if (childAccount->getParentUUID() == forAccount->getUUID()) {
nTotal += GetBalance(childAccount, false);
}
}
}

return nTotal;
}

CAmount CWallet::GetUnconfirmedBalance(const CAccount* forAccount) const
CAmount CWallet::GetUnconfirmedBalance(const CAccount* forAccount, bool includeChildren) const
{
CAmount nTotal = 0;
{
Expand All @@ -2042,6 +2052,14 @@ CAmount CWallet::GetUnconfirmedBalance(const CAccount* forAccount) const
}
}
}
if (forAccount && includeChildren) {
for (const auto& accountItem : mapAccounts) {
const auto& childAccount = accountItem.second;
if (childAccount->getParentUUID() == forAccount->getUUID()) {
nTotal += GetUnconfirmedBalance(childAccount, false);
}
}
}
return nTotal;
}

Expand Down
4 changes: 2 additions & 2 deletions src/wallet/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -950,8 +950,8 @@ class CWallet : public CValidationInterface {
void ReacceptWalletTransactions();
void ResendWalletTransactions(int64_t nBestBlockTime);
std::vector<uint256> ResendWalletTransactionsBefore(int64_t nTime);
CAmount GetBalance(const CAccount* forAccount = NULL) const;
CAmount GetUnconfirmedBalance(const CAccount* forAccount = NULL) const;
CAmount GetBalance(const CAccount* forAccount = NULL, bool includeChildren = false) const;
CAmount GetUnconfirmedBalance(const CAccount* forAccount = NULL, bool includeChildren = false) const;
CAmount GetImmatureBalance(const CAccount* forAccount = NULL) const;
CAmount GetWatchOnlyBalance() const;
CAmount GetUnconfirmedWatchOnlyBalance() const;
Expand Down
Binary file removed technical_documentation/Gulden_PoW2.pdf
Binary file not shown.

0 comments on commit 6e350f8

Please sign in to comment.