Add the config preset features to the view:

It is often difficult to get access to the preset features in the config. Adding
the preset features solves this problem.
This commit is contained in:
seelabs
2017-02-03 17:53:30 -05:00
committed by Edward Hennis
parent e01f6e7455
commit f5af8b03de
30 changed files with 108 additions and 138 deletions

View File

@@ -1426,9 +1426,9 @@ void NetworkOPsImp::switchLastClosedLedger (
app_.getLedgerMaster().getValidatedLedger();
boost::optional<Rules> rules;
if (lastVal)
rules.emplace(*lastVal);
rules.emplace(*lastVal, app_.config().features);
else
rules.emplace();
rules.emplace(app_.config().features);
app_.openLedger().accept(app_, *rules,
newLCL, OrderedTxs({}), false, retries,
tapNONE, "jump",
@@ -2115,7 +2115,7 @@ Json::Value NetworkOPsImp::getServerInfo (bool human, bool admin)
info[jss::load] = m_job_queue.getJson ();
auto const escalationMetrics = app_.getTxQ().getMetrics(
app_.config(), *app_.openLedger().current());
*app_.openLedger().current());
constexpr std::uint64_t max32 =
std::numeric_limits<std::uint32_t>::max();

View File

@@ -23,7 +23,6 @@
#include <ripple/app/tx/applySteps.h>
#include <ripple/ledger/OpenView.h>
#include <ripple/ledger/ApplyView.h>
#include <ripple/core/Config.h>
#include <ripple/protocol/TER.h>
#include <ripple/protocol/STTx.h>
#include <boost/intrusive/set.hpp>
@@ -31,6 +30,7 @@
namespace ripple {
class Application;
class Config;
/**
Transaction Queue. Used to manage transactions in conjunction with
@@ -139,7 +139,7 @@ public:
amendment is not enabled.
*/
boost::optional<Metrics>
getMetrics(Config const& config, OpenView const& view,
getMetrics(OpenView const& view,
std::uint32_t txCountPadding = 0) const;
/** Returns information about the transactions currently
@@ -150,8 +150,7 @@ public:
in the queue.
*/
boost::optional<std::map<TxSeq, AccountTxDetails>>
getAccountTxs(AccountID const& account, Config const& config,
ReadView const& view) const;
getAccountTxs(AccountID const& account, ReadView const& view) const;
/** Packages up fee metrics for the `fee` RPC command.
*/

View File

@@ -589,8 +589,7 @@ TxQ::apply(Application& app, OpenView& view,
ApplyFlags flags, beast::Journal j)
{
auto const allowEscalation =
(view.rules().enabled(featureFeeEscalation,
app.config().features));
(view.rules().enabled(featureFeeEscalation));
if (!allowEscalation)
{
return ripple::apply(app, view, *tx, flags, j);
@@ -1110,8 +1109,7 @@ TxQ::processClosedLedger(Application& app,
OpenView const& view, bool timeLeap)
{
auto const allowEscalation =
(view.rules().enabled(featureFeeEscalation,
app.config().features));
(view.rules().enabled(featureFeeEscalation));
if (!allowEscalation)
{
return;
@@ -1190,8 +1188,7 @@ TxQ::accept(Application& app,
OpenView& view)
{
auto const allowEscalation =
(view.rules().enabled(featureFeeEscalation,
app.config().features));
(view.rules().enabled(featureFeeEscalation));
if (!allowEscalation)
{
return false;
@@ -1307,13 +1304,11 @@ TxQ::accept(Application& app,
}
auto
TxQ::getMetrics(Config const& config, OpenView const& view,
std::uint32_t txCountPadding) const
-> boost::optional<Metrics>
TxQ::getMetrics(OpenView const& view, std::uint32_t txCountPadding) const
-> boost::optional<Metrics>
{
auto const allowEscalation =
(view.rules().enabled(featureFeeEscalation,
config.features));
(view.rules().enabled(featureFeeEscalation));
if (!allowEscalation)
return boost::none;
@@ -1335,13 +1330,11 @@ TxQ::getMetrics(Config const& config, OpenView const& view,
}
auto
TxQ::getAccountTxs(AccountID const& account, Config const& config,
ReadView const& view) const
-> boost::optional<std::map<TxSeq, AccountTxDetails>>
TxQ::getAccountTxs(AccountID const& account, ReadView const& view) const
-> boost::optional<std::map<TxSeq, AccountTxDetails>>
{
auto const allowEscalation =
(view.rules().enabled(featureFeeEscalation,
config.features));
(view.rules().enabled(featureFeeEscalation));
if (!allowEscalation)
return boost::none;
@@ -1372,7 +1365,7 @@ TxQ::doRPC(Application& app) const
using std::to_string;
auto const view = app.openLedger().current();
auto const metrics = getMetrics(app.config(), *view);
auto const metrics = getMetrics(*view);
if (!metrics)
return{};