Remove unused config param

This commit is contained in:
seelabs
2015-09-02 11:54:24 -04:00
committed by Scott Schurr
parent d8aab5a749
commit d015debe2b
12 changed files with 48 additions and 69 deletions

View File

@@ -94,7 +94,7 @@ void AcceptedLedgerTx::buildJson ()
if (account != amount.issue ().account)
{
auto const ownerFunds = accountFunds(*mLedger,
account, amount, fhIGNORE_FREEZE, getConfig());
account, amount, fhIGNORE_FREEZE);
mJson[jss::transaction][jss::owner_funds] = ownerFunds.getText ();
}
}

View File

@@ -2211,7 +2211,7 @@ Json::Value NetworkOPsImp::transJson(
if (account != amount.issue ().account)
{
auto const ownerFunds = accountFunds(*lpCurrent,
account, amount, fhIGNORE_FREEZE, getConfig());
account, amount, fhIGNORE_FREEZE);
jvObj[jss::transaction][jss::owner_funds] = ownerFunds.getText ();
}
}
@@ -2725,8 +2725,7 @@ void NetworkOPsImp::getBookPage (
saOwnerFunds = accountHolds (view,
uOfferOwnerID, book.out.currency,
book.out.account, fhZERO_IF_FROZEN,
getConfig());
book.out.account, fhZERO_IF_FROZEN);
if (saOwnerFunds < zero)
{

View File

@@ -131,8 +131,7 @@ TER PathCursor::advanceNode (bool const bReverse) const
node().saOfferFunds = accountFunds(view(),
node().offerOwnerAccount_,
node().saTakerGets,
fhZERO_IF_FROZEN,
getConfig());
fhZERO_IF_FROZEN);
node().bFundsDirty = false;
WriteLog (lsTRACE, RippleCalc)
@@ -331,8 +330,7 @@ TER PathCursor::advanceNode (bool const bReverse) const
node().saOfferFunds = accountFunds(view(),
node().offerOwnerAccount_,
node().saTakerGets,
fhZERO_IF_FROZEN,
getConfig());
fhZERO_IF_FROZEN);
// Funds held.
if (node().saOfferFunds <= zero)

View File

@@ -357,8 +357,7 @@ TER PathCursor::forwardLiquidityForAccount () const
node().account_,
xrpCurrency(),
xrpAccount(),
fhIGNORE_FREEZE,
getConfig())); // XRP can't be frozen
fhIGNORE_FREEZE)); // XRP can't be frozen
}

View File

