diff --git a/src/qt/_Gulden/guldensendcoinsentry.cpp b/src/qt/_Gulden/guldensendcoinsentry.cpp index 4bb2d53916..cfe014549e 100644 --- a/src/qt/_Gulden/guldensendcoinsentry.cpp +++ b/src/qt/_Gulden/guldensendcoinsentry.cpp @@ -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; } diff --git a/src/qt/_Gulden/receivecoinsdialog.cpp b/src/qt/_Gulden/receivecoinsdialog.cpp index d073bb5a37..6915548cd9 100644 --- a/src/qt/_Gulden/receivecoinsdialog.cpp +++ b/src/qt/_Gulden/receivecoinsdialog.cpp @@ -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); @@ -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)); @@ -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")); diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 0336e97871..3daaf8c75e 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -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 diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index e2e041addd..8f580c4c55 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -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; { @@ -2019,8 +2020,17 @@ 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); } } } @@ -2028,7 +2038,7 @@ CAmount CWallet::GetBalance(const CAccount* forAccount) const return nTotal; } -CAmount CWallet::GetUnconfirmedBalance(const CAccount* forAccount) const +CAmount CWallet::GetUnconfirmedBalance(const CAccount* forAccount, bool includeChildren) const { CAmount nTotal = 0; { @@ -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; } diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index a762e0a8c1..8e2616216b 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -950,8 +950,8 @@ class CWallet : public CValidationInterface { void ReacceptWalletTransactions(); void ResendWalletTransactions(int64_t nBestBlockTime); std::vector 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; diff --git a/technical_documentation/Gulden_PoW2.pdf b/technical_documentation/Gulden_PoW2.pdf deleted file mode 100644 index bd730a1228..0000000000 Binary files a/technical_documentation/Gulden_PoW2.pdf and /dev/null differ