Add trust auto clear. Fixes #28

This commit is contained in:
Arthur Britto
2013-03-31 16:15:45 -07:00
parent bd4e00e391
commit 96733c2874
5 changed files with 200 additions and 27 deletions

View File

@@ -252,22 +252,7 @@ TER TrustSetTransactor::doApply()
{
// Can delete.
bool bLowNode = sleRippleState->isFieldPresent(sfLowNode); // Detect legacy dirs.
bool bHighNode = sleRippleState->isFieldPresent(sfHighNode);
uint64 uLowNode = sleRippleState->getFieldU64(sfLowNode);
uint64 uHighNode = sleRippleState->getFieldU64(sfHighNode);
cLog(lsTRACE) << "doTrustSet: Deleting ripple line: low";
terResult = mEngine->getNodes().dirDelete(false, uLowNode, Ledger::getOwnerDirIndex(uLowAccountID), sleRippleState->getIndex(), false, !bLowNode);
if (tesSUCCESS == terResult)
{
cLog(lsTRACE) << "doTrustSet: Deleting ripple line: high";
terResult = mEngine->getNodes().dirDelete(false, uHighNode, Ledger::getOwnerDirIndex(uHighAccountID), sleRippleState->getIndex(), false, !bHighNode);
}
cLog(lsINFO) << "doTrustSet: Deleting ripple line: state";
mEngine->entryDelete(sleRippleState);
terResult = mEngine->getNodes().trustDelete(sleRippleState, uLowAccountID, uHighAccountID);
}
else if (bReserveIncrease
&& mPriorBalance.getNValue() < uReserveCreate) // Reserve is not scaled by load.