mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
chore: Enable clang-tidy coreguidelines checks (#6698)
Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
This commit is contained in:
@@ -151,8 +151,7 @@ PropertyStream::Set::stream() const
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
PropertyStream::Source::Source(std::string const& name)
|
||||
: m_name(name), item_(this), parent_(nullptr)
|
||||
PropertyStream::Source::Source(std::string const& name) : m_name(name), item_(this)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,7 @@ JobQueue::JobQueue(
|
||||
Logs& logs,
|
||||
perf::PerfLog& perfLog)
|
||||
: m_journal(journal)
|
||||
, m_lastJob(0)
|
||||
, m_invalidJobData(JobTypes::instance().getInvalid(), collector, logs)
|
||||
, m_processCount(0)
|
||||
, m_workers(*this, &perfLog, "JobQueue", threadCount)
|
||||
, perfLog_(perfLog)
|
||||
, m_collector(collector)
|
||||
|
||||
@@ -15,16 +15,14 @@ TODO
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
LoadMonitor::Stats::Stats() : count(0), latencyAvg(0), latencyPeak(0), isOverloaded(false)
|
||||
LoadMonitor::Stats::Stats() : latencyAvg(0), latencyPeak(0)
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
LoadMonitor::LoadMonitor(beast::Journal j)
|
||||
: mCounts(0)
|
||||
, mLatencyEvents(0)
|
||||
, mLatencyMSAvg(0)
|
||||
: mLatencyMSAvg(0)
|
||||
, mLatencyMSPeak(0)
|
||||
, mTargetLatencyAvg(0)
|
||||
, mTargetLatencyPk(0)
|
||||
|
||||
@@ -12,9 +12,7 @@ Workers::Workers(
|
||||
: m_callback(callback)
|
||||
, perfLog_(perfLog)
|
||||
, m_threadNames(threadNames)
|
||||
, m_allPaused(true)
|
||||
, m_semaphore(0)
|
||||
, m_numberOfThreads(0)
|
||||
, m_activeCount(0)
|
||||
, m_pauseCount(0)
|
||||
, m_runningTaskCount(0)
|
||||
@@ -138,11 +136,8 @@ Workers::deleteWorkers(beast::LockFreeStack<Worker>& stack)
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
Workers::Worker::Worker(Workers& workers, std::string const& threadName, int const instance)
|
||||
: m_workers{workers}
|
||||
, threadName_{threadName}
|
||||
, instance_{instance}
|
||||
, wakeCount_{0}
|
||||
, shouldExit_{false}
|
||||
: m_workers{workers}, threadName_{threadName}, instance_{instance}
|
||||
|
||||
{
|
||||
thread_ = std::thread{&Workers::Worker::run, this};
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ FastWriter::writeValue(Value const& value)
|
||||
// Class StyledWriter
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
|
||||
StyledWriter::StyledWriter() : rightMargin_(74), indentSize_(3)
|
||||
StyledWriter::StyledWriter()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -486,8 +486,7 @@ StyledWriter::unindent()
|
||||
// Class StyledStreamWriter
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
|
||||
StyledStreamWriter::StyledStreamWriter(std::string indentation)
|
||||
: document_(nullptr), rightMargin_(74), indentation_(indentation)
|
||||
StyledStreamWriter::StyledStreamWriter(std::string indentation) : indentation_(indentation)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace xrpl {
|
||||
namespace NodeStore {
|
||||
|
||||
BatchWriter::BatchWriter(Callback& callback, Scheduler& scheduler)
|
||||
: m_callback(callback), m_scheduler(scheduler), mWriteLoad(0), mWritePending(false)
|
||||
: m_callback(callback), m_scheduler(scheduler)
|
||||
{
|
||||
mWriteSet.reserve(batchWritePreallocationSize);
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ STAmount::STAmount(SerialIter& sit, SField const& name) : STBase(name)
|
||||
}
|
||||
|
||||
STAmount::STAmount(SField const& name, std::int64_t mantissa)
|
||||
: STBase(name), mAsset(xrpIssue()), mValue(0), mOffset(0), mIsNegative(false)
|
||||
: STBase(name), mAsset(xrpIssue()), mOffset(0)
|
||||
{
|
||||
set(mantissa);
|
||||
}
|
||||
|
||||
@@ -10,11 +10,8 @@ AMMOffer<TIn, TOut>::AMMOffer(
|
||||
TAmounts<TIn, TOut> const& amounts,
|
||||
TAmounts<TIn, TOut> const& balances,
|
||||
Quality const& quality)
|
||||
: ammLiquidity_(ammLiquidity)
|
||||
, amounts_(amounts)
|
||||
, balances_(balances)
|
||||
, quality_(quality)
|
||||
, consumed_(false)
|
||||
: ammLiquidity_(ammLiquidity), amounts_(amounts), balances_(balances), quality_(quality)
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
namespace xrpl {
|
||||
|
||||
BookTip::BookTip(ApplyView& view, Book const& book)
|
||||
: view_(view), m_valid(false), m_book(getBookBase(book)), m_end(getQualityNext(m_book))
|
||||
: view_(view), m_book(getBookBase(book)), m_end(getQualityNext(m_book))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -231,7 +231,7 @@ struct Peer
|
||||
// Number of proposers in the prior round
|
||||
std::size_t prevProposers = 0;
|
||||
// Duration of prior round
|
||||
std::chrono::milliseconds prevRoundTime;
|
||||
std::chrono::milliseconds prevRoundTime{};
|
||||
|
||||
// Quorum of validations needed for a ledger to be fully validated
|
||||
// TODO: Use the logic in ValidatorList to set this dynamically
|
||||
@@ -501,16 +501,10 @@ struct Peer
|
||||
NetClock::duration const& closeResolution,
|
||||
ConsensusCloseTimes const& rawCloseTimes,
|
||||
ConsensusMode const& mode,
|
||||
Json::Value&& consensusJson)
|
||||
Json::Value const& consensusJson)
|
||||
{
|
||||
onAccept(
|
||||
result,
|
||||
prevLedger,
|
||||
closeResolution,
|
||||
rawCloseTimes,
|
||||
mode,
|
||||
std::move(consensusJson),
|
||||
validating());
|
||||
result, prevLedger, closeResolution, rawCloseTimes, mode, consensusJson, validating());
|
||||
}
|
||||
|
||||
void
|
||||
@@ -520,10 +514,10 @@ struct Peer
|
||||
NetClock::duration const& closeResolution,
|
||||
ConsensusCloseTimes const& rawCloseTimes,
|
||||
ConsensusMode const& mode,
|
||||
Json::Value&& consensusJson,
|
||||
Json::Value const& consensusJson,
|
||||
bool const validating)
|
||||
{
|
||||
schedule(delays.ledgerAccept, [=, this]() {
|
||||
schedule(delays.ledgerAccept, [mode, result, prevLedger, closeResolution, this]() {
|
||||
bool const proposing = mode == ConsensusMode::proposing;
|
||||
bool const consensusFail = result.state == ConsensusState::MovedOn;
|
||||
|
||||
|
||||
@@ -100,7 +100,8 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
TxSet(MutableTxSet&& m) : txs_{std::move(m.txs_)}, id_{calcID(txs_)}
|
||||
TxSet(MutableTxSet&& m) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
: txs_{m.txs_}, id_{calcID(txs_)}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -161,7 +162,7 @@ private:
|
||||
TxSetType txs_;
|
||||
|
||||
//! The unique ID of this tx set
|
||||
ID id_;
|
||||
ID id_{};
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -24,7 +24,7 @@ private:
|
||||
operator=(SignSubmitRunner&&) = delete;
|
||||
|
||||
SignSubmitRunner(Env& env, JTx&& jt, std::source_location loc)
|
||||
: env_(env), jt_(jt), loc_(loc)
|
||||
: env_(env), jt_(std::move(jt)), loc_(loc)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ private:
|
||||
static inline std::uint32_t fee = 0;
|
||||
Env& env_;
|
||||
AccountID owner_;
|
||||
std::uint32_t documentID_;
|
||||
std::uint32_t documentID_{};
|
||||
|
||||
private:
|
||||
void
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace detail {
|
||||
class flags_helper
|
||||
{
|
||||
protected:
|
||||
std::uint32_t mask_;
|
||||
std::uint32_t mask_{0};
|
||||
|
||||
private:
|
||||
void
|
||||
@@ -79,7 +79,7 @@ private:
|
||||
|
||||
protected:
|
||||
template <class... Args>
|
||||
flags_helper(Args... args) : mask_(0)
|
||||
flags_helper(Args... args)
|
||||
{
|
||||
set_args(args...);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace test {
|
||||
namespace jtx {
|
||||
namespace oracle {
|
||||
|
||||
Oracle::Oracle(Env& env, CreateArg const& arg, bool submit) : env_(env), documentID_{}
|
||||
Oracle::Oracle(Env& env, CreateArg const& arg, bool submit) : env_(env)
|
||||
{
|
||||
// LastUpdateTime is checked to be in range
|
||||
// {close-maxLastUpdateTimeDelta, close+maxLastUpdateTimeDelta}.
|
||||
|
||||
@@ -8,12 +8,14 @@ namespace test {
|
||||
namespace jtx {
|
||||
|
||||
qualityInPercent::qualityInPercent(double percent)
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-default-member-init)
|
||||
: qIn_(static_cast<std::uint32_t>((percent / 100) * QUALITY_ONE))
|
||||
{
|
||||
assert(percent <= 400 && percent >= 0);
|
||||
}
|
||||
|
||||
qualityOutPercent::qualityOutPercent(double percent)
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-use-default-member-init)
|
||||
: qOut_(static_cast<std::uint32_t>((percent / 100) * QUALITY_ONE))
|
||||
{
|
||||
assert(percent <= 400 && percent >= 0);
|
||||
|
||||
@@ -413,7 +413,6 @@ XChainBridgeObjects::XChainBridgeObjects()
|
||||
}
|
||||
return r;
|
||||
}())
|
||||
, quorum(UT_XCHAIN_DEFAULT_QUORUM)
|
||||
, reward(XRP(1))
|
||||
, split_reward_quorum(divide(reward, STAmount(UT_XCHAIN_DEFAULT_QUORUM), reward.issue()))
|
||||
, split_reward_everyone(divide(reward, STAmount(UT_XCHAIN_DEFAULT_NUM_SIGNERS), reward.issue()))
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
class qualityInPercent
|
||||
{
|
||||
private:
|
||||
std::uint32_t qIn_;
|
||||
std::uint32_t qIn_; // NOLINT(cppcoreguidelines-use-default-member-init)
|
||||
|
||||
public:
|
||||
explicit qualityInPercent(double percent);
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
class qualityOutPercent
|
||||
{
|
||||
private:
|
||||
std::uint32_t qOut_;
|
||||
std::uint32_t qOut_; // NOLINT(cppcoreguidelines-use-default-member-init)
|
||||
|
||||
public:
|
||||
explicit qualityOutPercent(double percent);
|
||||
|
||||
@@ -170,7 +170,7 @@ struct XChainBridgeObjects
|
||||
std::vector<signer> const alt_signers;
|
||||
std::vector<Account> const payee;
|
||||
std::vector<Account> const payees;
|
||||
std::uint32_t const quorum;
|
||||
std::uint32_t const quorum{UT_XCHAIN_DEFAULT_QUORUM};
|
||||
|
||||
STAmount const reward; // 1 xrp
|
||||
STAmount const split_reward_quorum; // 250,000 drops
|
||||
|
||||
@@ -152,11 +152,11 @@ private:
|
||||
clock_type::time_point mLastAction;
|
||||
|
||||
std::shared_ptr<Ledger> mLedger;
|
||||
bool mHaveHeader;
|
||||
bool mHaveState;
|
||||
bool mHaveTransactions;
|
||||
bool mSignaled;
|
||||
bool mByHash;
|
||||
bool mHaveHeader{false};
|
||||
bool mHaveState{false};
|
||||
bool mHaveTransactions{false};
|
||||
bool mSignaled{false};
|
||||
bool mByHash{true};
|
||||
std::uint32_t mSeq;
|
||||
Reason const mReason;
|
||||
|
||||
@@ -168,7 +168,7 @@ private:
|
||||
std::mutex mReceivedDataLock;
|
||||
std::vector<std::pair<std::weak_ptr<Peer>, std::shared_ptr<protocol::TMLedgerData>>>
|
||||
mReceivedData;
|
||||
bool mReceiveDispatched;
|
||||
bool mReceiveDispatched{false};
|
||||
std::unique_ptr<PeerSet> mPeerSet;
|
||||
};
|
||||
|
||||
|
||||
@@ -67,14 +67,8 @@ InboundLedger::InboundLedger(
|
||||
{jtLEDGER_DATA, "InboundLedger", 5},
|
||||
app.getJournal("InboundLedger"))
|
||||
, m_clock(clock)
|
||||
, mHaveHeader(false)
|
||||
, mHaveState(false)
|
||||
, mHaveTransactions(false)
|
||||
, mSignaled(false)
|
||||
, mByHash(true)
|
||||
, mSeq(seq)
|
||||
, mReason(reason)
|
||||
, mReceiveDispatched(false)
|
||||
, mPeerSet(std::move(peerSet))
|
||||
{
|
||||
JLOG(journal_.trace()) << "Acquiring ledger " << hash_;
|
||||
|
||||
@@ -15,10 +15,6 @@ TimeoutCounter::TimeoutCounter(
|
||||
: app_(app)
|
||||
, journal_(journal)
|
||||
, hash_(hash)
|
||||
, timeouts_(0)
|
||||
, complete_(false)
|
||||
, failed_(false)
|
||||
, progress_(false)
|
||||
, timerInterval_(interval)
|
||||
, queueJobParameter_(std::move(jobParameter))
|
||||
, timer_(app_.getIOContext())
|
||||
|
||||
@@ -59,6 +59,8 @@ public:
|
||||
virtual void
|
||||
cancel();
|
||||
|
||||
virtual ~TimeoutCounter() = default;
|
||||
|
||||
protected:
|
||||
using ScopedLockType = std::unique_lock<std::recursive_mutex>;
|
||||
|
||||
@@ -76,8 +78,6 @@ protected:
|
||||
QueueJobParameter&& jobParameter,
|
||||
beast::Journal journal);
|
||||
|
||||
virtual ~TimeoutCounter() = default;
|
||||
|
||||
/** Schedule a call to queueJob() after mTimerInterval. */
|
||||
void
|
||||
setTimer(ScopedLockType&);
|
||||
@@ -109,11 +109,11 @@ protected:
|
||||
/** The hash of the object (in practice, always a ledger) we are trying to
|
||||
* fetch. */
|
||||
uint256 const hash_;
|
||||
int timeouts_;
|
||||
bool complete_;
|
||||
bool failed_;
|
||||
int timeouts_{0};
|
||||
bool complete_{false};
|
||||
bool failed_{false};
|
||||
/** Whether forward progress has been made. */
|
||||
bool progress_;
|
||||
bool progress_{false};
|
||||
/** The minimum time to wait between calls to execute(). */
|
||||
std::chrono::milliseconds timerInterval_;
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ TransactionAcquire::TransactionAcquire(
|
||||
TX_ACQUIRE_TIMEOUT,
|
||||
{jtTXN_DATA, "TxAcq", {}},
|
||||
app.getJournal("TransactionAcquire"))
|
||||
, mHaveRoot(false)
|
||||
, mPeerSet(std::move(peerSet))
|
||||
{
|
||||
mMap = std::make_shared<SHAMap>(SHAMapType::TRANSACTION, hash, app_.getNodeFamily());
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
|
||||
private:
|
||||
std::shared_ptr<SHAMap> mMap;
|
||||
bool mHaveRoot;
|
||||
bool mHaveRoot{false};
|
||||
std::unique_ptr<PeerSet> mPeerSet;
|
||||
|
||||
void
|
||||
|
||||
@@ -146,23 +146,23 @@ public:
|
||||
explicit Metrics() = default;
|
||||
|
||||
/// Number of transactions in the queue
|
||||
std::size_t txCount;
|
||||
std::size_t txCount{};
|
||||
/// Max transactions currently allowed in queue
|
||||
std::optional<std::size_t> txQMaxSize;
|
||||
/// Number of transactions currently in the open ledger
|
||||
std::size_t txInLedger;
|
||||
std::size_t txInLedger{};
|
||||
/// Number of transactions expected per ledger
|
||||
std::size_t txPerLedger;
|
||||
std::size_t txPerLedger{};
|
||||
/// Reference transaction fee level
|
||||
FeeLevel64 referenceFeeLevel;
|
||||
FeeLevel64 referenceFeeLevel{};
|
||||
/// Minimum fee level for a transaction to be considered for
|
||||
/// the open ledger or the queue
|
||||
FeeLevel64 minProcessingFeeLevel;
|
||||
FeeLevel64 minProcessingFeeLevel{};
|
||||
/// Median fee level of the last ledger
|
||||
FeeLevel64 medFeeLevel;
|
||||
FeeLevel64 medFeeLevel{};
|
||||
/// Minimum fee level to get into the current open ledger,
|
||||
/// bypassing the queue
|
||||
FeeLevel64 openLedgerFeeLevel;
|
||||
FeeLevel64 openLedgerFeeLevel{};
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -511,7 +511,7 @@ private:
|
||||
their `retriesRemaining` forced down as part of the
|
||||
penalty.
|
||||
*/
|
||||
int retriesRemaining;
|
||||
int retriesRemaining{retriesAllowed};
|
||||
/// Flags provided to `apply`. If the transaction is later
|
||||
/// attempted with different flags, it will need to be
|
||||
/// `preflight`ed again.
|
||||
|
||||
@@ -157,7 +157,7 @@ class ValidatorList
|
||||
|
||||
std::vector<PublicKey> list;
|
||||
std::vector<std::string> manifests;
|
||||
std::size_t sequence;
|
||||
std::size_t sequence{};
|
||||
TimeKeeper::time_point validFrom;
|
||||
TimeKeeper::time_point validUntil;
|
||||
std::string siteUri;
|
||||
@@ -173,7 +173,7 @@ class ValidatorList
|
||||
|
||||
struct PublisherListCollection
|
||||
{
|
||||
PublisherStatus status;
|
||||
PublisherStatus status = PublisherStatus::unavailable;
|
||||
/*
|
||||
The `current` VL is the one which
|
||||
1. Has the largest sequence number that
|
||||
@@ -223,7 +223,7 @@ class ValidatorList
|
||||
hash_set<PublicKey> trustedMasterKeys_;
|
||||
|
||||
// Minimum number of lists on which a trusted validator must appear on
|
||||
std::size_t listThreshold_;
|
||||
std::size_t listThreshold_{1};
|
||||
|
||||
// The current list of trusted signing keys. For those validators using
|
||||
// a manifest, the signing key is the ephemeral key. For the ones using
|
||||
|
||||
@@ -85,12 +85,12 @@ private:
|
||||
/// when we've gotten a temp redirect
|
||||
std::shared_ptr<Resource> activeResource;
|
||||
|
||||
unsigned short redirCount;
|
||||
unsigned short redirCount{0};
|
||||
std::chrono::minutes refreshInterval;
|
||||
clock_type::time_point nextRefresh;
|
||||
std::optional<Status> lastRefreshStatus;
|
||||
endpoint_type lastRequestEndpoint;
|
||||
bool lastRequestSuccessful;
|
||||
bool lastRequestSuccessful{false};
|
||||
};
|
||||
|
||||
Application& app_;
|
||||
|
||||
@@ -257,7 +257,6 @@ TxQ::MaybeTx::MaybeTx(
|
||||
, account(txn_->getAccountID(sfAccount))
|
||||
, lastValid(getLastLedgerSequence(*txn_))
|
||||
, seqProxy(txn_->getSeqProxy())
|
||||
, retriesRemaining(retriesAllowed)
|
||||
, flags(flags_)
|
||||
, pfResult(pfResult_)
|
||||
{
|
||||
|
||||
@@ -109,7 +109,7 @@ ValidatorList::ValidatorList(
|
||||
, j_(j)
|
||||
, quorum_(minimumQuorum.value_or(1)) // Genesis ledger quorum
|
||||
, minimumQuorum_(minimumQuorum)
|
||||
, listThreshold_(1)
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -60,10 +60,9 @@ ValidatorSite::Site::Resource::Resource(std::string uri_) : uri{std::move(uri_)}
|
||||
ValidatorSite::Site::Site(std::string uri)
|
||||
: loadedResource{std::make_shared<Resource>(std::move(uri))}
|
||||
, startingResource{loadedResource}
|
||||
, redirCount{0}
|
||||
, refreshInterval{default_refresh_interval}
|
||||
, nextRefresh{clock_type::now()}
|
||||
, lastRequestSuccessful{false}
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -554,7 +554,7 @@ private:
|
||||
ConsensusParms::AvalancheState closeTimeAvalancheState_ = ConsensusParms::init;
|
||||
|
||||
// Time it took for the last consensus round to converge
|
||||
std::chrono::milliseconds prevRoundTime_;
|
||||
std::chrono::milliseconds prevRoundTime_{};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Network time measurements of consensus progress
|
||||
|
||||
@@ -117,7 +117,7 @@ class ConsensusTimer
|
||||
{
|
||||
using time_point = std::chrono::steady_clock::time_point;
|
||||
time_point start_;
|
||||
std::chrono::milliseconds dur_;
|
||||
std::chrono::milliseconds dur_{};
|
||||
|
||||
public:
|
||||
std::chrono::milliseconds
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
@param j Journal for debugging
|
||||
*/
|
||||
DisputedTx(Tx_t const& tx, bool ourVote, std::size_t numPeers, beast::Journal j)
|
||||
: yays_(0), nays_(0), ourVote_(ourVote), tx_(tx), j_(j)
|
||||
: ourVote_(ourVote), tx_(tx), j_(j)
|
||||
{
|
||||
votes_.reserve(numPeers);
|
||||
}
|
||||
@@ -173,8 +173,8 @@ public:
|
||||
getJson() const;
|
||||
|
||||
private:
|
||||
int yays_; //< Number of yes votes
|
||||
int nays_; //< Number of no votes
|
||||
int yays_{0}; //< Number of yes votes
|
||||
int nays_{0}; //< Number of no votes
|
||||
bool ourVote_; //< Our vote (true is yes)
|
||||
Tx_t tx_; //< Transaction under dispute
|
||||
Map_t votes_; //< Map from NodeID to vote
|
||||
@@ -258,8 +258,8 @@ DisputedTx<Tx_t, NodeID_t>::updateVote(int percentTime, bool proposing, Consensu
|
||||
if (!ourVote_ && (yays_ == 0))
|
||||
return false;
|
||||
|
||||
bool newPosition;
|
||||
int weight;
|
||||
bool newPosition = false;
|
||||
int weight = 0;
|
||||
|
||||
// When proposing, to prevent avalanche stalls, we increase the needed
|
||||
// weight slightly over time. We also need to ensure that the consensus has
|
||||
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
XRPL_ASSERT(ledger_.seq() == start_, "xrpl::Span::Span : ledger is genesis");
|
||||
}
|
||||
|
||||
Span(Ledger ledger) : start_{0}, end_{ledger.seq() + Seq{1}}, ledger_{std::move(ledger)}
|
||||
Span(Ledger ledger) : end_{ledger.seq() + Seq{1}}, ledger_{std::move(ledger)}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -98,9 +98,7 @@ private:
|
||||
* validator message source
|
||||
*/
|
||||
Slot(SquelchHandler const& handler, beast::Journal journal, uint16_t maxSelectedPeers)
|
||||
: reachedThreshold_(0)
|
||||
, lastSelected_(clock_type::now())
|
||||
, state_(SlotState::Counting)
|
||||
: lastSelected_(clock_type::now())
|
||||
, handler_(handler)
|
||||
, journal_(journal)
|
||||
, maxSelectedPeers_(maxSelectedPeers)
|
||||
@@ -220,14 +218,14 @@ private:
|
||||
std::unordered_set<id_t> considered_;
|
||||
|
||||
// number of peers that reached MAX_MESSAGE_THRESHOLD
|
||||
std::uint16_t reachedThreshold_;
|
||||
std::uint16_t reachedThreshold_{0};
|
||||
|
||||
// last time peers were selected, used to age the slot
|
||||
typename clock_type::time_point lastSelected_;
|
||||
|
||||
SlotState state_; // slot's state
|
||||
SquelchHandler const& handler_; // squelch/unsquelch handler
|
||||
beast::Journal const journal_; // logging
|
||||
SlotState state_{SlotState::Counting}; // slot's state
|
||||
SquelchHandler const& handler_; // squelch/unsquelch handler
|
||||
beast::Journal const journal_; // logging
|
||||
|
||||
// the maximum number of peers that should be selected as a validator
|
||||
// message source
|
||||
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
beast::Journal journal,
|
||||
OverlayImpl& overlay);
|
||||
|
||||
~ConnectAttempt();
|
||||
virtual ~ConnectAttempt();
|
||||
|
||||
/**
|
||||
* @brief Stop the connection attempt
|
||||
|
||||
@@ -126,7 +126,6 @@ OverlayImpl::OverlayImpl(
|
||||
collector))
|
||||
, m_resolver(resolver)
|
||||
, next_id_(1)
|
||||
, timer_count_(0)
|
||||
, slots_(app, *this, app.config())
|
||||
, m_stats(
|
||||
std::bind(&OverlayImpl::collect_metrics, this),
|
||||
|
||||
@@ -49,9 +49,8 @@ public:
|
||||
|
||||
explicit Child(OverlayImpl& overlay);
|
||||
|
||||
virtual ~Child();
|
||||
|
||||
public:
|
||||
virtual ~Child();
|
||||
virtual void
|
||||
stop() = 0;
|
||||
};
|
||||
@@ -98,7 +97,7 @@ private:
|
||||
hash_map<Peer::id_t, std::weak_ptr<PeerImp>> ids_;
|
||||
Resolver& m_resolver;
|
||||
std::atomic<Peer::id_t> next_id_;
|
||||
int timer_count_;
|
||||
int timer_count_{0};
|
||||
std::atomic<uint64_t> jqTransOverflow_{0};
|
||||
std::atomic<uint64_t> peerDisconnects_{0};
|
||||
std::atomic<uint64_t> peerDisconnectsCharges_{0};
|
||||
|
||||
@@ -349,7 +349,7 @@ invokeProtocolMessage(Buffers const& buffers, Handler& handler, std::size_t& hin
|
||||
return result;
|
||||
}
|
||||
|
||||
bool success;
|
||||
bool success = false;
|
||||
|
||||
switch (header->message_type)
|
||||
{
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
|
||||
#include "xrpld/peerfinder/detail/Tuning.h"
|
||||
|
||||
#include <string_view>
|
||||
|
||||
namespace xrpl {
|
||||
@@ -27,7 +29,7 @@ struct Config
|
||||
This includes both inbound and outbound, but does not include
|
||||
fixed peers.
|
||||
*/
|
||||
std::size_t maxPeers;
|
||||
std::size_t maxPeers{Tuning::defaultMaxPeers};
|
||||
|
||||
/** The number of automatic outbound connections to maintain.
|
||||
Outbound connections are only maintained if autoConnect
|
||||
@@ -39,25 +41,25 @@ struct Config
|
||||
Inbound connections are only maintained if wantIncoming
|
||||
is `true`.
|
||||
*/
|
||||
std::size_t inPeers;
|
||||
std::size_t inPeers{0};
|
||||
|
||||
/** `true` if we want our IP address kept private. */
|
||||
bool peerPrivate = true;
|
||||
|
||||
/** `true` if we want to accept incoming connections. */
|
||||
bool wantIncoming;
|
||||
bool wantIncoming{true};
|
||||
|
||||
/** `true` if we want to establish connections automatically */
|
||||
bool autoConnect;
|
||||
bool autoConnect{true};
|
||||
|
||||
/** The listening port number. */
|
||||
std::uint16_t listeningPort;
|
||||
std::uint16_t listeningPort{0};
|
||||
|
||||
/** The set of features we advertise. */
|
||||
std::string features;
|
||||
|
||||
/** Limit how many incoming connections we allow per IP */
|
||||
int ipLimit;
|
||||
int ipLimit{0};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -10,11 +10,8 @@ namespace xrpl {
|
||||
namespace PeerFinder {
|
||||
|
||||
Bootcache::Bootcache(Store& store, clock_type& clock, beast::Journal journal)
|
||||
: m_store(store)
|
||||
, m_clock(clock)
|
||||
, m_journal(journal)
|
||||
, m_whenUpdate(m_clock.now())
|
||||
, m_needsUpdate(false)
|
||||
: m_store(store), m_clock(clock), m_journal(journal), m_whenUpdate(m_clock.now())
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ private:
|
||||
clock_type::time_point m_whenUpdate;
|
||||
|
||||
// Set to true when a database update is needed
|
||||
bool m_needsUpdate;
|
||||
bool m_needsUpdate{false};
|
||||
|
||||
public:
|
||||
static constexpr int staticValence = 32;
|
||||
|
||||
@@ -44,7 +44,7 @@ private:
|
||||
|
||||
async_op(Checker& owner, boost::asio::io_context& io_context, Handler&& handler);
|
||||
|
||||
~async_op();
|
||||
virtual ~async_op();
|
||||
|
||||
void
|
||||
stop() override;
|
||||
@@ -108,7 +108,7 @@ template <class Handler>
|
||||
Checker<Protocol>::async_op<Handler>::async_op(
|
||||
Checker& owner,
|
||||
boost::asio::io_context& io_context,
|
||||
Handler&& handler)
|
||||
Handler&& handler) // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
: checker_(owner), socket_(io_context), handler_(std::forward<Handler>(handler))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -13,24 +13,6 @@ namespace PeerFinder {
|
||||
class Counts
|
||||
{
|
||||
public:
|
||||
Counts()
|
||||
: m_attempts(0)
|
||||
, m_active(0)
|
||||
, m_in_max(0)
|
||||
, m_in_active(0)
|
||||
, m_out_max(0)
|
||||
, m_out_active(0)
|
||||
, m_fixed(0)
|
||||
, m_fixed_active(0)
|
||||
, m_reserved(0)
|
||||
|
||||
, m_acceptCount(0)
|
||||
, m_closingCount(0)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/** Adds the slot state and properties to the slot counts. */
|
||||
void
|
||||
add(Slot const& s)
|
||||
@@ -282,38 +264,38 @@ private:
|
||||
|
||||
private:
|
||||
/** Outbound connection attempts. */
|
||||
int m_attempts;
|
||||
int m_attempts{0};
|
||||
|
||||
/** Active connections, including fixed and reserved. */
|
||||
std::size_t m_active;
|
||||
std::size_t m_active{0};
|
||||
|
||||
/** Total number of inbound slots. */
|
||||
std::size_t m_in_max;
|
||||
std::size_t m_in_max{0};
|
||||
|
||||
/** Number of inbound slots assigned to active peers. */
|
||||
std::size_t m_in_active;
|
||||
std::size_t m_in_active{0};
|
||||
|
||||
/** Maximum desired outbound slots. */
|
||||
std::size_t m_out_max;
|
||||
std::size_t m_out_max{0};
|
||||
|
||||
/** Active outbound slots. */
|
||||
std::size_t m_out_active;
|
||||
std::size_t m_out_active{0};
|
||||
|
||||
/** Fixed connections. */
|
||||
std::size_t m_fixed;
|
||||
std::size_t m_fixed{0};
|
||||
|
||||
/** Active fixed connections. */
|
||||
std::size_t m_fixed_active;
|
||||
std::size_t m_fixed_active{0};
|
||||
|
||||
/** Reserved connections. */
|
||||
std::size_t m_reserved;
|
||||
std::size_t m_reserved{0};
|
||||
|
||||
// Number of inbound connections that are
|
||||
// not active or gracefully closing.
|
||||
int m_acceptCount;
|
||||
int m_acceptCount{0};
|
||||
|
||||
// Number of connections that are gracefully closing.
|
||||
int m_closingCount;
|
||||
int m_closingCount{0};
|
||||
};
|
||||
|
||||
} // namespace PeerFinder
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace PeerFinder {
|
||||
class Fixed
|
||||
{
|
||||
public:
|
||||
explicit Fixed(clock_type& clock) : m_when(clock.now()), m_failures(0)
|
||||
explicit Fixed(clock_type& clock) : m_when(clock.now())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
|
||||
private:
|
||||
clock_type::time_point m_when;
|
||||
std::size_t m_failures;
|
||||
std::size_t m_failures{0};
|
||||
};
|
||||
|
||||
} // namespace PeerFinder
|
||||
|
||||
@@ -327,7 +327,7 @@ public:
|
||||
|
||||
friend class Livecache;
|
||||
lists_type m_lists;
|
||||
Histogram m_hist;
|
||||
Histogram m_hist{};
|
||||
} hops;
|
||||
|
||||
/** Returns `true` if the cache is empty. */
|
||||
|
||||
@@ -6,14 +6,8 @@
|
||||
namespace xrpl {
|
||||
namespace PeerFinder {
|
||||
|
||||
Config::Config()
|
||||
: maxPeers(Tuning::defaultMaxPeers)
|
||||
, outPeers(calcOutPeers())
|
||||
, inPeers(0)
|
||||
, wantIncoming(true)
|
||||
, autoConnect(true)
|
||||
, listeningPort(0)
|
||||
, ipLimit(0)
|
||||
Config::Config() : outPeers(calcOutPeers())
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
explicit Entry() = default;
|
||||
|
||||
beast::IP::Endpoint endpoint;
|
||||
int valence;
|
||||
int valence{};
|
||||
};
|
||||
virtual void
|
||||
save(std::vector<Entry> const& v) = 0;
|
||||
|
||||
@@ -147,7 +147,7 @@ public:
|
||||
Handoff
|
||||
onHandoff(
|
||||
Session& session,
|
||||
http_request_type&& request,
|
||||
http_request_type&& request, // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
|
||||
boost::asio::ip::tcp::endpoint const& remote_address)
|
||||
{
|
||||
return onHandoff(session, {}, std::forward<http_request_type>(request), remote_address);
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
|
||||
// The enable_if allows only integers (not enums). Prevents enum narrowing.
|
||||
template <typename T, typename = std::enable_if_t<std::is_integral<T>::value>>
|
||||
Status(T code, Strings d = {}) : type_(Type::none), code_(code), messages_(std::move(d))
|
||||
Status(T code, Strings d = {}) : code_(code), messages_(std::move(d))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
namespace xrpl {
|
||||
namespace RPC {
|
||||
|
||||
LegacyPathFind::LegacyPathFind(bool isAdmin, Application& app) : m_isOk(false)
|
||||
LegacyPathFind::LegacyPathFind(bool isAdmin, Application& app)
|
||||
{
|
||||
if (isAdmin)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
private:
|
||||
static std::atomic<int> inProgress;
|
||||
|
||||
bool m_isOk;
|
||||
bool m_isOk{false};
|
||||
};
|
||||
|
||||
} // namespace RPC
|
||||
|
||||
@@ -82,10 +82,10 @@ public:
|
||||
|
||||
struct PathRank
|
||||
{
|
||||
std::uint64_t quality;
|
||||
std::uint64_t length;
|
||||
std::uint64_t quality{};
|
||||
std::uint64_t length{};
|
||||
STAmount liquidity;
|
||||
int index;
|
||||
int index{};
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
@@ -150,7 +150,7 @@ parse(Json::Value const& param)
|
||||
|
||||
if (param.isString())
|
||||
{
|
||||
std::uint32_t v;
|
||||
std::uint32_t v = 0;
|
||||
if (beast::lexicalCastChecked(v, param.asString()))
|
||||
return v;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user