Enforce SendMax restrictions in transaction engine.

This commit is contained in:
Arthur Britto
2012-08-14 13:31:46 -07:00
parent 11f02ba798
commit 07f5bf2612
3 changed files with 11 additions and 1 deletions

View File

@@ -3279,6 +3279,14 @@ TransactionEngineResult TransactionEngine::doPayment(const SerializedTransaction
return tenREDUNDANT;
}
else if (bMax
&& ((saMaxAmount == saDstAmount && saMaxAmount.getCurrency() == saDstAmount.getCurrency())
|| (saDstAmount.isNative() && saMaxAmount.isNative())))
{
Log(lsINFO) << "doPayment: Invalid transaction: bad SendMax.";
return tenINVALID;
}
SLE::pointer sleDst = entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(uDstAccountID));
if (!sleDst)
@@ -3309,6 +3317,7 @@ TransactionEngineResult TransactionEngine::doPayment(const SerializedTransaction
entryModify(sleDst);
}
// XXX Should bMax be sufficient to imply ripple?
bool bRipple = bPaths || bMax || !saDstAmount.isNative();
if (!bRipple)