@@ -190,7 +190,7 @@ CreateOffer::dry_offer (ApplyView& view, Offer const& offer)
if (offer.fully_consumed ())
return true;
auto const amount = accountFunds(view, offer.owner(),
offer.amount().out, fhZERO_IF_FROZEN, ctx_.config);
offer.amount().out, fhZERO_IF_FROZEN);
return (amount <= zero);
}
@@ -239,13 +239,13 @@ CreateOffer::bridged_cross (
throw std::logic_error ("Bridging with XRP and an endpoint.");
OfferStream offers_direct (view, view_cancel,
Book (taker.issue_in (), taker.issue_out ()), when, ctx_.config, j_);
Book (taker.issue_in (), taker.issue_out ()), when, j_);
OfferStream offers_leg1 (view, view_cancel,
Book (taker.issue_in (), xrpIssue ()), when, ctx_.config, j_);
Book (taker.issue_in (), xrpIssue ()), when, j_);
OfferStream offers_leg2 (view, view_cancel,
Book (xrpIssue (), taker.issue_out ()), when, ctx_.config, j_);
Book (xrpIssue (), taker.issue_out ()), when, j_);
TER cross_result = tesSUCCESS;
@@ -290,8 +290,7 @@ CreateOffer::bridged_cross (
j_.debug << " funds: " << accountFunds(view,
offers_direct.tip ().owner (),
offers_direct.tip ().amount ().out,
fhIGNORE_FREEZE,
ctx_.config);
fhIGNORE_FREEZE);
}
cross_result = taker.cross(offers_direct.tip ());
@@ -311,14 +310,12 @@ CreateOffer::bridged_cross (
auto const owner1_funds_before = accountFunds(view,
offers_leg1.tip ().owner (),
offers_leg1.tip ().amount ().out,
fhIGNORE_FREEZE,
ctx_.config);
fhIGNORE_FREEZE);
auto const owner2_funds_before = accountFunds(view,
offers_leg2.tip ().owner (),
offers_leg2.tip ().amount ().out,
fhIGNORE_FREEZE,
ctx_.config);
fhIGNORE_FREEZE);
j_.debug << count << " Bridge:";
j_.debug << " offer1: " << offers_leg1.tip ();
@@ -382,7 +379,7 @@ CreateOffer::direct_cross (
OfferStream offers (
view, view_cancel,
Book (taker.issue_in (), taker.issue_out ()),
when, ctx_.config, j_);
when, j_);
TER cross_result (tesSUCCESS);
int count = 0;
@@ -410,7 +407,7 @@ CreateOffer::direct_cross (
j_.debug << " out: " << offer.amount ().out;
j_.debug << " owner: " << offer.owner ();
j_.debug << " funds: " << accountFunds(view,
offer.owner (), offer.amount ().out, fhIGNORE_FREEZE, ctx_.config);
offer.owner (), offer.amount ().out, fhIGNORE_FREEZE);
}
cross_result = taker.cross (offer);
@@ -485,7 +482,7 @@ CreateOffer::cross (
beast::WrappedSink takerSink (j_, "Taker ");
Taker taker (cross_type_, view, account_, taker_amount,
tx().getFlags(), ctx_.config, beast::Journal (takerSink));
tx().getFlags(), beast::Journal (takerSink));
try
{
@@ -601,7 +598,7 @@ CreateOffer::applyGuts (ApplyView& view, ApplyView& view_cancel)
result = tecFROZEN;
}
else if (accountFunds(view, account_, saTakerGets,
fhZERO_IF_FROZEN, ctx_.config) <= zero)
fhZERO_IF_FROZEN) <= zero)
{
if (j_.debug) j_.debug <<
"delay: Offers must be at least partially funded.";

View File

@@ -25,14 +25,13 @@ namespace ripple {
OfferStream::OfferStream (ApplyView& view, ApplyView& cancelView,
BookRef book, Clock::time_point when,
Config const& config, beast::Journal journal)
beast::Journal journal)
: j_ (journal)
, view_ (view)
, cancelView_ (cancelView)
, book_ (book)
, expire_ (when)
, tip_ (view, book_)
, config_ (config)
{
}
@@ -126,8 +125,7 @@ OfferStream::step ()
// Calculate owner funds
auto const owner_funds = accountFunds(view_,
offer_.owner(), amount.out, fhZERO_IF_FROZEN,
config_);
offer_.owner(), amount.out, fhZERO_IF_FROZEN);
// Check for unfunded offer
if (owner_funds <= zero)
@@ -136,8 +134,7 @@ OfferStream::step ()
// we haven't modified the balance and therefore the
// offer is "found unfunded" versus "became unfunded"
auto const original_funds = accountFunds(cancelView_,
offer_.owner(), amount.out, fhZERO_IF_FROZEN,
config_);
offer_.owner(), amount.out, fhZERO_IF_FROZEN);
if (original_funds == owner_funds)
{

View File

@@ -56,7 +56,6 @@ private:
Clock::time_point const expire_;
BookTip tip_;
Offer offer_;
Config const& config_;
void
erase (ApplyView& view);
@@ -64,7 +63,6 @@ private:
public:
OfferStream (ApplyView& view, ApplyView& cancelView,
BookRef book, Clock::time_point when,
Config const& config,
beast::Journal journal);
/** Returns the offer at the tip of the order book.

View File

@@ -517,13 +517,12 @@ BasicTaker::do_cross (
Taker::Taker (CrossType cross_type, ApplyView& view,
AccountID const& account, Amounts const& offer,
std::uint32_t flags, Config const& config,
std::uint32_t flags,
beast::Journal journal)
: BasicTaker (cross_type, account, offer, Quality(offer), flags,
calculateRate(view, offer.in.getIssuer(), account),
calculateRate(view, offer.out.getIssuer(), account), journal)
, view_ (view)
, config_ (config)
, xrp_flow_ (0)
, direct_crossings_ (0)
, bridge_crossings_ (0)
@@ -574,12 +573,10 @@ Taker::consume_offer (Offer const& offer, Amounts const& order)
offer.consume (view_, order);
}
// VFALCO This function should take a config parameter
STAmount
Taker::get_funds (AccountID const& account, STAmount const& amount) const
{
return accountFunds(view_, account, amount, fhZERO_IF_FROZEN,
config_);
return accountFunds(view_, account, amount, fhZERO_IF_FROZEN);
}
TER Taker::transferXRP (

View File

@@ -246,7 +246,7 @@ public:
Taker (CrossType cross_type, ApplyView& view,
AccountID const& account, Amounts const& offer,
std::uint32_t flags, Config const& config,
std::uint32_t flags,
beast::Journal journal);
~Taker () = default;
@@ -314,8 +314,6 @@ private:
// The underlying ledger entry we are dealing with
ApplyView& view_;
Config const& config_;
// The amount of XRP that flowed if we were autobridging
STAmount xrp_flow_;

View File

@@ -65,13 +65,11 @@ isGlobalFrozen (ReadView const& view,
STAmount
accountHolds (ReadView const& view,
AccountID const& account, Currency const& currency,
AccountID const& issuer, FreezeHandling zeroIfFrozen,
Config const& config);
AccountID const& issuer, FreezeHandling zeroIfFrozen);
STAmount
accountFunds (ReadView const& view, AccountID const& id,
STAmount const& saDefault, FreezeHandling freezeHandling,
Config const& config);
STAmount const& saDefault, FreezeHandling freezeHandling);
/** Iterate all items in an account's owner directory. */
void

View File

@@ -100,8 +100,7 @@ isFrozen (ReadView const& view, AccountID const& account,
STAmount
accountHolds (ReadView const& view,
AccountID const& account, Currency const& currency,
AccountID const& issuer, FreezeHandling zeroIfFrozen,
Config const& config)
AccountID const& issuer, FreezeHandling zeroIfFrozen)
{
STAmount amount;
if (isXRP(currency))
@@ -159,8 +158,7 @@ accountHolds (ReadView const& view,
STAmount
accountFunds (ReadView const& view, AccountID const& id,
STAmount const& saDefault, FreezeHandling freezeHandling,
Config const& config)
STAmount const& saDefault, FreezeHandling freezeHandling)
{
STAmount saFunds;
@@ -177,7 +175,7 @@ accountFunds (ReadView const& view, AccountID const& id,
{
saFunds = accountHolds(view, id,
saDefault.getCurrency(), saDefault.getIssuer(),
freezeHandling, config);
freezeHandling);
WriteLog (lsTRACE, View) << "accountFunds:" <<
" account=" << to_string (id) <<
" saDefault=" << saDefault.getFullText () <<

View File

@@ -121,16 +121,16 @@ class PaymentSandbox_test : public beast::unit_test::suite
auto const iss = USD_gw1.issue ();
auto const startingAmount = accountHolds (
av, alice, iss.currency, iss.account, fhIGNORE_FREEZE, getConfig ());
av, alice, iss.currency, iss.account, fhIGNORE_FREEZE);
accountSend (av, gw1, alice, toCredit);
expect (accountHolds (av, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) ==
fhIGNORE_FREEZE) ==
startingAmount + toCredit);
accountSend (av, alice, gw1, toDebit);
expect (accountHolds (av, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) ==
fhIGNORE_FREEZE) ==
startingAmount + toCredit - toDebit);
}
@@ -140,16 +140,16 @@ class PaymentSandbox_test : public beast::unit_test::suite
auto const iss = USD_gw1.issue ();
auto const startingAmount = accountHolds (
av, alice, iss.currency, iss.account, fhIGNORE_FREEZE, getConfig ());
av, alice, iss.currency, iss.account, fhIGNORE_FREEZE);
rippleCredit (av, gw1, alice, toCredit, true);
expect (accountHolds (av, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) ==
fhIGNORE_FREEZE) ==
startingAmount + toCredit);
rippleCredit (av, alice, gw1, toDebit, true);
expect (accountHolds (av, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) ==
fhIGNORE_FREEZE) ==
startingAmount + toCredit - toDebit);
}
@@ -160,16 +160,16 @@ class PaymentSandbox_test : public beast::unit_test::suite
auto const iss = USD_gw1.issue ();
auto const startingAmount = accountHolds (
pv, alice, iss.currency, iss.account, fhIGNORE_FREEZE, getConfig ());
pv, alice, iss.currency, iss.account, fhIGNORE_FREEZE);
accountSend (pv, gw1, alice, toCredit);
expect (accountHolds (pv, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) ==
fhIGNORE_FREEZE) ==
startingAmount);
accountSend (pv, alice, gw1, toDebit);
expect (accountHolds (pv, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) ==
fhIGNORE_FREEZE) ==
startingAmount - toDebit);
}
@@ -180,11 +180,11 @@ class PaymentSandbox_test : public beast::unit_test::suite
auto const iss = USD_gw1.issue ();
auto const startingAmount = accountHolds (
pv, alice, iss.currency, iss.account, fhIGNORE_FREEZE, getConfig ());
pv, alice, iss.currency, iss.account, fhIGNORE_FREEZE);
rippleCredit (pv, gw1, alice, toCredit, true);
expect (accountHolds (pv, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) ==
fhIGNORE_FREEZE) ==
startingAmount);
}
@@ -195,11 +195,11 @@ class PaymentSandbox_test : public beast::unit_test::suite
auto const iss = USD_gw1.issue ();
auto const startingAmount = accountHolds (
pv, alice, iss.currency, iss.account, fhIGNORE_FREEZE, getConfig ());
pv, alice, iss.currency, iss.account, fhIGNORE_FREEZE);
redeemIOU (pv, alice, toDebit, iss);
expect (accountHolds (pv, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) ==
fhIGNORE_FREEZE) ==
startingAmount - toDebit);
}
@@ -210,11 +210,11 @@ class PaymentSandbox_test : public beast::unit_test::suite
auto const iss = USD_gw1.issue ();
auto const startingAmount = accountHolds (
pv, alice, iss.currency, iss.account, fhIGNORE_FREEZE, getConfig ());
pv, alice, iss.currency, iss.account, fhIGNORE_FREEZE);
issueIOU (pv, alice, toCredit, iss);
expect (accountHolds (pv, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) ==
fhIGNORE_FREEZE) ==
startingAmount);
}
@@ -225,27 +225,27 @@ class PaymentSandbox_test : public beast::unit_test::suite
auto const iss = USD_gw1.issue ();
auto const startingAmount = accountHolds (
pv, alice, iss.currency, iss.account, fhIGNORE_FREEZE, getConfig ());
pv, alice, iss.currency, iss.account, fhIGNORE_FREEZE);
accountSend (pv, gw1, alice, toCredit);
expect (accountHolds (pv, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) ==
fhIGNORE_FREEZE) ==
startingAmount);
{
PaymentSandbox pv2(&pv);
expect (accountHolds (pv2, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) ==
fhIGNORE_FREEZE) ==
startingAmount);
accountSend (pv2, gw1, alice, toCredit);
expect (accountHolds (pv2, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) ==
fhIGNORE_FREEZE) ==
startingAmount);
}
accountSend (pv, alice, gw1, toDebit);
expect (accountHolds (pv, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) ==
fhIGNORE_FREEZE) ==
startingAmount - toDebit);
}
}