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) if (account != amount.issue ().account)
{ {
auto const ownerFunds = accountFunds(*mLedger, auto const ownerFunds = accountFunds(*mLedger,
account, amount, fhIGNORE_FREEZE, getConfig()); account, amount, fhIGNORE_FREEZE);
mJson[jss::transaction][jss::owner_funds] = ownerFunds.getText (); mJson[jss::transaction][jss::owner_funds] = ownerFunds.getText ();
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -56,7 +56,6 @@ private:
Clock::time_point const expire_; Clock::time_point const expire_;
BookTip tip_; BookTip tip_;
Offer offer_; Offer offer_;
Config const& config_;
void void
erase (ApplyView& view); erase (ApplyView& view);
@@ -64,7 +63,6 @@ private:
public: public:
OfferStream (ApplyView& view, ApplyView& cancelView, OfferStream (ApplyView& view, ApplyView& cancelView,
BookRef book, Clock::time_point when, BookRef book, Clock::time_point when,
Config const& config,
beast::Journal journal); beast::Journal journal);
/** Returns the offer at the tip of the order book. /** 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, Taker::Taker (CrossType cross_type, ApplyView& view,
AccountID const& account, Amounts const& offer, AccountID const& account, Amounts const& offer,
std::uint32_t flags, Config const& config, std::uint32_t flags,
beast::Journal journal) beast::Journal journal)
: BasicTaker (cross_type, account, offer, Quality(offer), flags, : BasicTaker (cross_type, account, offer, Quality(offer), flags,
calculateRate(view, offer.in.getIssuer(), account), calculateRate(view, offer.in.getIssuer(), account),
calculateRate(view, offer.out.getIssuer(), account), journal) calculateRate(view, offer.out.getIssuer(), account), journal)
, view_ (view) , view_ (view)
, config_ (config)
, xrp_flow_ (0) , xrp_flow_ (0)
, direct_crossings_ (0) , direct_crossings_ (0)
, bridge_crossings_ (0) , bridge_crossings_ (0)
@@ -574,12 +573,10 @@ Taker::consume_offer (Offer const& offer, Amounts const& order)
offer.consume (view_, order); offer.consume (view_, order);
} }
// VFALCO This function should take a config parameter
STAmount STAmount
Taker::get_funds (AccountID const& account, STAmount const& amount) const Taker::get_funds (AccountID const& account, STAmount const& amount) const
{ {
return accountFunds(view_, account, amount, fhZERO_IF_FROZEN, return accountFunds(view_, account, amount, fhZERO_IF_FROZEN);
config_);
} }
TER Taker::transferXRP ( TER Taker::transferXRP (

View File

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

View File

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

View File

@@ -100,8 +100,7 @@ isFrozen (ReadView const& view, AccountID const& account,
STAmount STAmount
accountHolds (ReadView const& view, accountHolds (ReadView const& view,
AccountID const& account, Currency const& currency, AccountID const& account, Currency const& currency,
AccountID const& issuer, FreezeHandling zeroIfFrozen, AccountID const& issuer, FreezeHandling zeroIfFrozen)
Config const& config)
{ {
STAmount amount; STAmount amount;
if (isXRP(currency)) if (isXRP(currency))
@@ -159,8 +158,7 @@ accountHolds (ReadView const& view,
STAmount STAmount
accountFunds (ReadView const& view, AccountID const& id, accountFunds (ReadView const& view, AccountID const& id,
STAmount const& saDefault, FreezeHandling freezeHandling, STAmount const& saDefault, FreezeHandling freezeHandling)
Config const& config)
{ {
STAmount saFunds; STAmount saFunds;
@@ -177,7 +175,7 @@ accountFunds (ReadView const& view, AccountID const& id,
{ {
saFunds = accountHolds(view, id, saFunds = accountHolds(view, id,
saDefault.getCurrency(), saDefault.getIssuer(), saDefault.getCurrency(), saDefault.getIssuer(),
freezeHandling, config); freezeHandling);
WriteLog (lsTRACE, View) << "accountFunds:" << WriteLog (lsTRACE, View) << "accountFunds:" <<
" account=" << to_string (id) << " account=" << to_string (id) <<
" saDefault=" << saDefault.getFullText () << " 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 iss = USD_gw1.issue ();
auto const startingAmount = accountHolds ( 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); accountSend (av, gw1, alice, toCredit);
expect (accountHolds (av, alice, iss.currency, iss.account, expect (accountHolds (av, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) == fhIGNORE_FREEZE) ==
startingAmount + toCredit); startingAmount + toCredit);
accountSend (av, alice, gw1, toDebit); accountSend (av, alice, gw1, toDebit);
expect (accountHolds (av, alice, iss.currency, iss.account, expect (accountHolds (av, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) == fhIGNORE_FREEZE) ==
startingAmount + toCredit - toDebit); startingAmount + toCredit - toDebit);
} }
@@ -140,16 +140,16 @@ class PaymentSandbox_test : public beast::unit_test::suite
auto const iss = USD_gw1.issue (); auto const iss = USD_gw1.issue ();
auto const startingAmount = accountHolds ( 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); rippleCredit (av, gw1, alice, toCredit, true);
expect (accountHolds (av, alice, iss.currency, iss.account, expect (accountHolds (av, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) == fhIGNORE_FREEZE) ==
startingAmount + toCredit); startingAmount + toCredit);
rippleCredit (av, alice, gw1, toDebit, true); rippleCredit (av, alice, gw1, toDebit, true);
expect (accountHolds (av, alice, iss.currency, iss.account, expect (accountHolds (av, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) == fhIGNORE_FREEZE) ==
startingAmount + toCredit - toDebit); startingAmount + toCredit - toDebit);
} }
@@ -160,16 +160,16 @@ class PaymentSandbox_test : public beast::unit_test::suite
auto const iss = USD_gw1.issue (); auto const iss = USD_gw1.issue ();
auto const startingAmount = accountHolds ( 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); accountSend (pv, gw1, alice, toCredit);
expect (accountHolds (pv, alice, iss.currency, iss.account, expect (accountHolds (pv, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) == fhIGNORE_FREEZE) ==
startingAmount); startingAmount);
accountSend (pv, alice, gw1, toDebit); accountSend (pv, alice, gw1, toDebit);
expect (accountHolds (pv, alice, iss.currency, iss.account, expect (accountHolds (pv, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) == fhIGNORE_FREEZE) ==
startingAmount - toDebit); startingAmount - toDebit);
} }
@@ -180,11 +180,11 @@ class PaymentSandbox_test : public beast::unit_test::suite
auto const iss = USD_gw1.issue (); auto const iss = USD_gw1.issue ();
auto const startingAmount = accountHolds ( 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); rippleCredit (pv, gw1, alice, toCredit, true);
expect (accountHolds (pv, alice, iss.currency, iss.account, expect (accountHolds (pv, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) == fhIGNORE_FREEZE) ==
startingAmount); startingAmount);
} }
@@ -195,11 +195,11 @@ class PaymentSandbox_test : public beast::unit_test::suite
auto const iss = USD_gw1.issue (); auto const iss = USD_gw1.issue ();
auto const startingAmount = accountHolds ( 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); redeemIOU (pv, alice, toDebit, iss);
expect (accountHolds (pv, alice, iss.currency, iss.account, expect (accountHolds (pv, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) == fhIGNORE_FREEZE) ==
startingAmount - toDebit); startingAmount - toDebit);
} }
@@ -210,11 +210,11 @@ class PaymentSandbox_test : public beast::unit_test::suite
auto const iss = USD_gw1.issue (); auto const iss = USD_gw1.issue ();
auto const startingAmount = accountHolds ( 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); issueIOU (pv, alice, toCredit, iss);
expect (accountHolds (pv, alice, iss.currency, iss.account, expect (accountHolds (pv, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) == fhIGNORE_FREEZE) ==
startingAmount); startingAmount);
} }
@@ -225,27 +225,27 @@ class PaymentSandbox_test : public beast::unit_test::suite
auto const iss = USD_gw1.issue (); auto const iss = USD_gw1.issue ();
auto const startingAmount = accountHolds ( 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); accountSend (pv, gw1, alice, toCredit);
expect (accountHolds (pv, alice, iss.currency, iss.account, expect (accountHolds (pv, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) == fhIGNORE_FREEZE) ==
startingAmount); startingAmount);
{ {
PaymentSandbox pv2(&pv); PaymentSandbox pv2(&pv);
expect (accountHolds (pv2, alice, iss.currency, iss.account, expect (accountHolds (pv2, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) == fhIGNORE_FREEZE) ==
startingAmount); startingAmount);
accountSend (pv2, gw1, alice, toCredit); accountSend (pv2, gw1, alice, toCredit);
expect (accountHolds (pv2, alice, iss.currency, iss.account, expect (accountHolds (pv2, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) == fhIGNORE_FREEZE) ==
startingAmount); startingAmount);
} }
accountSend (pv, alice, gw1, toDebit); accountSend (pv, alice, gw1, toDebit);
expect (accountHolds (pv, alice, iss.currency, iss.account, expect (accountHolds (pv, alice, iss.currency, iss.account,
fhIGNORE_FREEZE, getConfig ()) == fhIGNORE_FREEZE) ==
startingAmount - toDebit); startingAmount - toDebit);
} }
} }