New LLMQ-based IS should have no legacy IS strings in UI and no legacy restrictions (#2883)

(max value/too many inputs/additional fees)
This commit is contained in:
UdjinM6 2019-04-29 11:32:43 +03:00 committed by GitHub
parent 7f419ae7fc
commit 1951001614
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 6 deletions

View File

@ -269,14 +269,14 @@ void SendCoinsDialog::on_sendButton_clicked()
strFunds = tr("using") + " <b>" + tr("any available funds (not anonymous)") + "</b>";
}
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();
}

View File

@ -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))

View File

@ -228,6 +228,8 @@ public:
int getDefaultConfirmTarget() const;
int getNumISLocks() const;
bool IsOldInstantSendEnabled() const;
private:
CWallet *wallet;
bool fHaveWatchOnly;

View File

@ -2590,6 +2590,12 @@ static void ApproximateBestSubset(std::vector<std::pair<CAmount, std::pair<const
vfBest.assign(vValue.size(), true);
nBest = nTotalLower;
if (!llmq::IsOldInstantSendEnabled()) {
// The new system does not require special handling for InstantSend as this is all done in CInstantSendManager.
// There is also no need for an extra fee anymore.
fUseInstantSend = false;
}
FastRandomContext insecure_rand;
for (int nRep = 0; nRep < iterations && nBest != nTargetValue; nRep++)
@ -2662,6 +2668,12 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const int nConfMin
setCoinsRet.clear();
nValueRet = 0;
if (!llmq::IsOldInstantSendEnabled()) {
// The new system does not require special handling for InstantSend as this is all done in CInstantSendManager.
// There is also no need for an extra fee anymore.
fUseInstantSend = false;
}
// List of values less than target
std::pair<CAmount, std::pair<const CWalletTx*,unsigned int> > coinLowestLarger;
coinLowestLarger.first = fUseInstantSend