Make specific generic uses of temINVALID.

This commit is contained in:
Arthur Britto
2013-01-15 19:55:57 -08:00
parent 06f1e1339a
commit ffd32cc66c
4 changed files with 19 additions and 7 deletions

View File

@@ -64,13 +64,17 @@ TER PaymentTransactor::doApply()
return temREDUNDANT;
}
else if (bMax
&& ((saMaxAmount == saDstAmount && saMaxAmount.getCurrency() == saDstAmount.getCurrency())
|| (saDstAmount.isNative() && saMaxAmount.isNative())))
else if (bMax && saMaxAmount == saDstAmount && saMaxAmount.getCurrency() == saDstAmount.getCurrency())
{
cLog(lsINFO) << "Payment: Malformed transaction: bad SendMax.";
cLog(lsINFO) << "Payment: Malformed transaction: Redundant SendMax.";
return temINVALID;
return temREDUNDANT_SEND_MAX;
}
else if (bMax && (saDstAmount.isNative() && saMaxAmount.isNative()))
{
cLog(lsINFO) << "Payment: Malformed transaction: SendMax not allowed for XRP.";
return temBAD_SEND_MAX_XRP;
}
SLE::pointer sleDst = mEngine->entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(uDstAccountID));
@@ -103,7 +107,7 @@ TER PaymentTransactor::doApply()
{
cLog(lsINFO) << "Payment: Malformed transaction: DestinationTag required.";
return temINVALID;
return temDST_TAG_NEEDED;
}
else
{

View File

@@ -49,14 +49,18 @@ bool transResultInfo(TER terCode, std::string& strToken, std::string& strHuman)
{ temBAD_PATH, "temBAD_PATH", "Malformed: Bad path." },
{ temBAD_PATH_LOOP, "temBAD_PATH_LOOP", "Malformed: Loop in path." },
{ temBAD_PUBLISH, "temBAD_PUBLISH", "Malformed: Bad publish." },
{ temBAD_SIGNATURE, "temBAD_SIGNATURE", "Malformed: Bad signature." },
{ temBAD_SRC_ACCOUNT, "temBAD_SRC_ACCOUNT", "Malformed: Bad source account." },
{ temBAD_TRANSFER_RATE, "temBAD_TRANSFER_RATE", "Malformed: Transfer rate must be >= 1.0" },
{ temBAD_SEQUENCE, "temBAD_SEQUENCE", "Malformed: Sequence is not in the past." },
{ temBAD_SEND_MAX_XRP, "temBAD_SEND_MAX_XRP", "Malformed: Send max is not allowed for XRP." },
{ temDST_IS_SRC, "temDST_IS_SRC", "Destination may not be source." },
{ temDST_NEEDED, "temDST_NEEDED", "Destination not specified." },
{ temDST_TAG_NEEDED, "temDST_TAG_NEEDED", "Destination tag required." },
{ temINVALID, "temINVALID", "The transaction is ill-formed." },
{ temINVALID_FLAG, "temINVALID_FLAG", "The transaction has an invalid flag." },
{ temREDUNDANT, "temREDUNDANT", "Sends same currency to self." },
{ temREDUNDANT_SEND_MAX, "temREDUNDANT_SEND_MAX", "Send max is redundant." },
{ temRIPPLE_EMPTY, "temRIPPLE_EMPTY", "PathSet with no paths." },
{ temUNCERTAIN, "temUNCERTAIN", "In process of determining result. Never returned." },
{ temUNKNOWN, "temUNKNOWN", "The transactions requires logic not implemented yet." },

View File

@@ -36,6 +36,9 @@ enum TER // aka TransactionEngineResult
temBAD_PATH_LOOP,
temBAD_PUBLISH,
temBAD_TRANSFER_RATE,
temBAD_SEND_MAX_XRP,
temBAD_SIGNATURE,
temBAD_SRC_ACCOUNT,
temBAD_SEQUENCE,
temDST_IS_SRC,
temDST_NEEDED,
@@ -43,6 +46,7 @@ enum TER // aka TransactionEngineResult
temINVALID,
temINVALID_FLAG,
temREDUNDANT,
temREDUNDANT_SEND_MAX,
temRIPPLE_EMPTY,
temUNCERTAIN, // An intermediate result used internally, should never be returned.
temUNKNOWN,

View File

@@ -157,7 +157,7 @@ TER Transactor::preCheck()
{
cLog(lsWARNING) << "applyTransaction: bad source id";
return temINVALID;
return temBAD_SRC_ACCOUNT;
}
// Extract signing key