From 49a3536125bac9377e60af947cd2d65fa454af96 Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Sun, 20 Jan 2013 19:48:18 -0800 Subject: [PATCH] Reject partial payment to create accounts. --- src/cpp/ripple/PaymentTransactor.cpp | 8 ++++++++ src/cpp/ripple/TransactionErr.cpp | 1 + src/cpp/ripple/TransactionErr.h | 1 + 3 files changed, 10 insertions(+) diff --git a/src/cpp/ripple/PaymentTransactor.cpp b/src/cpp/ripple/PaymentTransactor.cpp index 813328052..6019d0716 100644 --- a/src/cpp/ripple/PaymentTransactor.cpp +++ b/src/cpp/ripple/PaymentTransactor.cpp @@ -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."; diff --git a/src/cpp/ripple/TransactionErr.cpp b/src/cpp/ripple/TransactionErr.cpp index a10f4c97d..201393ae8 100644 --- a/src/cpp/ripple/TransactionErr.cpp +++ b/src/cpp/ripple/TransactionErr.cpp @@ -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." }, diff --git a/src/cpp/ripple/TransactionErr.h b/src/cpp/ripple/TransactionErr.h index dcb9627f9..0230be848 100644 --- a/src/cpp/ripple/TransactionErr.h +++ b/src/cpp/ripple/TransactionErr.h @@ -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: