diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index e86ca66732..43fde4cd7a 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -269,14 +269,14 @@ void SendCoinsDialog::on_sendButton_clicked() strFunds = tr("using") + " " + tr("any available funds (not anonymous)") + ""; } - if(ui->checkUseInstantSend->isChecked()) { + if(model->IsOldInstantSendEnabled() && ui->checkUseInstantSend->isChecked()) { strFunds += " "; strFunds += tr("and InstantSend"); } for (SendCoinsRecipient& rcp : recipients) { rcp.inputType = ui->checkUsePrivateSend->isChecked() ? ONLY_DENOMINATED : ALL_COINS; - rcp.fUseInstantSend = ui->checkUseInstantSend->isChecked(); + rcp.fUseInstantSend = model->IsOldInstantSendEnabled() && ui->checkUseInstantSend->isChecked(); } fNewRecipientAllowed = false; @@ -611,7 +611,7 @@ void SendCoinsDialog::updateInstantSend() { QSettings settings; settings.setValue("bUseInstantX", ui->checkUseInstantSend->isChecked()); - CoinControlDialog::coinControl->fUseInstantSend = ui->checkUseInstantSend->isChecked(); + CoinControlDialog::coinControl->fUseInstantSend = model->IsOldInstantSendEnabled() && ui->checkUseInstantSend->isChecked(); coinControlUpdateLabels(); } diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 0d267f2229..e7ac33cb0b 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -216,6 +216,11 @@ int WalletModel::getNumISLocks() const return cachedNumISLocks; } +bool WalletModel::IsOldInstantSendEnabled() const +{ + return llmq::IsOldInstantSendEnabled(); +} + void WalletModel::updateAddressBook(const QString &address, const QString &label, bool isMine, const QString &purpose, int status) { @@ -314,7 +319,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact return AmountExceedsBalance; } - if(recipients[0].fUseInstantSend && total > sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)*COIN) { + if(recipients[0].fUseInstantSend && IsOldInstantSendEnabled() && total > sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)*COIN) { Q_EMIT message(tr("Send Coins"), tr("InstantSend doesn't support sending values that high yet. Transactions are currently limited to %1 DASH.").arg(sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)), CClientUIInterface::MSG_ERROR); return TransactionCreationFailed; @@ -344,7 +349,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact nVinSize = newTx->tx->vin.size(); } - if(recipients[0].fUseInstantSend) { + if(recipients[0].fUseInstantSend && IsOldInstantSendEnabled()) { if(nValueOut > sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)*COIN) { Q_EMIT message(tr("Send Coins"), tr("InstantSend doesn't support sending values that high yet. Transactions are currently limited to %1 DASH.").arg(sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)), CClientUIInterface::MSG_ERROR); @@ -410,7 +415,7 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &tran CValidationState state; // the new IX system does not require explicit IX messages std::string strCommand = NetMsgType::TX; - if (recipients[0].fUseInstantSend && llmq::IsOldInstantSendEnabled()) { + if (recipients[0].fUseInstantSend && IsOldInstantSendEnabled()) { strCommand = NetMsgType::TXLOCKREQUEST; } if(!wallet->CommitTransaction(*newTx, *keyChange, g_connman.get(), state, strCommand)) diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index c7b4bbffbd..095c94a1d6 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -228,6 +228,8 @@ public: int getDefaultConfirmTarget() const; int getNumISLocks() const; + bool IsOldInstantSendEnabled() const; + private: CWallet *wallet; bool fHaveWatchOnly; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 5ec9912980..b21eaeb88d 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2590,6 +2590,12 @@ static void ApproximateBestSubset(std::vector > coinLowestLarger; coinLowestLarger.first = fUseInstantSend