remove IS number of inputs limit, add warning instead (#1308)

This commit is contained in:
UdjinM6 2017-02-03 02:38:33 +04:00 committed by GitHub
parent f729d8227b
commit 1486acfb99
4 changed files with 7 additions and 15 deletions

View File

@ -815,9 +815,8 @@ bool CTxLockRequest::IsValid(bool fRequireUnspent) const
{
if(vout.size() < 1) return false;
if(vin.size() > MAX_INPUTS) {
LogPrint("instantsend", "CTxLockRequest::IsValid -- Too many inputs: tx=%s", ToString());
return false;
if(vin.size() > WARN_MANY_INPUTS) {
LogPrint("instantsend", "CTxLockRequest::IsValid -- WARNING: Too many inputs: tx=%s", ToString());
}
LOCK(cs_main);

View File

@ -116,7 +116,7 @@ private:
int64_t nTimeCreated;
public:
static const int MAX_INPUTS = 10;
static const int WARN_MANY_INPUTS = 100;
CTxLockRequest() :
CTransaction(),

View File

@ -313,10 +313,9 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
CClientUIInterface::MSG_ERROR);
return TransactionCreationFailed;
}
if(newTx->vin.size() > CTxLockRequest::MAX_INPUTS) {
Q_EMIT message(tr("Send Coins"), tr("InstantSend doesn't support transactions with more than %1 inputs.").arg(CTxLockRequest::MAX_INPUTS),
CClientUIInterface::MSG_ERROR);
return TransactionCreationFailed;
if(newTx->vin.size() > CTxLockRequest::WARN_MANY_INPUTS) {
Q_EMIT message(tr("Send Coins"), tr("Used way too many inputs (>%1) for this InstantSend transaction, fees could be huge.").arg(CTxLockRequest::WARN_MANY_INPUTS),
CClientUIInterface::MSG_WARNING);
}
}

View File

@ -2358,9 +2358,6 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
setCoinsRet.insert(make_pair(out.tx, out.i));
}
if(fUseInstantSend && setCoinsRet.size() > CTxLockRequest::MAX_INPUTS)
return false;
return (nValueRet >= nTargetValue);
}
@ -3014,10 +3011,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
strFailReason = _("Insufficient funds.");
}
if (fUseInstantSend) {
size_t nMaxInputs = CTxLockRequest::MAX_INPUTS;
if(setCoins.size() > nMaxInputs) {
strFailReason += " " + strprintf(_("InstantSend doesn't support transactions with more than %d inputs."), nMaxInputs);
} else if (nValueIn > sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)*COIN) {
if (nValueIn > sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)*COIN) {
strFailReason += " " + strprintf(_("InstantSend doesn't support sending values that high yet. Transactions are currently limited to %1 DASH."), sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE));
} else {
// could be not true but most likely that's the reason