Add support for DisallowXRP.

This commit is contained in:
Arthur Britto
2013-04-24 21:07:01 -07:00
parent 59f97ff3b5
commit 3eacab99ba
3 changed files with 36 additions and 6 deletions

View File

@@ -44,7 +44,7 @@ TER AccountSetTransactor::doApply()
uFlagsOut |= lsfRequireAuth;
}
if (uTxFlags & tfOptionalAuth)
if ((uTxFlags & tfOptionalAuth) && isSetBit(uFlagsIn, lsfRequireAuth))
{
cLog(lsINFO) << "AccountSet: Clear RequireAuth.";
@@ -62,16 +62,16 @@ TER AccountSetTransactor::doApply()
return temINVALID_FLAG;
}
if (uTxFlags & tfRequireDestTag)
if ((uTxFlags & tfOptionalDestTag) && !isSetBit(uFlagsIn, lsfRequireDestTag))
{
cLog(lsINFO) << "AccountSet: Set RequireDestTag.";
cLog(lsINFO) << "AccountSet: Set lsfRequireDestTag.";
uFlagsOut |= lsfRequireDestTag;
}
if (uTxFlags & tfOptionalDestTag)
if ((uTxFlags & tfOptionalDestTag) && isSetBit(uFlagsIn, lsfRequireDestTag))
{
cLog(lsINFO) << "AccountSet: Clear RequireDestTag.";
cLog(lsINFO) << "AccountSet: Clear lsfRequireDestTag.";
uFlagsOut &= ~lsfRequireDestTag;
}
@@ -79,6 +79,31 @@ TER AccountSetTransactor::doApply()
if (uFlagsIn != uFlagsOut)
mTxnAccount->setFieldU32(sfFlags, uFlagsOut);
//
// DisallowXRP
//
if ((tfDisallowXRP|tfAllowXRP) == (uTxFlags & (tfDisallowXRP|tfAllowXRP)))
{
cLog(lsINFO) << "AccountSet: Malformed transaction: Contradictory flags set.";
return temINVALID_FLAG;
}
if ((uTxFlags & tfDisallowXRP) && !isSetBit(uFlagsIn, lsfDisallowXRP))
{
cLog(lsINFO) << "AccountSet: Set lsfDisallowXRP.";
uFlagsOut |= lsfDisallowXRP;
}
if ((uTxFlags & tfAllowXRP) && isSetBit(uFlagsIn, lsfDisallowXRP))
{
cLog(lsINFO) << "AccountSet: Clear lsfDisallowXRP.";
uFlagsOut &= ~lsfDisallowXRP;
}
//
// EmailHash
//

View File

@@ -42,6 +42,7 @@ enum LedgerSpecificFlags
lsfPasswordSpent = 0x00010000, // True, if password set fee is spent.
lsfRequireDestTag = 0x00020000, // True, to require a DestinationTag for payments.
lsfRequireAuth = 0x00040000, // True, to require a authorization to hold IOUs.
lsfDisallowXRP = 0x00080000, // True, to disallow sending XRP.
// ltOFFER
lsfPassive = 0x00010000,

View File

@@ -64,7 +64,11 @@ const uint32 tfRequireDestTag = 0x00010000;
const uint32 tfOptionalDestTag = 0x00020000;
const uint32 tfRequireAuth = 0x00040000;
const uint32 tfOptionalAuth = 0x00080000;
const uint32 tfAccountSetMask = ~(tfRequireDestTag|tfOptionalDestTag|tfRequireAuth|tfOptionalAuth);
const uint32 tfDisallowXRP = 0x00100000;
const uint32 tfAllowXRP = 0x00200000;
const uint32 tfAccountSetMask = ~(tfRequireDestTag|tfOptionalDestTag
|tfRequireAuth|tfOptionalAuth
|tfDisallowXRP|tfAllowXRP);
// OfferCreate flags:
const uint32 tfPassive = 0x00010000;