Browse Source

Merge pull request #3415

4a61c39 qt: status WalletModel::Aborted is no longer used (Wladimir J. van der Laan)
ca2c83d Remove unused ThreadSafeAskFee from ui_interface (Wladimir J. van der Laan)
37e67d3 Remove unused ThreadSafeHandleURI from ui_interface (Wladimir J. van der Laan)
0.10
Wladimir J. van der Laan 11 years ago
parent
commit
57fdd68aac
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 17
      src/qt/bitcoin.cpp
  2. 13
      src/qt/bitcoingui.cpp
  3. 10
      src/qt/bitcoingui.h
  4. 3
      src/qt/sendcoinsdialog.cpp
  5. 5
      src/qt/walletmodel.h
  6. 3
      src/ui_interface.h
  7. 9
      src/wallet.cpp
  8. 4
      src/wallet.h

17
src/qt/bitcoin.cpp

@ -74,22 +74,6 @@ static bool ThreadSafeMessageBox(const std::string& message, const std::string&
} }
} }
static bool ThreadSafeAskFee(int64_t nFeeRequired)
{
if(!guiref)
return false;
if(nFeeRequired < CTransaction::nMinTxFee || nFeeRequired <= nTransactionFee || fDaemon)
return true;
bool payFee = false;
QMetaObject::invokeMethod(guiref, "askFee", GUIUtil::blockingGUIThreadConnection(),
Q_ARG(qint64, nFeeRequired),
Q_ARG(bool*, &payFee));
return payFee;
}
static void InitMessage(const std::string &message) static void InitMessage(const std::string &message)
{ {
if(splashref) if(splashref)
@ -262,7 +246,6 @@ int main(int argc, char *argv[])
// Subscribe to global signals from core // Subscribe to global signals from core
uiInterface.ThreadSafeMessageBox.connect(ThreadSafeMessageBox); uiInterface.ThreadSafeMessageBox.connect(ThreadSafeMessageBox);
uiInterface.ThreadSafeAskFee.connect(ThreadSafeAskFee);
uiInterface.InitMessage.connect(InitMessage); uiInterface.InitMessage.connect(InitMessage);
uiInterface.Translate.connect(Translate); uiInterface.Translate.connect(Translate);

13
src/qt/bitcoingui.cpp

@ -726,19 +726,6 @@ void BitcoinGUI::closeEvent(QCloseEvent *event)
QMainWindow::closeEvent(event); QMainWindow::closeEvent(event);
} }
void BitcoinGUI::askFee(qint64 nFeeRequired, bool *payFee)
{
if (!clientModel || !clientModel->getOptionsModel())
return;
QString strMessage = tr("This transaction is over the size limit. You can still send it for a fee of %1, "
"which goes to the nodes that process your transaction and helps to support the network. "
"Do you want to pay the fee?").arg(BitcoinUnits::formatWithUnit(clientModel->getOptionsModel()->getDisplayUnit(), nFeeRequired));
QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm transaction fee"), strMessage,
QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Yes);
*payFee = (retval == QMessageBox::Yes);
}
void BitcoinGUI::incomingTransaction(const QString& date, int unit, qint64 amount, const QString& type, const QString& address) void BitcoinGUI::incomingTransaction(const QString& date, int unit, qint64 amount, const QString& type, const QString& address)
{ {
// On new transaction, make an info balloon // On new transaction, make an info balloon

10
src/qt/bitcoingui.h

@ -135,16 +135,6 @@ public slots:
*/ */
void message(const QString &title, const QString &message, unsigned int style, bool *ret = NULL); void message(const QString &title, const QString &message, unsigned int style, bool *ret = NULL);
/** Asks the user whether to pay the transaction fee or to cancel the transaction.
It is currently not possible to pass a return value to another thread through
BlockingQueuedConnection, so an indirected pointer is used.
https://bugreports.qt-project.org/browse/QTBUG-10440
@param[in] nFeeRequired the required fee
@param[out] payFee true to pay the fee, false to not pay the fee
*/
void askFee(qint64 nFeeRequired, bool *payFee);
bool handlePaymentRequest(const SendCoinsRecipient& recipient); bool handlePaymentRequest(const SendCoinsRecipient& recipient);
/** Show incoming transaction notification for new transactions. */ /** Show incoming transaction notification for new transactions. */

3
src/qt/sendcoinsdialog.cpp

@ -452,9 +452,8 @@ void SendCoinsDialog::processSendCoinsReturn(const WalletModel::SendCoinsReturn
msgParams.first = tr("The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."); msgParams.first = tr("The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.");
msgParams.second = CClientUIInterface::MSG_ERROR; msgParams.second = CClientUIInterface::MSG_ERROR;
break; break;
// OK and Aborted are included to prevent a compiler warning. // included to prevent a compiler warning.
case WalletModel::OK: case WalletModel::OK:
case WalletModel::Aborted:
default: default:
return; return;
} }

5
src/qt/walletmodel.h

@ -75,8 +75,7 @@ public:
AmountWithFeeExceedsBalance, AmountWithFeeExceedsBalance,
DuplicateAddress, DuplicateAddress,
TransactionCreationFailed, // Error returned when wallet is still locked TransactionCreationFailed, // Error returned when wallet is still locked
TransactionCommitFailed, TransactionCommitFailed
Aborted
}; };
enum EncryptionStatus enum EncryptionStatus
@ -103,7 +102,7 @@ public:
// Return status record for SendCoins, contains error id + information // Return status record for SendCoins, contains error id + information
struct SendCoinsReturn struct SendCoinsReturn
{ {
SendCoinsReturn(StatusCode status = Aborted): SendCoinsReturn(StatusCode status = OK):
status(status) {} status(status) {}
StatusCode status; StatusCode status;
}; };

