Add a facility in TrustSet to clear a RippleState to self.

This commit is contained in:
Arthur Britto
2013-04-23 18:42:35 -07:00
parent 903de23f8d
commit c360609eff

View File

@@ -67,11 +67,22 @@ TER TrustSetTransactor::doApply()
}
if (mTxnAccountID == uDstAccountID)
{
SLE::pointer selDelete = mEngine->entryCache(ltRIPPLE_STATE, Ledger::getRippleStateIndex(mTxnAccountID, uDstAccountID, uCurrencyID));
if (selDelete)
{
cLog(lsWARNING) << "doTrustSet: Clearing redundant line.";
return mEngine->getNodes().trustDelete(selDelete, mTxnAccountID, uDstAccountID);
}
else
{
cLog(lsINFO) << "doTrustSet: Malformed transaction: Can not extend credit to self.";
return temDST_IS_SRC;
}
}
SLE::pointer sleDst = mEngine->entryCache(ltACCOUNT_ROOT, Ledger::getAccountRootIndex(uDstAccountID));
if (!sleDst)