Return terNO_LINE instead of tefEXCEPTION where approriate.

This commit is contained in:
Arthur Britto
2012-10-18 18:49:55 -07:00
parent 7664065cf6
commit 4be22da6d3

View File

@@ -1400,30 +1400,30 @@ TER PathState::pushImply(
// Currency is different, need to convert via an offer. // Currency is different, need to convert via an offer.
terResult = pushNode( terResult = pushNode(
STPathElement::typeCurrency // Offer. STPathElement::typeCurrency // Offer.
| STPathElement::typeIssuer, | STPathElement::typeIssuer,
ACCOUNT_ONE, // Placeholder for offers. ACCOUNT_ONE, // Placeholder for offers.
uCurrencyID, // The offer's output is what is now wanted. uCurrencyID, // The offer's output is what is now wanted.
uIssuerID); uIssuerID);
} }
// For ripple, non-stamps, ensure the issuer is on at least one side of the transaction. // For ripple, non-stamps, ensure the issuer is on at least one side of the transaction.
if (tesSUCCESS == terResult if (tesSUCCESS == terResult
&& !!uCurrencyID // Not stamps. && !!uCurrencyID // Not stamps.
&& (pnPrv.uAccountID != uIssuerID // Previous is not issuing own IOUs. && (pnPrv.uAccountID != uIssuerID // Previous is not issuing own IOUs.
&& uAccountID != uIssuerID)) // Current is not receiving own IOUs. && uAccountID != uIssuerID)) // Current is not receiving own IOUs.
{ {
// Need to ripple through uIssuerID's account. // Need to ripple through uIssuerID's account.
terResult = pushNode( terResult = pushNode(
STPathElement::typeAccount, STPathElement::typeAccount,
uIssuerID, // Intermediate account is the needed issuer. uIssuerID, // Intermediate account is the needed issuer.
uCurrencyID, uCurrencyID,
uIssuerID); uIssuerID);
} }
cLog(lsINFO) << "pushImply< " << terResult; cLog(lsDEBUG) << boost::str(boost::format("pushImply< : %s") % transToken(terResult));
return terResult; return terResult;
} }
@@ -1544,11 +1544,12 @@ TER PathState::pushNode(
vpnNodes.push_back(pnCur); vpnNodes.push_back(pnCur);
} }
} }
cLog(lsINFO) << "pushNode< " << terResult; cLog(lsDEBUG) << boost::str(boost::format("pushNode< : %s") % transToken(terResult));
return terResult; return terResult;
} }
// terStatus = tesSUCCESS, temBAD_PATH, terNO_LINE, or temBAD_PATH_LOOP
PathState::PathState( PathState::PathState(
const int iIndex, const int iIndex,
const LedgerEntrySet& lesSource, const LedgerEntrySet& lesSource,
@@ -1886,7 +1887,7 @@ TER RippleCalc::rippleCalc(
if (pspDirect) if (pspDirect)
{ {
// Return if malformed. // Return if malformed.
if (pspDirect->terStatus >= temMALFORMED && pspDirect->terStatus < tefFAILURE) if (isTemMalformed(pspDirect->terStatus))
return pspDirect->terStatus; return pspDirect->terStatus;
if (tesSUCCESS == pspDirect->terStatus) if (tesSUCCESS == pspDirect->terStatus)
@@ -1917,14 +1918,11 @@ TER RippleCalc::rippleCalc(
if (pspExpanded) if (pspExpanded)
{ {
// Return if malformed. // Return if malformed.
if (pspExpanded->terStatus >= temMALFORMED && pspExpanded->terStatus < tefFAILURE) if (isTemMalformed(pspExpanded->terStatus))
return pspExpanded->terStatus; return pspExpanded->terStatus;
if (tesSUCCESS == pspExpanded->terStatus) if (tesSUCCESS == pspExpanded->terStatus)
{ terResult = tesSUCCESS; // Had a success.
// Had a success.
terResult = tesSUCCESS;
}
vpsPaths.push_back(pspExpanded); vpsPaths.push_back(pspExpanded);
} }
@@ -1932,7 +1930,8 @@ TER RippleCalc::rippleCalc(
if (vpsPaths.empty()) if (vpsPaths.empty())
{ {
return tefEXCEPTION; // No paths. Missing credit lines.
return terNO_LINE;
} }
else if (tesSUCCESS != terResult) else if (tesSUCCESS != terResult)
{ {