Fix false dry and other payment bugs:

The Owner count could decrease while evaluating a strand, causing
different behavior in forward passes and reverses passes. The fix treats
a decreased owner count like a deferred credit.

In some situations, deferred credits could cause an XRP balance to be
calculated as negative, triggering some asserts.

When XRP is used as a bridge currency, a path could be falsely marked as
dry. This happens when the XRP/XXX offer recursively checks the XXX/XRP
offer and the XXX/XRP offer could not satisfy the request in a single
call.

With a single strand and limit quality the old payment code incorrectly
computed with multiquailty set to true. This could cause the total
quality to go below the requested quality even if there was liquidity
available above the requested quality value.
This commit is contained in:
seelabs
2016-05-14 11:43:39 -04:00
parent 67b1acbf78
commit 21c563f83a
17 changed files with 577 additions and 91 deletions

View File

@@ -197,7 +197,8 @@ maxFlow (
AccountID const& dst,
Currency const& cur)
{
auto const srcOwed = creditBalance2 (sb, dst, src, cur);
auto const srcOwed = toAmount<IOUAmount> (
accountHolds (sb, src, cur, dst, fhIGNORE_FREEZE, beast::Journal{}));
if (srcOwed.signum () > 0)
return {srcOwed, true};
@@ -211,7 +212,8 @@ DirectStepI::redeems (ReadView const& sb, bool fwd) const
{
if (!fwd)
{
auto const srcOwed = creditBalance2 (sb, dst_, src_, currency_);
auto const srcOwed = accountHolds (
sb, src_, currency_, dst_, fhIGNORE_FREEZE, beast::Journal{});
return srcOwed.signum () > 0;
}
else