Enable DestinationTag features.

This commit is contained in:
Arthur Britto
2013-01-04 11:57:05 -08:00
parent 3dfb1ca1eb
commit 2746806cd3
8 changed files with 0 additions and 24 deletions

View File

@@ -8,21 +8,16 @@ TER AccountSetTransactor::doApply()
const uint32 uTxFlags = mTxn.getFlags(); const uint32 uTxFlags = mTxn.getFlags();
#if ENABLE_REQUIRE_DEST_TAG
const uint32 uFlagsIn = mTxnAccount->getFieldU32(sfFlags); const uint32 uFlagsIn = mTxnAccount->getFieldU32(sfFlags);
uint32 uFlagsOut = uFlagsIn; uint32 uFlagsOut = uFlagsIn;
if (uTxFlags & tfAccountSetMask) if (uTxFlags & tfAccountSetMask)
#else
if (uTxFlags)
#endif
{ {
cLog(lsINFO) << "AccountSet: Malformed transaction: Invalid flags set."; cLog(lsINFO) << "AccountSet: Malformed transaction: Invalid flags set.";
return temINVALID_FLAG; return temINVALID_FLAG;
} }
#if ENABLE_REQUIRE_DEST_TAG
// //
// RequireDestTag // RequireDestTag
// //
@@ -50,7 +45,6 @@ TER AccountSetTransactor::doApply()
if (uFlagsIn != uFlagsOut) if (uFlagsIn != uFlagsOut)
mTxnAccount->setFieldU32(sfFlags, uFlagsOut); mTxnAccount->setFieldU32(sfFlags, uFlagsOut);
#endif
// //
// EmailHash // EmailHash

View File