3
src/ui_interface.h

@ -75,9 +75,6 @@ public:
/** Ask the user whether they want to pay a fee or not. */ /** Ask the user whether they want to pay a fee or not. */
boost::signals2::signal<bool (int64_t nFeeRequired), boost::signals2::last_value<bool> > ThreadSafeAskFee; boost::signals2::signal<bool (int64_t nFeeRequired), boost::signals2::last_value<bool> > ThreadSafeAskFee;
/** Handle a URL passed at the command line. */
boost::signals2::signal<void (const std::string& strURI)> ThreadSafeHandleURI;
/** Progress message during initialization. */ /** Progress message during initialization. */
boost::signals2::signal<void (const std::string &message)> InitMessage; boost::signals2::signal<void (const std::string &message)> InitMessage;

9
src/wallet.cpp

@ -1434,7 +1434,7 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey)
string CWallet::SendMoney(CScript scriptPubKey, int64_t nValue, CWalletTx& wtxNew, bool fAskFee) string CWallet::SendMoney(CScript scriptPubKey, int64_t nValue, CWalletTx& wtxNew)
{ {
CReserveKey reservekey(this); CReserveKey reservekey(this);
int64_t nFeeRequired; int64_t nFeeRequired;
@ -1454,9 +1454,6 @@ string CWallet::SendMoney(CScript scriptPubKey, int64_t nValue, CWalletTx& wtxNe
return strError; return strError;
} }
if (fAskFee && !uiInterface.ThreadSafeAskFee(nFeeRequired))
return "ABORTED";
if (!CommitTransaction(wtxNew, reservekey)) if (!CommitTransaction(wtxNew, reservekey))
return _("Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."); return _("Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.");
@ -1465,7 +1462,7 @@ string CWallet::SendMoney(CScript scriptPubKey, int64_t nValue, CWalletTx& wtxNe
string CWallet::SendMoneyToDestination(const CTxDestination& address, int64_t nValue, CWalletTx& wtxNew, bool fAskFee) string CWallet::SendMoneyToDestination(const CTxDestination& address, int64_t nValue, CWalletTx& wtxNew)
{ {
// Check amount // Check amount
if (nValue <= 0) if (nValue <= 0)
@ -1477,7 +1474,7 @@ string CWallet::SendMoneyToDestination(const CTxDestination& address, int64_t nV
CScript scriptPubKey; CScript scriptPubKey;
scriptPubKey.SetDestination(address); scriptPubKey.SetDestination(address);
return SendMoney(scriptPubKey, nValue, wtxNew, fAskFee); return SendMoney(scriptPubKey, nValue, wtxNew);
} }

4
src/wallet.h

@ -217,8 +217,8 @@ public:
bool CreateTransaction(CScript scriptPubKey, int64_t nValue, bool CreateTransaction(CScript scriptPubKey, int64_t nValue,
CWalletTx& wtxNew, CReserveKey& reservekey, int64_t& nFeeRet, std::string& strFailReason, const CCoinControl *coinControl = NULL); CWalletTx& wtxNew, CReserveKey& reservekey, int64_t& nFeeRet, std::string& strFailReason, const CCoinControl *coinControl = NULL);
bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey); bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey);
std::string SendMoney(CScript scriptPubKey, int64_t nValue, CWalletTx& wtxNew, bool fAskFee=false); std::string SendMoney(CScript scriptPubKey, int64_t nValue, CWalletTx& wtxNew);
std::string SendMoneyToDestination(const CTxDestination &address, int64_t nValue, CWalletTx& wtxNew, bool fAskFee=false); std::string SendMoneyToDestination(const CTxDestination &address, int64_t nValue, CWalletTx& wtxNew);
bool NewKeyPool(); bool NewKeyPool();
bool TopUpKeyPool(unsigned int kpSize = 0); bool TopUpKeyPool(unsigned int kpSize = 0);

Loading…
Cancel
Save