From 385a87db31f97bd4f4f80a865416f3d4c981fbe8 Mon Sep 17 00:00:00 2001 From: Nik Bougalis Date: Mon, 3 Nov 2014 17:43:31 -0800 Subject: [PATCH] Claim a fee when a required destination tag is not specified (RIPD-574) --- src/ripple/app/transactors/Payment.cpp | 2 +- src/ripple/protocol/TER.h | 2 +- src/ripple/protocol/impl/TER.cpp | 2 +- test/robust-transaction-test.js | 25 ++++--------------------- 4 files changed, 7 insertions(+), 24 deletions(-) diff --git a/src/ripple/app/transactors/Payment.cpp b/src/ripple/app/transactors/Payment.cpp index 514e9de4b4..a5e308435d 100644 --- a/src/ripple/app/transactors/Payment.cpp +++ b/src/ripple/app/transactors/Payment.cpp @@ -241,7 +241,7 @@ public: // no way for this field to be set. m_journal.trace << "Malformed transaction: DestinationTag required."; - return tefDST_TAG_NEEDED; + return tecDST_TAG_NEEDED; } else { diff --git a/src/ripple/protocol/TER.h b/src/ripple/protocol/TER.h index 32910c2679..b0ad1f4681 100644 --- a/src/ripple/protocol/TER.h +++ b/src/ripple/protocol/TER.h @@ -105,7 +105,6 @@ enum TER // aka TransactionEngineResult tefBAD_AUTH, tefBAD_LEDGER, tefCREATED, - tefDST_TAG_NEEDED, tefEXCEPTION, tefINTERNAL, tefNO_AUTH_REQUIRED, // Can't set auth if auth is not required. @@ -193,6 +192,7 @@ enum TER // aka TransactionEngineResult tecNO_ENTRY = 140, tecINSUFFICIENT_RESERVE = 141, tecNEED_MASTER_KEY = 142, + tecDST_TAG_NEEDED = 143, }; inline bool isTelLocal(TER x) diff --git a/src/ripple/protocol/impl/TER.cpp b/src/ripple/protocol/impl/TER.cpp index 6d5624e16a..a89e50b714 100644 --- a/src/ripple/protocol/impl/TER.cpp +++ b/src/ripple/protocol/impl/TER.cpp @@ -66,13 +66,13 @@ bool transResultInfo (TER code, std::string& token, std::string& text) { tecNO_ENTRY, "tecNO_ENTRY", "No matching entry found." }, { tecINSUFFICIENT_RESERVE, "tecINSUFFICIENT_RESERVE", "Insufficient reserve to complete requested operation." }, { tecNEED_MASTER_KEY, "tecNEED_MASTER_KEY", "The operation requires the use of the Master Key." }, + { tecDST_TAG_NEEDED, "tecDST_TAG_NEEDED", "A destination tag is required." }, { tefALREADY, "tefALREADY", "The exact transaction was already in this ledger." }, { tefBAD_ADD_AUTH, "tefBAD_ADD_AUTH", "Not authorized to add account." }, { tefBAD_AUTH, "tefBAD_AUTH", "Transaction's public key is not authorized." }, { tefBAD_LEDGER, "tefBAD_LEDGER", "Ledger in unexpected state." }, { tefCREATED, "tefCREATED", "Can't add an already created account." }, - { tefDST_TAG_NEEDED, "tefDST_TAG_NEEDED", "Destination tag required." }, { tefEXCEPTION, "tefEXCEPTION", "Unexpected program state." }, { tefFAILURE, "tefFAILURE", "Failed to apply." }, { tefINTERNAL, "tefINTERNAL", "Internal error." }, diff --git a/test/robust-transaction-test.js b/test/robust-transaction-test.js index f5814d99df..454e7c3d06 100644 --- a/test/robust-transaction-test.js +++ b/test/robust-transaction-test.js @@ -53,26 +53,6 @@ make_suite('Robust transaction submission', function() { testutils.create_accounts($.remote, 'root', '20000.0', [ 'alice', 'bob' ], callback); }, - function setRequireDestTag(callback) { - self.what = 'Set RequireDestTag'; - - var tx = $.remote.transaction().account_set('alice'); - tx.set_flags('RequireDestTag'); - - tx.once('submitted', function(m) { - - assert.strictEqual('tesSUCCESS', m.engine_result); - }); - - tx.once('final', function() { - callback(); - }); - - tx.submit(); - - testutils.ledger_wait($.remote, tx); - }, - function sendInvalidTransaction(callback) { self.what = 'Send transaction without a destination tag'; @@ -83,9 +63,12 @@ make_suite('Robust transaction submission', function() { }); tx.once('submitted', function(m) { - assert.strictEqual('tefDST_TAG_NEEDED', m.engine_result); + assert.strictEqual('tefMAX_LEDGER', m.engine_result); }); + // Standalone mode starts with the open ledger as 3, so there's no way + // for this to be anything other than tefMAX_LEDGER. + tx.lastLedger(1); tx.submit(); //Invoke callback immediately