From 75d935e0df84d2c1537154fe0d5d1a2c26e1692f Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Thu, 3 Jan 2013 13:04:07 -0800 Subject: [PATCH] Merge tepPARTIAL into tecCLAIMED. --- src/cpp/ripple/RippleCalc.cpp | 8 +++----- src/cpp/ripple/TransactionEngine.cpp | 4 ---- src/cpp/ripple/TransactionErr.cpp | 5 ++--- src/cpp/ripple/TransactionErr.h | 17 +++-------------- src/js/remote.js | 8 ++++---- test/offer-test.js | 2 +- test/send-test.js | 4 ++-- 7 files changed, 15 insertions(+), 33 deletions(-) diff --git a/src/cpp/ripple/RippleCalc.cpp b/src/cpp/ripple/RippleCalc.cpp index 783ec7be23..2d85bea144 100644 --- a/src/cpp/ripple/RippleCalc.cpp +++ b/src/cpp/ripple/RippleCalc.cpp @@ -2567,8 +2567,7 @@ cLog(lsDEBUG) << boost::str(boost::format("rippleCalc: Summary: %d rate: %s qual { // Have sent maximum allowed. Partial payment not allowed. - terResult = tepPATH_PARTIAL; - lesActive = lesBase; // Revert to just fees charged. + terResult = tecPATH_PARTIAL; } else { @@ -2581,14 +2580,13 @@ cLog(lsDEBUG) << boost::str(boost::format("rippleCalc: Summary: %d rate: %s qual else if (!bPartialPayment) { // Partial payment not allowed. - terResult = tepPATH_PARTIAL; - lesActive = lesBase; // Revert to just fees charged. + terResult = tecPATH_PARTIAL; } // Partial payment ok. else if (!saDstAmountAct) { // No payment at all. - terResult = tecPATH_DRY; // Revert to just fees charged is built into tec. + terResult = tecPATH_DRY; } else { diff --git a/src/cpp/ripple/TransactionEngine.cpp b/src/cpp/ripple/TransactionEngine.cpp index 7a3af2d4cb..2f8641b701 100644 --- a/src/cpp/ripple/TransactionEngine.cpp +++ b/src/cpp/ripple/TransactionEngine.cpp @@ -116,10 +116,6 @@ TER TransactionEngine::applyTransaction(const SerializedTransaction& txn, Transa { didApply = true; } - else if (isTepPartial(terResult) && !isSetBit(params, tapRETRY)) - { - didApply = true; - } else if (isTecClaim(terResult) && !isSetBit(params, tapRETRY)) { // only claim the transaction fee cLog(lsINFO) << "Reprocessing to only claim fee"; diff --git a/src/cpp/ripple/TransactionErr.cpp b/src/cpp/ripple/TransactionErr.cpp index df2d62cef7..131e03ad34 100644 --- a/src/cpp/ripple/TransactionErr.cpp +++ b/src/cpp/ripple/TransactionErr.cpp @@ -17,6 +17,8 @@ bool transResultInfo(TER terCode, std::string& strToken, std::string& strHuman) { tecNO_LINE_INSUF_RESERVE, "tecNO_LINE_INSUF_RESERVE", "No such line. Too little reserve to create it." }, { tecNO_LINE_REDUNDANT, "tecNO_LINE_REDUNDANT", "Can't set non-existant line to default." }, { tecPATH_DRY, "tecPATH_DRY", "Path could not send partial amount." }, + { tecPATH_PARTIAL, "tecPATH_PARTIAL", "Path could not send full amount." }, + { tecUNFUNDED, "tecUNFUNDED", "Source account had insufficient balance for transaction." }, { tefFAILURE, "tefFAILURE", "Failed to apply." }, @@ -58,9 +60,6 @@ bool transResultInfo(TER terCode, std::string& strToken, std::string& strHuman) { temUNCERTAIN, "temUNCERTAIN", "In process of determining result. Never returned." }, { temUNKNOWN, "temUNKNOWN", "The transactions requires logic not implemented yet." }, - { tepPARTIAL, "tepPARTIAL", "Partial success." }, - { tepPATH_PARTIAL, "tepPATH_PARTIAL", "Path could not send full amount." }, - { terRETRY, "terRETRY", "Retry transaction." }, { terFUNDS_SPENT, "terFUNDS_SPENT", "Can't set password, password set funds already spent." }, { terINSUF_FEE_B, "terINSUF_FEE_B", "Account balance can't pay fee." }, diff --git a/src/cpp/ripple/TransactionErr.h b/src/cpp/ripple/TransactionErr.h index 238ef7ddfe..85f8226072 100644 --- a/src/cpp/ripple/TransactionErr.h +++ b/src/cpp/ripple/TransactionErr.h @@ -92,20 +92,9 @@ enum TER // aka TransactionEngineResult // - Forwarded tesSUCCESS = 0, - // 100 .. 119 P Partial success (SR) (ripple transaction with no good paths, pay to non-existent account) + // 100 .. 129 C Claim fee only (ripple transaction with no good paths, pay to non-existent account, no path) // Causes: // - Success, but does not achieve optimal result. - // Implications: - // - Applied - // - Forwarded - // Only allowed as a return code of appliedTransaction when !tapRetry. Otherwise, treated as terRETRY. - // - // DO NOT CHANGE THESE NUMBERS: They appear in ledger meta data. - tepPARTIAL = 100, - tepPATH_PARTIAL = 101, - - // 120 .. C Claim fee only (CO) (no path) - // Causes: // - Invalid transaction or no effect, but claim fee to use the sequence number. // Implications: // - Applied @@ -113,7 +102,8 @@ enum TER // aka TransactionEngineResult // Only allowed as a return code of appliedTransaction when !tapRetry. Otherwise, treated as terRETRY. // // DO NOT CHANGE THESE NUMBERS: They appear in ledger meta data. - tecCLAIM = 120, + tecCLAIM = 100, + tecPATH_PARTIAL = 101, tecDIR_FULL = 121, tecINSUF_RESERVE_LINE = 122, tecINSUF_RESERVE_OFFER = 123, @@ -130,7 +120,6 @@ enum TER // aka TransactionEngineResult #define isTefFailure(x) ((x) >= tefFAILURE && (x) < terRETRY) #define isTerRetry(x) ((x) >= terRETRY && (x) < tesSUCCESS) #define isTepSuccess(x) ((x) >= tesSUCCESS) -#define isTepPartial(x) ((x) >= tepPATH_PARTIAL && (x) < tecCLAIM) #define isTecClaim(x) ((x) >= tecCLAIM) bool transResultInfo(TER terCode, std::string& strToken, std::string& strHuman); diff --git a/src/js/remote.js b/src/js/remote.js index 9e46470b49..76b27f7187 100644 --- a/src/js/remote.js +++ b/src/js/remote.js @@ -1162,7 +1162,7 @@ Remote.prototype.transaction = function () { // |/ // |- 'tesSUCCESS' - Transaction in ledger as expected. // |- 'ter...' - Transaction failed. -// \- 'tep...' - Transaction partially succeeded. +// \- 'tec...' - Transaction claimed fee only. // // Notes: // - All transactions including those with local and malformed errors may be @@ -1225,7 +1225,7 @@ Transaction.prototype.consts = { 'tefFAILURE' : -199, 'terRETRY' : -99, 'tesSUCCESS' : 0, - 'tepPARTIAL' : 100, + 'tecCLAIMED' : 100, }; Transaction.prototype.isTelLocal = function (ter) { @@ -1248,8 +1248,8 @@ Transaction.prototype.isTepSuccess = function (ter) { return ter >= this.consts.tesSUCCESS; }; -Transaction.prototype.isTepPartial = function (ter) { - return ter >= this.consts.tepPATH_PARTIAL; +Transaction.prototype.isTecClaimed = function (ter) { + return ter >= this.consts.tecCLAIMED; }; Transaction.prototype.isRejected = function (ter) { diff --git a/test/offer-test.js b/test/offer-test.js index ec629c66dc..2c20dafb18 100644 --- a/test/offer-test.js +++ b/test/offer-test.js @@ -602,7 +602,7 @@ buster.testCase("Offer tests", { .on('proposed', function (m) { // console.log("proposed: %s", JSON.stringify(m)); - callback(m.result !== 'tepPATH_PARTIAL'); + callback(m.result !== 'tecPATH_PARTIAL'); }) .submit(); }, diff --git a/test/send-test.js b/test/send-test.js index 2322da8a92..c47b054f18 100644 --- a/test/send-test.js +++ b/test/send-test.js @@ -549,7 +549,7 @@ buster.testCase("Indirect ripple", { .on('proposed', function (m) { // console.log("proposed: %s", JSON.stringify(m)); - callback(m.result !== 'tepPATH_PARTIAL'); + callback(m.result !== 'tecPATH_PARTIAL'); }) .submit(); }, @@ -561,7 +561,7 @@ buster.testCase("Indirect ripple", { .on('proposed', function (m) { // console.log("proposed: %s", JSON.stringify(m)); - callback(m.result !== 'tepPATH_PARTIAL'); + callback(m.result !== 'tecPATH_PARTIAL'); }) .submit(); },