Skip to content

Commit

Permalink
Remove unused ter code from StrandResult
Browse files Browse the repository at this point in the history
  • Loading branch information
seelabs committed Aug 2, 2019
1 parent 7d23c0f commit 2e96bb3
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions src/ripple/app/paths/impl/StrandFlow.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace ripple {
template<class TInAmt, class TOutAmt>
struct StrandResult
{
TER ter = temUNKNOWN; ///< Result code
bool success; ///< Strand succeeded
TInAmt in = beast::zero; ///< Currency amount in
TOutAmt out = beast::zero; ///< Currency amount out
boost::optional<PaymentSandbox> sandbox; ///< Resulting Sandbox state
Expand All @@ -54,22 +54,24 @@ struct StrandResult
/** Strand result constructor */
StrandResult () = default;

StrandResult (TInAmt const& in_,
StrandResult(
TInAmt const& in_,
TOutAmt const& out_,
PaymentSandbox&& sandbox_,
boost::container::flat_set<uint256> ofrsToRm_,
bool inactive_)
: ter (tesSUCCESS)
, in (in_)
, out (out_)
, sandbox (std::move (sandbox_))
, ofrsToRm (std::move (ofrsToRm_))
: success(true)
, in(in_)
, out(out_)
, sandbox(std::move(sandbox_))
, ofrsToRm(std::move(ofrsToRm_))
, inactive(inactive_)
{
}

StrandResult (TER ter_, boost::container::flat_set<uint256> ofrsToRm_)
: ter (ter_), ofrsToRm (std::move (ofrsToRm_))
explicit
StrandResult(boost::container::flat_set<uint256> ofrsToRm_)
: success(false), ofrsToRm(std::move(ofrsToRm_))
{
}
};
Expand Down Expand Up @@ -105,9 +107,7 @@ flow (

if (isDirectXrpToXrp<TInAmt, TOutAmt> (strand))
{
// The current implementation returns NO_LINE for XRP->XRP transfers.
// Keep this behavior
return {tecNO_LINE, std::move (ofrsToRm)};
return Result{std::move (ofrsToRm)};
}

try
Expand All @@ -129,7 +129,7 @@ flow (
if (strand[i]->isZero (r.second))
{
JLOG (j.trace()) << "Strand found dry in rev";
return {tecPATH_DRY, std::move (ofrsToRm)};
return Result{std::move (ofrsToRm)};
}

if (i == 0 && maxIn && *maxIn < get<TInAmt> (r.first))
Expand All @@ -147,7 +147,7 @@ flow (
if (strand[i]->isZero(r.second))
{
JLOG(j.trace()) << "First step found dry";
return {tecPATH_DRY, std::move(ofrsToRm)};
return Result{std::move(ofrsToRm)};
}
if (get<TInAmt> (r.first) != *maxIn)
{
Expand All @@ -159,7 +159,7 @@ flow (
<< to_string(get<TInAmt>(r.first))
<< " maxIn: " << to_string(*maxIn);
assert(0);
return {telFAILED_PROCESSING, std::move (ofrsToRm)};
return Result{std::move (ofrsToRm)};
}
}
else if (!strand[i]->equalOut (r.second, stepOut))
Expand All @@ -180,7 +180,7 @@ flow (
// A tiny input amount can cause this step to output zero.
// I.e. 10^-80 IOU into an IOU -> XRP offer.
JLOG(j.trace()) << "Limiting step found dry";
return {tecPATH_DRY, std::move(ofrsToRm)};
return Result{std::move(ofrsToRm)};
}
if (!strand[i]->equalOut (r.second, stepOut))
{
Expand All @@ -195,7 +195,7 @@ flow (
JLOG (j.fatal()) << "Re-executed limiting step failed";
#endif
assert (0);
return {telFAILED_PROCESSING, std::move (ofrsToRm)};
return Result{std::move (ofrsToRm)};
}
}

Expand All @@ -214,7 +214,7 @@ flow (
// A tiny input amount can cause this step to output zero.
// I.e. 10^-80 IOU into an IOU -> XRP offer.
JLOG(j.trace()) << "Non-limiting step found dry";
return {tecPATH_DRY, std::move(ofrsToRm)};
return Result{std::move(ofrsToRm)};
}
if (!strand[i]->equalIn (r.first, stepIn))
{
Expand All @@ -228,7 +228,7 @@ flow (
JLOG (j.fatal()) << "Re-executed forward pass failed";
#endif
assert (0);
return {telFAILED_PROCESSING, std::move (ofrsToRm)};
return Result{std::move (ofrsToRm)};
}
stepIn = r.second;
}
Expand Down Expand Up @@ -271,9 +271,9 @@ flow (
std::move(ofrsToRm),
inactive);
}
catch (FlowException const& e)
catch (FlowException const&)
{
return {e.ter, std::move (ofrsToRm)};
return Result{std::move (ofrsToRm)};
}
}

Expand Down Expand Up @@ -540,7 +540,7 @@ flow (PaymentSandbox const& baseView,
// rm bad offers even if the strand fails
SetUnion(ofrsToRm, f.ofrsToRm);

if (f.ter != tesSUCCESS || f.out == beast::zero)
if (!f.success || f.out == beast::zero)
continue;

if (flowDebugInfo)
Expand Down

0 comments on commit 2e96bb3

Please sign in to comment.