mirror of
https://github.com/XRPLF/rippled.git
synced 2026-03-22 04:32:25 +00:00
Compare commits
9 Commits
dangell7/b
...
mvadari/pa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e78ab82996 | ||
|
|
253918c168 | ||
|
|
a43de47f13 | ||
|
|
c78a68f218 | ||
|
|
1dcbc503d8 | ||
|
|
346fbbd3ac | ||
|
|
a2a66f68ad | ||
|
|
04c141cba5 | ||
|
|
4cdc8561cd |
@@ -58,8 +58,8 @@ private:
|
||||
{
|
||||
explicit Value() = default;
|
||||
|
||||
STAmount lowAcctCredits;
|
||||
STAmount highAcctCredits;
|
||||
STAmount lowAcctDebits;
|
||||
STAmount highAcctDebits;
|
||||
STAmount lowAcctOrigBalance;
|
||||
};
|
||||
|
||||
|
||||
@@ -501,14 +501,6 @@ public:
|
||||
{
|
||||
return cur_.size();
|
||||
}
|
||||
|
||||
void
|
||||
removeIndex(std::size_t i)
|
||||
{
|
||||
if (i >= next_.size())
|
||||
return;
|
||||
next_.erase(next_.begin() + i);
|
||||
}
|
||||
};
|
||||
/// @endcond
|
||||
|
||||
@@ -633,11 +625,6 @@ flow(
|
||||
std::optional<BestStrand> best;
|
||||
if (flowDebugInfo)
|
||||
flowDebugInfo->newLiquidityPass();
|
||||
// Index of strand to mark as inactive (remove from the active list) if
|
||||
// the liquidity is used. This is used for strands that consume too many
|
||||
// offers Constructed as `false,0` to workaround a gcc warning about
|
||||
// uninitialized variables
|
||||
std::optional<std::size_t> markInactiveOnUse;
|
||||
for (size_t strandIndex = 0, sie = activeStrands.size(); strandIndex != sie; ++strandIndex)
|
||||
{
|
||||
Strand const* strand = activeStrands.get(strandIndex);
|
||||
@@ -701,11 +688,6 @@ flow(
|
||||
|
||||
if (best)
|
||||
{
|
||||
if (markInactiveOnUse)
|
||||
{
|
||||
activeStrands.removeIndex(*markInactiveOnUse);
|
||||
markInactiveOnUse.reset();
|
||||
}
|
||||
savedIns.insert(best->in);
|
||||
savedOuts.insert(best->out);
|
||||
remainingOut = outReq - sum(savedOuts);
|
||||
|
||||
@@ -37,14 +37,14 @@ DeferredCredits::credit(
|
||||
|
||||
if (sender < receiver)
|
||||
{
|
||||
v.highAcctCredits = amount;
|
||||
v.lowAcctCredits = amount.zeroed();
|
||||
v.lowAcctDebits = amount;
|
||||
v.highAcctDebits = amount.zeroed();
|
||||
v.lowAcctOrigBalance = preCreditSenderBalance;
|
||||
}
|
||||
else
|
||||
{
|
||||
v.highAcctCredits = amount.zeroed();
|
||||
v.lowAcctCredits = amount;
|
||||
v.lowAcctDebits = amount.zeroed();
|
||||
v.highAcctDebits = amount;
|
||||
v.lowAcctOrigBalance = -preCreditSenderBalance;
|
||||
}
|
||||
|
||||
@@ -56,11 +56,11 @@ DeferredCredits::credit(
|
||||
auto& v = i->second;
|
||||
if (sender < receiver)
|
||||
{
|
||||
v.highAcctCredits += amount;
|
||||
v.lowAcctDebits += amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
v.lowAcctCredits += amount;
|
||||
v.highAcctDebits += amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,11 +104,11 @@ DeferredCredits::adjustments(
|
||||
|
||||
if (main < other)
|
||||
{
|
||||
result.emplace(v.highAcctCredits, v.lowAcctCredits, v.lowAcctOrigBalance);
|
||||
result.emplace(v.lowAcctDebits, v.highAcctDebits, v.lowAcctOrigBalance);
|
||||
return result;
|
||||
}
|
||||
|
||||
result.emplace(v.lowAcctCredits, v.highAcctCredits, -v.lowAcctOrigBalance);
|
||||
result.emplace(v.highAcctDebits, v.lowAcctDebits, -v.lowAcctOrigBalance);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -122,8 +122,8 @@ DeferredCredits::apply(DeferredCredits& to)
|
||||
{
|
||||
auto& toVal = r.first->second;
|
||||
auto const& fromVal = i.second;
|
||||
toVal.lowAcctCredits += fromVal.lowAcctCredits;
|
||||
toVal.highAcctCredits += fromVal.highAcctCredits;
|
||||
toVal.lowAcctDebits += fromVal.lowAcctDebits;
|
||||
toVal.highAcctDebits += fromVal.highAcctDebits;
|
||||
// Do not update the orig balance, it's already correct
|
||||
}
|
||||
}
|
||||
@@ -349,14 +349,14 @@ PaymentSandbox::balanceChanges(ReadView const& view) const
|
||||
auto const cur = newBalance.getCurrency();
|
||||
result[std::make_tuple(lowID, highID, cur)] = delta;
|
||||
auto r = result.emplace(std::make_tuple(lowID, lowID, cur), delta);
|
||||
if (r.second)
|
||||
if (!r.second)
|
||||
{
|
||||
r.first->second += delta;
|
||||
}
|
||||
|
||||
delta.negate();
|
||||
r = result.emplace(std::make_tuple(highID, highID, cur), delta);
|
||||
if (r.second)
|
||||
if (!r.second)
|
||||
{
|
||||
r.first->second += delta;
|
||||
}
|
||||
|
||||
@@ -800,7 +800,11 @@ transferRate(ReadView const& view, MPTID const& issuanceID)
|
||||
// which represents 50% of 1,000,000,000
|
||||
if (auto const sle = view.read(keylet::mptIssuance(issuanceID));
|
||||
sle && sle->isFieldPresent(sfTransferFee))
|
||||
return Rate{1'000'000'000u + 10'000 * sle->getFieldU16(sfTransferFee)};
|
||||
{
|
||||
auto const fee = sle->getFieldU16(sfTransferFee);
|
||||
XRPL_ASSERT(fee <= maxTransferFee, "xrpl::transferRate : fee is too large");
|
||||
return Rate{1'000'000'000u + 10'000 * fee};
|
||||
}
|
||||
|
||||
return parityRate;
|
||||
}
|
||||
|
||||
@@ -562,7 +562,6 @@ OfferCreate::applyGuts(Sandbox& sb, Sandbox& sbCancel)
|
||||
return {tecEXPIRED, true};
|
||||
}
|
||||
|
||||
bool const bOpenLedger = sb.open();
|
||||
bool crossed = false;
|
||||
|
||||
if (isTesSuccess(result))
|
||||
@@ -648,7 +647,8 @@ OfferCreate::applyGuts(Sandbox& sb, Sandbox& sbCancel)
|
||||
stream << " out: " << format_amount(place_offer.out);
|
||||
}
|
||||
|
||||
if (result == tecFAILED_PROCESSING && bOpenLedger)
|
||||
bool const isLedgerOpen = sb.open();
|
||||
if (result == tecFAILED_PROCESSING && isLedgerOpen)
|
||||
result = telFAILED_PROCESSING;
|
||||
|
||||
if (!isTesSuccess(result))
|
||||
|
||||
@@ -383,6 +383,7 @@ Payment::doApply()
|
||||
sleDst = std::make_shared<SLE>(k);
|
||||
sleDst->setAccountID(sfAccount, dstAccountID);
|
||||
sleDst->setFieldU32(sfSequence, view().seq());
|
||||
sleDst->setFieldAmount(sfBalance, XRPAmount(beast::zero));
|
||||
|
||||
view().insert(sleDst);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user