@@ -3,8 +3,6 @@
#include "SerializedObject.h" #include "SerializedObject.h"
#define ENABLE_REQUIRE_DEST_TAG 0
// Used as the type of a transaction or the type of a ledger entry. // Used as the type of a transaction or the type of a ledger entry.
enum LedgerEntryType enum LedgerEntryType
{ {
@@ -42,9 +40,7 @@ enum LedgerSpecificFlags
{ {
// ltACCOUNT_ROOT // ltACCOUNT_ROOT
lsfPasswordSpent = 0x00010000, // True, if password set fee is spent. lsfPasswordSpent = 0x00010000, // True, if password set fee is spent.
#if ENABLE_REQUIRE_DEST_TAG
lsfRequireDestTag = 0x00020000, // True, to require a DestinationTag for payments. lsfRequireDestTag = 0x00020000, // True, to require a DestinationTag for payments.
#endif
// ltOFFER // ltOFFER
lsfPassive = 0x00010000, lsfPassive = 0x00010000,

View File

@@ -99,14 +99,12 @@ TER PaymentTransactor::doApply()
sleDst->setFieldAccount(sfAccount, uDstAccountID); sleDst->setFieldAccount(sfAccount, uDstAccountID);
sleDst->setFieldU32(sfSequence, 1); sleDst->setFieldU32(sfSequence, 1);
} }
#if ENABLE_REQUIRE_DEST_TAG
else if ((sleDst->getFlags() & lsfRequireDestTag) && !mTxn.isFieldPresent(sfDestinationTag)) else if ((sleDst->getFlags() & lsfRequireDestTag) && !mTxn.isFieldPresent(sfDestinationTag))
{ {
cLog(lsINFO) << "Payment: Malformed transaction: DestinationTag required."; cLog(lsINFO) << "Payment: Malformed transaction: DestinationTag required.";
return temINVALID; return temINVALID;
} }
#endif
else else
{ {
mEngine->entryModify(sleDst); mEngine->entryModify(sleDst);

View File

@@ -1,8 +1,6 @@
// This is not really a header file, but it can be used as one with // This is not really a header file, but it can be used as one with
// appropriate #define statements. // appropriate #define statements.
#define ENABLE_DESTINATION_TAG 0
// types (common) // types (common)
TYPE(Int16, UINT16, 1) TYPE(Int16, UINT16, 1)
TYPE(Int32, UINT32, 2) TYPE(Int32, UINT32, 2)
@@ -46,9 +44,7 @@
FIELD(TransferRate, UINT32, 11) FIELD(TransferRate, UINT32, 11)
FIELD(WalletSize, UINT32, 12) FIELD(WalletSize, UINT32, 12)
FIELD(OwnerCount, UINT32, 13) FIELD(OwnerCount, UINT32, 13)
#if ENABLE_DESTINATION_TAG
FIELD(DestinationTag, UINT32, 14) FIELD(DestinationTag, UINT32, 14)
#endif
// 32-bit integers (uncommon) // 32-bit integers (uncommon)
FIELD(HighQualityIn, UINT32, 16) FIELD(HighQualityIn, UINT32, 16)

View File

@@ -53,9 +53,7 @@ bool transResultInfo(TER terCode, std::string& strToken, std::string& strHuman)
{ temBAD_SEQUENCE, "temBAD_SEQUENCE", "Malformed: Sequence is not in the past." }, { temBAD_SEQUENCE, "temBAD_SEQUENCE", "Malformed: Sequence is not in the past." },
{ temDST_IS_SRC, "temDST_IS_SRC", "Destination may not be source." }, { temDST_IS_SRC, "temDST_IS_SRC", "Destination may not be source." },
{ temDST_NEEDED, "temDST_NEEDED", "Destination not specified." }, { temDST_NEEDED, "temDST_NEEDED", "Destination not specified." },
#if ENABLE_REQUIRE_DEST_TAG
{ temDST_TAG_NEEDED, "temDST_TAG_NEEDED", "Destination tag required." }, { temDST_TAG_NEEDED, "temDST_TAG_NEEDED", "Destination tag required." },
#endif
{ temINVALID, "temINVALID", "The transaction is ill-formed." }, { temINVALID, "temINVALID", "The transaction is ill-formed." },
{ temINVALID_FLAG, "temINVALID_FLAG", "The transaction has an invalid flag." }, { temINVALID_FLAG, "temINVALID_FLAG", "The transaction has an invalid flag." },
{ temREDUNDANT, "temREDUNDANT", "Sends same currency to self." }, { temREDUNDANT, "temREDUNDANT", "Sends same currency to self." },

View File

@@ -39,9 +39,7 @@ enum TER // aka TransactionEngineResult
temBAD_SEQUENCE, temBAD_SEQUENCE,
temDST_IS_SRC, temDST_IS_SRC,
temDST_NEEDED, temDST_NEEDED,
#if ENABLE_REQUIRE_DEST_TAG
temDST_TAG_NEEDED, temDST_TAG_NEEDED,
#endif
temINVALID, temINVALID,
temINVALID_FLAG, temINVALID_FLAG,
temREDUNDANT, temREDUNDANT,

View File

@@ -55,9 +55,7 @@ static bool TFInit()
<< SOElement(sfSendMax, SOE_OPTIONAL) << SOElement(sfSendMax, SOE_OPTIONAL)
<< SOElement(sfPaths, SOE_DEFAULT) << SOElement(sfPaths, SOE_DEFAULT)
<< SOElement(sfInvoiceID, SOE_OPTIONAL) << SOElement(sfInvoiceID, SOE_OPTIONAL)
#if ENABLE_DESTINATION_TAG
<< SOElement(sfDestinationTag, SOE_OPTIONAL) << SOElement(sfDestinationTag, SOE_OPTIONAL)
#endif
; ;
DECLARE_TF(Contract, ttCONTRACT) DECLARE_TF(Contract, ttCONTRACT)

View File

@@ -59,12 +59,10 @@ const int TransactionMaxLen = 1048576;
// Transaction flags. // Transaction flags.
// //
#if ENABLE_REQUIRE_DEST_TAG
// AccountSet flags: // AccountSet flags:
const uint32 tfRequireDestTag = 0x00010000; const uint32 tfRequireDestTag = 0x00010000;
const uint32 tfOptionalDestTag = 0x00020000; const uint32 tfOptionalDestTag = 0x00020000;
const uint32 tfAccountSetMask = ~(tfRequireDestTag|tfOptionalDestTag); const uint32 tfAccountSetMask = ~(tfRequireDestTag|tfOptionalDestTag);
#endif
// OfferCreate flags: // OfferCreate flags:
const uint32 tfPassive = 0x00010000; const uint32 tfPassive = 0x00010000;