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(vout.size() < 1) return false;
if(vin.size() > MAX_INPUTS) { if(vin.size() > WARN_MANY_INPUTS) {
LogPrint("instantsend", "CTxLockRequest::IsValid -- Too many inputs: tx=%s", ToString()); LogPrint("instantsend", "CTxLockRequest::IsValid -- WARNING: Too many inputs: tx=%s", ToString());
return false;
} }
LOCK(cs_main); LOCK(cs_main);

View File

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

View File

@ -313,10 +313,9 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
CClientUIInterface::MSG_ERROR); CClientUIInterface::MSG_ERROR);
return TransactionCreationFailed; return TransactionCreationFailed;
} }
if(newTx->vin.size() > CTxLockRequest::MAX_INPUTS) { if(newTx->vin.size() > CTxLockRequest::WARN_MANY_INPUTS) {
Q_EMIT message(tr("Send Coins"), tr("InstantSend doesn't support transactions with more than %1 inputs.").arg(CTxLockRequest::MAX_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_ERROR); CClientUIInterface::MSG_WARNING);
return TransactionCreationFailed;
} }
} }

View File

@ -2358,9 +2358,6 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
setCoinsRet.insert(make_pair(out.tx, out.i)); setCoinsRet.insert(make_pair(out.tx, out.i));
} }
if(fUseInstantSend && setCoinsRet.size() > CTxLockRequest::MAX_INPUTS)
return false;
return (nValueRet >= nTargetValue); return (nValueRet >= nTargetValue);
} }
@ -3014,10 +3011,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
strFailReason = _("Insufficient funds."); strFailReason = _("Insufficient funds.");
} }
if (fUseInstantSend) { if (fUseInstantSend) {
size_t nMaxInputs = CTxLockRequest::MAX_INPUTS; if (nValueIn > sporkManager.GetSporkValue(SPORK_5_INSTANTSEND_MAX_VALUE)*COIN) {
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) {
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)); 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 { } else {
// could be not true but most likely that's the reason // could be not true but most likely that's the reason