mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-03 09:25:51 +00:00
Add disabled support for DestinationTag & lsfRequireDestTag.
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
|
||||
#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
|
||||
{
|
||||
@@ -40,6 +42,9 @@ 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,
|
||||
|
||||
@@ -99,6 +99,14 @@ 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) << "doPayment: Malformed transaction: DestinationTag required.";
|
||||
|
||||
return temINVALID;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
mEngine->entryModify(sleDst);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// 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)
|
||||
@@ -44,6 +46,9 @@
|
||||
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)
|
||||
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
STAmount getAmount() const { return mTransaction->getFieldU64(sfAmount); }
|
||||
STAmount getFee() const { return mTransaction->getTransactionFee(); }
|
||||
uint32 getFromAccountSeq() const { return mTransaction->getSequence(); }
|
||||
uint32 getIdent() const { return mTransaction->getFieldU32(sfSourceTag); }
|
||||
uint32 getSourceTag() const { return mTransaction->getFieldU32(sfSourceTag); }
|
||||
std::vector<unsigned char> getSignature() const { return mTransaction->getSignature(); }
|
||||
uint32 getLedger() const { return mInLedger; }
|
||||
TransStatus getStatus() const { return mStatus; }
|
||||
|
||||
@@ -53,6 +53,9 @@ 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." },
|
||||
|
||||
@@ -39,6 +39,9 @@ enum TER // aka TransactionEngineResult
|
||||
temBAD_SEQUENCE,
|
||||
temDST_IS_SRC,
|
||||
temDST_NEEDED,
|
||||
#if ENABLE_REQUIRE_DEST_TAG
|
||||
temDST_TAG_NEEDED,
|
||||
#endif
|
||||
temINVALID,
|
||||
temINVALID_FLAG,
|
||||
temREDUNDANT,
|
||||
|
||||
@@ -55,6 +55,9 @@ 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)
|
||||
|
||||
Reference in New Issue
Block a user