Implement NoRipple transaction and trust line flags.

This commit is contained in:
JoelKatz
2013-09-22 15:14:47 -07:00
parent b0c37d62fe
commit 1f372a3b08
5 changed files with 31 additions and 2 deletions

View File

@@ -52,6 +52,16 @@ public:
return isSetBit (mFlags, !mViewLowest ? lsfLowAuth : lsfHighAuth); return isSetBit (mFlags, !mViewLowest ? lsfLowAuth : lsfHighAuth);
} }
bool getNoRipple () const
{
return isSetBit (mFlags, mViewLowest ? lsfLowNoRipple : lsfHighNoRipple);
}
bool getNoRipplePeer () const
{
return isSetBit (mFlags, !mViewLowest ? lsfLowNoRipple : lsfHighNoRipple);
}
const STAmount& getBalance () const const STAmount& getBalance () const
{ {
return mBalance; return mBalance;

View File

@@ -1109,6 +1109,10 @@ Json::Value RPCHandler::doAccountLines (Json::Value params, LoadType* loadType,
jPeer["authorized"] = true; jPeer["authorized"] = true;
if (line->getAuthPeer()) if (line->getAuthPeer())
jPeer["peer_authorized"] = true; jPeer["peer_authorized"] = true;
if (line->getNoRipple())
jPeer["no_ripple"] = true;
if (line->getNoRipplePeer())
jPeer["no_ripple_peer"] = true;
} }
} }

View File

@@ -40,6 +40,8 @@ TER TrustSetTransactor::doApply ()
} }
const bool bSetAuth = isSetBit (uTxFlags, tfSetfAuth); const bool bSetAuth = isSetBit (uTxFlags, tfSetfAuth);
const bool bSetNoRipple = isSetBit (uTxFlags, tfSetNoRipple);
const bool bClearNoRipple = isSetBit (uTxFlags, tfClearNoRipple);
if (bSetAuth && !isSetBit (mTxnAccount->getFieldU32 (sfFlags), lsfRequireAuth)) if (bSetAuth && !isSetBit (mTxnAccount->getFieldU32 (sfFlags), lsfRequireAuth))
{ {
@@ -227,6 +229,15 @@ TER TrustSetTransactor::doApply ()
uFlagsOut |= (bHigh ? lsfHighAuth : lsfLowAuth); uFlagsOut |= (bHigh ? lsfHighAuth : lsfLowAuth);
} }
if (bSetNoRipple && !bClearNoRipple)
{
uFlagsOut |= (bHigh ? lsfHighNoRipple : lsfLowNoRipple);
}
else if (bClearNoRipple && !bSetNoRipple)
{
uFlagsOut &= ~(bHigh ? lsfHighNoRipple : lsfLowNoRipple);
}
if (bLowReserveSet && !bLowReserved) if (bLowReserveSet && !bLowReserved)
{ {
// Set reserve for low account. // Set reserve for low account.

View File

@@ -86,7 +86,7 @@ enum LedgerSpecificFlags
lsfRequireDestTag = 0x00020000, // True, to require a DestinationTag for payments. lsfRequireDestTag = 0x00020000, // True, to require a DestinationTag for payments.
lsfRequireAuth = 0x00040000, // True, to require a authorization to hold IOUs. lsfRequireAuth = 0x00040000, // True, to require a authorization to hold IOUs.
lsfDisallowXRP = 0x00080000, // True, to disallow sending XRP. lsfDisallowXRP = 0x00080000, // True, to disallow sending XRP.
lsfDisableMaster = 0x00100000, // True, force regular key lsfDisableMaster = 0x00100000, // True, force regular key
// ltOFFER // ltOFFER
lsfPassive = 0x00010000, lsfPassive = 0x00010000,
@@ -97,6 +97,8 @@ enum LedgerSpecificFlags
lsfHighReserve = 0x00020000, lsfHighReserve = 0x00020000,
lsfLowAuth = 0x00040000, lsfLowAuth = 0x00040000,
lsfHighAuth = 0x00080000, lsfHighAuth = 0x00080000,
lsfLowNoRipple = 0x00100000,
lsfHighNoRipple = 0x00200000,
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@@ -58,6 +58,8 @@ const uint32 tfPaymentMask = ~ (tfPartialPayment | tfLimitQuality | tfN
// TrustSet flags: // TrustSet flags:
const uint32 tfSetfAuth = 0x00010000; const uint32 tfSetfAuth = 0x00010000;
const uint32 tfTrustSetMask = ~ (tfSetfAuth); const uint32 tfSetNoRipple = 0x00020000;
const uint32 tfClearNoRipple = 0x00040000;
const uint32 tfTrustSetMask = ~ (tfSetfAuth | tfSetNoRipple | tfClearNoRipple);
#endif #endif