mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
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:
parent
7f419ae7fc
commit
1951001614
@ -269,14 +269,14 @@ void SendCoinsDialog::on_sendButton_clicked()
|
|||||||
strFunds = tr("using") + " <b>" + tr("any available funds (not anonymous)") + "</b>";
|
strFunds = tr("using") + " <b>" + tr("any available funds (not anonymous)") + "</b>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ui->checkUseInstantSend->isChecked()) {
|
if(model->IsOldInstantSendEnabled() && ui->checkUseInstantSend->isChecked()) {
|
||||||
strFunds += " ";
|
strFunds += " ";
|
||||||
strFunds += tr("and InstantSend");
|
strFunds += tr("and InstantSend");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SendCoinsRecipient& rcp : recipients) {
|
for (SendCoinsRecipient& rcp : recipients) {
|
||||||
rcp.inputType = ui->checkUsePrivateSend->isChecked() ? ONLY_DENOMINATED : ALL_COINS;
|
rcp.inputType = ui->checkUsePrivateSend->isChecked() ? ONLY_DENOMINATED : ALL_COINS;
|
||||||
rcp.fUseInstantSend = ui->checkUseInstantSend->isChecked();
|
rcp.fUseInstantSend = model->IsOldInstantSendEnabled() && ui->checkUseInstantSend->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
fNewRecipientAllowed = false;
|
fNewRecipientAllowed = false;
|
||||||
@ -611,7 +611,7 @@ void SendCoinsDialog::updateInstantSend()
|
|||||||
{
|
{
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.setValue("bUseInstantX", ui->checkUseInstantSend->isChecked());
|
settings.setValue("bUseInstantX", ui->checkUseInstantSend->isChecked());
|
||||||
CoinControlDialog::coinControl->fUseInstantSend = ui->checkUseInstantSend->isChecked();
|
CoinControlDialog::coinControl->fUseInstantSend = model->IsOldInstantSendEnabled() && ui->checkUseInstantSend->isChecked();
|
||||||
coinControlUpdateLabels();
|
coinControlUpdateLabels();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,6 +216,11 @@ int WalletModel::getNumISLocks() const
|
|||||||
return cachedNumISLocks;
|
return cachedNumISLocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WalletModel::IsOldInstantSendEnabled() const
|
||||||
|
{
|
||||||
|
return llmq::IsOldInstantSendEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
void WalletModel::updateAddressBook(const QString &address, const QString &label,
|
void WalletModel::updateAddressBook(const QString &address, const QString &label,
|
||||||
bool isMine, const QString &purpose, int status)
|
bool isMine, const QString &purpose, int status)
|
||||||
{
|
{
|
||||||
@ -314,7 +319,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
|
|||||||
return AmountExceedsBalance;
|
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)),
|
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);
|
CClientUIInterface::MSG_ERROR);
|
||||||
return TransactionCreationFailed;
|
return TransactionCreationFailed;
|
||||||
@ -344,7 +349,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
|
|||||||
nVinSize = newTx->tx->vin.size();
|
nVinSize = newTx->tx->vin.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(recipients[0].fUseInstantSend) {
|
if(recipients[0].fUseInstantSend && IsOldInstantSendEnabled()) {
|
||||||
if(nValueOut > sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)*COIN) {
|
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)),
|
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);
|
CClientUIInterface::MSG_ERROR);
|
||||||
@ -410,7 +415,7 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &tran
|
|||||||
CValidationState state;
|
CValidationState state;
|
||||||
// the new IX system does not require explicit IX messages
|
// the new IX system does not require explicit IX messages
|
||||||
std::string strCommand = NetMsgType::TX;
|
std::string strCommand = NetMsgType::TX;
|
||||||
if (recipients[0].fUseInstantSend && llmq::IsOldInstantSendEnabled()) {
|
if (recipients[0].fUseInstantSend && IsOldInstantSendEnabled()) {
|
||||||
strCommand = NetMsgType::TXLOCKREQUEST;
|
strCommand = NetMsgType::TXLOCKREQUEST;
|
||||||
}
|
}
|
||||||
if(!wallet->CommitTransaction(*newTx, *keyChange, g_connman.get(), state, strCommand))
|
if(!wallet->CommitTransaction(*newTx, *keyChange, g_connman.get(), state, strCommand))
|
||||||
|
@ -228,6 +228,8 @@ public:
|
|||||||
int getDefaultConfirmTarget() const;
|
int getDefaultConfirmTarget() const;
|
||||||
int getNumISLocks() const;
|
int getNumISLocks() const;
|
||||||
|
|
||||||
|
bool IsOldInstantSendEnabled() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CWallet *wallet;
|
CWallet *wallet;
|
||||||
bool fHaveWatchOnly;
|
bool fHaveWatchOnly;
|
||||||
|
@ -2590,6 +2590,12 @@ static void ApproximateBestSubset(std::vector<std::pair<CAmount, std::pair<const
|
|||||||
vfBest.assign(vValue.size(), true);
|
vfBest.assign(vValue.size(), true);
|
||||||
nBest = nTotalLower;
|
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;
|
FastRandomContext insecure_rand;
|
||||||
|
|
||||||
for (int nRep = 0; nRep < iterations && nBest != nTargetValue; nRep++)
|
for (int nRep = 0; nRep < iterations && nBest != nTargetValue; nRep++)
|
||||||
@ -2662,6 +2668,12 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const int nConfMin
|
|||||||
setCoinsRet.clear();
|
setCoinsRet.clear();
|
||||||
nValueRet = 0;
|
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
|
// List of values less than target
|
||||||
std::pair<CAmount, std::pair<const CWalletTx*,unsigned int> > coinLowestLarger;
|
std::pair<CAmount, std::pair<const CWalletTx*,unsigned int> > coinLowestLarger;
|
||||||
coinLowestLarger.first = fUseInstantSend
|
coinLowestLarger.first = fUseInstantSend
|
||||||
|
Loading…
Reference in New Issue
Block a user