mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-23 12:35:50 +00:00
Throws, explicits and trivial cleanups
This commit is contained in:
committed by
Nik Bougalis
parent
8e842b5893
commit
ed9f5639a8
@@ -1782,7 +1782,6 @@ void LedgerConsensusImp::beginAccept (bool synchronous)
|
||||
JLOG (j_.fatal)
|
||||
<< "We don't have a consensus set";
|
||||
abort ();
|
||||
return;
|
||||
}
|
||||
|
||||
consensus_.newLCL (mPeerPositions.size (), mCurrentMSeconds);
|
||||
|
||||
@@ -1046,13 +1046,13 @@ void ApplicationImp::setup()
|
||||
if (!cluster_->load (config().section(SECTION_CLUSTER_NODES)))
|
||||
{
|
||||
m_journal.fatal << "Invalid entry in cluster configuration.";
|
||||
throw std::exception();
|
||||
Throw<std::exception>();
|
||||
}
|
||||
|
||||
if (!validators_->load (config().section (SECTION_VALIDATORS)))
|
||||
{
|
||||
m_journal.fatal << "Invalid entry in validator configuration.";
|
||||
throw std::exception();
|
||||
Throw<std::exception>();
|
||||
}
|
||||
|
||||
if (validators_->size () == 0 && !config_->RUN_STANDALONE)
|
||||
|
||||
@@ -38,7 +38,7 @@ loadNodeIdentity (Application& app)
|
||||
app.config().NODE_SEED);
|
||||
|
||||
if (!seed)
|
||||
throw std::runtime_error (
|
||||
Throw<std::runtime_error>(
|
||||
"NodeIdentity: Bad [node_seed] specified");
|
||||
|
||||
auto secretKey =
|
||||
|
||||
@@ -74,6 +74,7 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
explicit
|
||||
ValidationsImp (Application& app)
|
||||
: app_ (app)
|
||||
, mValidations ("Validations", 4096, 600, stopwatch(),
|
||||
|
||||
@@ -365,7 +365,7 @@ void Config::loadFromString (std::string const& fileContents)
|
||||
{
|
||||
auto const seed = parseBase58<Seed>(strTemp);
|
||||
if (!seed)
|
||||
throw std::runtime_error (
|
||||
Throw<std::runtime_error> (
|
||||
"Invalid seed specified in [" SECTION_VALIDATION_SEED "]");
|
||||
VALIDATION_PRIV = generateSecretKey (KeyType::secp256k1, *seed);
|
||||
VALIDATION_PUB = derivePublicKey (KeyType::secp256k1, VALIDATION_PRIV);
|
||||
@@ -374,7 +374,7 @@ void Config::loadFromString (std::string const& fileContents)
|
||||
if (getSingleSection (secConfig, SECTION_NODE_SEED, NODE_SEED, j_))
|
||||
{
|
||||
if (!parseBase58<Seed>(NODE_SEED))
|
||||
throw std::runtime_error (
|
||||
Throw<std::runtime_error> (
|
||||
"Invalid seed specified in [" SECTION_NODE_SEED "]");
|
||||
}
|
||||
|
||||
|
||||
@@ -341,7 +341,6 @@ public:
|
||||
ledgerHashes.emplace_back(lh);
|
||||
ledgerIndexes.emplace_back(i);
|
||||
}
|
||||
std::string slh (lh);
|
||||
s << "INSERT INTO Ledgers (LedgerHash, LedgerSeq) VALUES "
|
||||
"(:lh, :li);",
|
||||
soci::use (ledgerHashes), soci::use (ledgerIndexes);
|
||||
|
||||
@@ -76,6 +76,7 @@ size_t lengthWithoutTrailingZeros (std::string const& s)
|
||||
class Writer::Impl
|
||||
{
|
||||
public:
|
||||
explicit
|
||||
Impl (Output const& output) : output_(output) {}
|
||||
~Impl() = default;
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ private:
|
||||
boost::optional<uint256> digest_;
|
||||
|
||||
public:
|
||||
explicit
|
||||
Impl (DigestAwareReadView const& ledger)
|
||||
{
|
||||
auto const k = keylet::amendments();
|
||||
|
||||
@@ -1360,9 +1360,8 @@ rippleSend (ApplyView& view,
|
||||
|
||||
if (uSenderID == issuer || uReceiverID == issuer || issuer == noAccount())
|
||||
{
|
||||
// VFALCO Why do we need this bCheckIssuer?
|
||||
// Direct send: redeeming IOUs and/or sending own IOUs.
|
||||
terResult = rippleCredit (view, uSenderID, uReceiverID, saAmount, false, j);
|
||||
rippleCredit (view, uSenderID, uReceiverID, saAmount, false, j);
|
||||
saActual = saAmount;
|
||||
terResult = tesSUCCESS;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace ripple {
|
||||
class HTTPClientSSLContext
|
||||
{
|
||||
public:
|
||||
explicit
|
||||
HTTPClientSSLContext (Config const& config)
|
||||
: m_context (boost::asio::ssl::context::sslv23)
|
||||
, verify_ (config.SSL_VERIFY)
|
||||
|
||||
@@ -1066,7 +1066,7 @@ setup_Overlay (BasicConfig const& config)
|
||||
|
||||
set (setup.ipLimit, "ip_limit", section);
|
||||
if (setup.ipLimit < 0)
|
||||
throw std::runtime_error ("Configured IP limit is invalid");
|
||||
Throw<std::runtime_error> ("Configured IP limit is invalid");
|
||||
|
||||
std::string ip;
|
||||
set (ip, "public_ip", section);
|
||||
|
||||
@@ -132,10 +132,7 @@ std::string const& getFullVersionString ()
|
||||
{
|
||||
struct PrettyPrinter
|
||||
{
|
||||
PrettyPrinter ()
|
||||
{
|
||||
fullVersionString = "rippled-" + getVersionString ();
|
||||
}
|
||||
PrettyPrinter () : fullVersionString ("rippled-" + getVersionString ()){}
|
||||
|
||||
std::string fullVersionString;
|
||||
};
|
||||
|
||||
@@ -48,7 +48,7 @@ STAccount::STAccount (SField const& n, Buffer&& v)
|
||||
// which throws. If STVar can throw in its constructor, then so can
|
||||
// STAccount.
|
||||
if (v.size() != uint160::bytes)
|
||||
throw std::runtime_error ("Invalid STAccount size");
|
||||
Throw<std::runtime_error> ("Invalid STAccount size");
|
||||
|
||||
default_ = false;
|
||||
memcpy (value_.begin(), v.data (), uint160::bytes);
|
||||
|
||||
@@ -59,6 +59,7 @@ Status handle (Context& context, Object& object)
|
||||
class HandlerTable {
|
||||
public:
|
||||
template<std::size_t N>
|
||||
explicit
|
||||
HandlerTable (const Handler(&entries)[N])
|
||||
{
|
||||
for (std::size_t i = 0; i < N; ++i)
|
||||
|
||||
@@ -54,8 +54,6 @@ std::string Status::codeString () const
|
||||
|
||||
void Status::fillJson (Json::Value& value)
|
||||
{
|
||||
static const std::string separator = ": ";
|
||||
|
||||
if (!*this)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user