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

View File

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

View File

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

View File

@@ -1,8 +1,6 @@
// This is not really a header file, but it can be used as one with
// appropriate #define statements.
#define ENABLE_DESTINATION_TAG 0
// types (common)
TYPE(Int16, UINT16, 1)
TYPE(Int32, UINT32, 2)
@@ -46,9 +44,7 @@
FIELD(TransferRate, UINT32, 11)
FIELD(WalletSize, UINT32, 12)
FIELD(OwnerCount, UINT32, 13)
#if ENABLE_DESTINATION_TAG
FIELD(DestinationTag, UINT32, 14)
#endif
// 32-bit integers (uncommon)
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." },
{ temDST_IS_SRC, "temDST_IS_SRC", "Destination may not be source." },
{ temDST_NEEDED, "temDST_NEEDED", "Destination not specified." },
#if ENABLE_REQUIRE_DEST_TAG
{ temDST_TAG_NEEDED, "temDST_TAG_NEEDED", "Destination tag required." },
#endif
{ temINVALID, "temINVALID", "The transaction is ill-formed." },
{ temINVALID_FLAG, "temINVALID_FLAG", "The transaction has an invalid flag." },
{ temREDUNDANT, "temREDUNDANT", "Sends same currency to self." },

View File

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

View File

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

View File

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