Reject partial payment to create accounts.

This commit is contained in:
Arthur Britto
2013-01-20 19:48:18 -08:00
parent b572ba7c8d
commit 49a3536125
3 changed files with 10 additions and 0 deletions

View File

@@ -89,6 +89,14 @@ TER PaymentTransactor::doApply()
// Another transaction could create the account and then this transaction would succeed.
return tecNO_DST;
}
else if (isSetBit(mParams, tapOPEN_LEDGER) && bPartialPayment)
{
cLog(lsINFO) << "Payment: Delay transaction: Partial payment not allowed to create account.";
// Make retry work smaller, by rejecting this.
// Another transaction could create the account and then this transaction would succeed.
return telNO_DST_PARTIAL;
}
else if (saDstAmount.getNValue() < mEngine->getLedger()->getReserve(0)) // Reserve is not scaled by load.
{
cLog(lsINFO) << "Payment: Delay transaction: Destination account does not exist. Insufficent payment to create account.";

View File

@@ -42,6 +42,7 @@ bool transResultInfo(TER terCode, std::string& strToken, std::string& strHuman)
{ telBAD_PATH_COUNT, "telBAD_PATH_COUNT", "Malformed: Too many paths." },
{ telBAD_PUBLIC_KEY, "telBAD_PUBLIC_KEY", "Public key too long." },
{ telINSUF_FEE_P, "telINSUF_FEE_P", "Fee insufficient." },
{ telNO_DST_PARTIAL, "telNO_DST_PARTIAL", "Partial payment to create account not allowed." },
{ temMALFORMED, "temMALFORMED", "Malformed transaction." },
{ temBAD_AMOUNT, "temBAD_AMOUNT", "Can only send positive amounts." },

View File

@@ -17,6 +17,7 @@ enum TER // aka TransactionEngineResult
telBAD_PATH_COUNT,
telBAD_PUBLIC_KEY,
telINSUF_FEE_P,
telNO_DST_PARTIAL,
// -299 .. -200: M Malformed (bad signature)
// Causes: