mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-03 08:46:46 +00:00
Merge branch 'develop' into ximinez/fix/validator-cache
This commit is contained in:
@@ -62,7 +62,7 @@ struct IsContiguousContainer<Slice> : std::true_type
|
||||
number of bits.
|
||||
*/
|
||||
template <std::size_t Bits, class Tag = void>
|
||||
class BaseUint
|
||||
class BaseUInt
|
||||
{
|
||||
static_assert((Bits % 32) == 0, "The length of a base_uint in bits must be a multiple of 32.");
|
||||
|
||||
@@ -160,7 +160,7 @@ private:
|
||||
explicit VoidHelper() = default;
|
||||
};
|
||||
|
||||
explicit BaseUint(void const* data, VoidHelper)
|
||||
explicit BaseUInt(void const* data, VoidHelper)
|
||||
{
|
||||
memcpy(data_.data(), data, kBYTES);
|
||||
}
|
||||
@@ -244,15 +244,15 @@ private:
|
||||
}
|
||||
|
||||
public:
|
||||
constexpr BaseUint() : data_{}
|
||||
constexpr BaseUInt() : data_{}
|
||||
{
|
||||
}
|
||||
|
||||
constexpr BaseUint(beast::Zero) : data_{}
|
||||
constexpr BaseUInt(beast::Zero) : data_{}
|
||||
{
|
||||
}
|
||||
|
||||
explicit BaseUint(std::uint64_t b)
|
||||
explicit BaseUInt(std::uint64_t b)
|
||||
{
|
||||
*this = b;
|
||||
}
|
||||
@@ -260,7 +260,7 @@ public:
|
||||
// This constructor is intended to be used at compile time since it might
|
||||
// throw at runtime. Consider declaring this constructor consteval once
|
||||
// we get to C++23.
|
||||
explicit constexpr BaseUint(std::string_view sv) noexcept(false)
|
||||
explicit constexpr BaseUInt(std::string_view sv) noexcept(false)
|
||||
: data_(parseFromStringViewThrows(sv))
|
||||
{
|
||||
}
|
||||
@@ -270,11 +270,11 @@ public:
|
||||
class = std::enable_if_t<
|
||||
detail::IsContiguousContainer<Container>::value &&
|
||||
std::is_trivially_copyable_v<typename Container::value_type>>>
|
||||
explicit BaseUint(Container const& c)
|
||||
explicit BaseUInt(Container const& c)
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
c.size() * sizeof(typename Container::value_type) == size(),
|
||||
"xrpl::base_uint::base_uint(Container auto) : input size match");
|
||||
"xrpl::BaseUInt::BaseUInt(Container auto) : input size match");
|
||||
std::memcpy(data_.data(), c.data(), size());
|
||||
}
|
||||
|
||||
@@ -282,12 +282,12 @@ public:
|
||||
std::enable_if_t<
|
||||
detail::IsContiguousContainer<Container>::value &&
|
||||
std::is_trivially_copyable_v<typename Container::value_type>,
|
||||
BaseUint&>
|
||||
BaseUInt&>
|
||||
operator=(Container const& c)
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
c.size() * sizeof(typename Container::value_type) == size(),
|
||||
"xrpl::base_uint::operator=(Container auto) : input size match");
|
||||
"xrpl::BaseUInt::operator=(Container auto) : input size match");
|
||||
std::memcpy(data_.data(), c.data(), size());
|
||||
return *this;
|
||||
}
|
||||
@@ -295,14 +295,14 @@ public:
|
||||
/* Construct from a raw pointer.
|
||||
The buffer pointed to by `data` must be at least Bits/8 bytes.
|
||||
*/
|
||||
static BaseUint
|
||||
static BaseUInt
|
||||
fromVoid(void const* data)
|
||||
{
|
||||
return BaseUint(data, VoidHelper());
|
||||
return BaseUInt(data, VoidHelper());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
static std::optional<BaseUint>
|
||||
static std::optional<BaseUInt>
|
||||
fromVoidChecked(T const& from)
|
||||
{
|
||||
if (from.size() != size())
|
||||
@@ -328,10 +328,10 @@ public:
|
||||
return *this == beast::kZERO;
|
||||
}
|
||||
|
||||
constexpr BaseUint
|
||||
constexpr BaseUInt
|
||||
operator~() const
|
||||
{
|
||||
BaseUint ret;
|
||||
BaseUInt ret;
|
||||
|
||||
for (int i = 0; i < kWIDTH; i++)
|
||||
ret.data_[i] = ~data_[i];
|
||||
@@ -339,7 +339,7 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
BaseUint&
|
||||
BaseUInt&
|
||||
operator=(std::uint64_t uHost)
|
||||
{
|
||||
*this = beast::kZERO;
|
||||
@@ -357,8 +357,8 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
BaseUint&
|
||||
operator^=(BaseUint const& b)
|
||||
BaseUInt&
|
||||
operator^=(BaseUInt const& b)
|
||||
{
|
||||
for (int i = 0; i < kWIDTH; i++)
|
||||
data_[i] ^= b.data_[i];
|
||||
@@ -366,8 +366,8 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
BaseUint&
|
||||
operator&=(BaseUint const& b)
|
||||
BaseUInt&
|
||||
operator&=(BaseUInt const& b)
|
||||
{
|
||||
for (int i = 0; i < kWIDTH; i++)
|
||||
data_[i] &= b.data_[i];
|
||||
@@ -375,8 +375,8 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
BaseUint&
|
||||
operator|=(BaseUint const& b)
|
||||
BaseUInt&
|
||||
operator|=(BaseUInt const& b)
|
||||
{
|
||||
for (int i = 0; i < kWIDTH; i++)
|
||||
data_[i] |= b.data_[i];
|
||||
@@ -384,7 +384,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
BaseUint&
|
||||
BaseUInt&
|
||||
operator++()
|
||||
{
|
||||
// prefix operator
|
||||
@@ -398,17 +398,17 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
BaseUint
|
||||
BaseUInt
|
||||
operator++(int)
|
||||
{
|
||||
// postfix operator
|
||||
BaseUint const ret = *this;
|
||||
BaseUInt const ret = *this;
|
||||
++(*this);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
BaseUint&
|
||||
BaseUInt&
|
||||
operator--()
|
||||
{
|
||||
for (int i = kWIDTH - 1; i >= 0; --i)
|
||||
@@ -423,32 +423,32 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
BaseUint
|
||||
BaseUInt
|
||||
operator--(int)
|
||||
{
|
||||
// postfix operator
|
||||
BaseUint const ret = *this;
|
||||
BaseUInt const ret = *this;
|
||||
--(*this);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
[[nodiscard]] BaseUint
|
||||
[[nodiscard]] BaseUInt
|
||||
next() const
|
||||
{
|
||||
auto ret = *this;
|
||||
return ++ret;
|
||||
}
|
||||
|
||||
[[nodiscard]] BaseUint
|
||||
[[nodiscard]] BaseUInt
|
||||
prev() const
|
||||
{
|
||||
auto ret = *this;
|
||||
return --ret;
|
||||
}
|
||||
|
||||
BaseUint&
|
||||
operator+=(BaseUint const& b)
|
||||
BaseUInt&
|
||||
operator+=(BaseUInt const& b)
|
||||
{
|
||||
std::uint64_t carry = 0;
|
||||
|
||||
@@ -466,7 +466,7 @@ public:
|
||||
|
||||
template <class Hasher>
|
||||
friend void
|
||||
hash_append(Hasher& h, BaseUint const& a) noexcept
|
||||
hash_append(Hasher& h, BaseUInt const& a) noexcept
|
||||
{
|
||||
// Do not allow any endian transformations on this memory
|
||||
h(a.data_.data(), sizeof(a.data_));
|
||||
@@ -509,7 +509,7 @@ public:
|
||||
return kBYTES;
|
||||
}
|
||||
|
||||
BaseUint<Bits, Tag>&
|
||||
BaseUInt<Bits, Tag>&
|
||||
operator=(beast::Zero)
|
||||
{
|
||||
data_.fill(0);
|
||||
@@ -534,14 +534,14 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
using uint128 = BaseUint<128>;
|
||||
using uint160 = BaseUint<160>;
|
||||
using uint256 = BaseUint<256>;
|
||||
using uint192 = BaseUint<192>;
|
||||
using uint128 = BaseUInt<128>;
|
||||
using uint160 = BaseUInt<160>;
|
||||
using uint256 = BaseUInt<256>;
|
||||
using uint192 = BaseUInt<192>;
|
||||
|
||||
template <std::size_t Bits, class Tag>
|
||||
[[nodiscard]] constexpr std::strong_ordering
|
||||
operator<=>(BaseUint<Bits, Tag> const& lhs, BaseUint<Bits, Tag> const& rhs)
|
||||
operator<=>(BaseUInt<Bits, Tag> const& lhs, BaseUInt<Bits, Tag> const& rhs)
|
||||
{
|
||||
// This comparison might seem wrong on a casual inspection because it
|
||||
// compares data internally stored as std::uint32_t byte-by-byte. But
|
||||
@@ -562,7 +562,7 @@ operator<=>(BaseUint<Bits, Tag> const& lhs, BaseUint<Bits, Tag> const& rhs)
|
||||
|
||||
template <std::size_t Bits, typename Tag>
|
||||
[[nodiscard]] constexpr bool
|
||||
operator==(BaseUint<Bits, Tag> const& lhs, BaseUint<Bits, Tag> const& rhs)
|
||||
operator==(BaseUInt<Bits, Tag> const& lhs, BaseUInt<Bits, Tag> const& rhs)
|
||||
{
|
||||
return (lhs <=> rhs) == 0;
|
||||
}
|
||||
@@ -570,59 +570,59 @@ operator==(BaseUint<Bits, Tag> const& lhs, BaseUint<Bits, Tag> const& rhs)
|
||||
//------------------------------------------------------------------------------
|
||||
template <std::size_t Bits, class Tag>
|
||||
constexpr bool
|
||||
operator==(BaseUint<Bits, Tag> const& a, std::uint64_t b)
|
||||
operator==(BaseUInt<Bits, Tag> const& a, std::uint64_t b)
|
||||
{
|
||||
return a == BaseUint<Bits, Tag>(b);
|
||||
return a == BaseUInt<Bits, Tag>(b);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template <std::size_t Bits, class Tag>
|
||||
constexpr BaseUint<Bits, Tag>
|
||||
operator^(BaseUint<Bits, Tag> const& a, BaseUint<Bits, Tag> const& b)
|
||||
constexpr BaseUInt<Bits, Tag>
|
||||
operator^(BaseUInt<Bits, Tag> const& a, BaseUInt<Bits, Tag> const& b)
|
||||
{
|
||||
return BaseUint<Bits, Tag>(a) ^= b;
|
||||
return BaseUInt<Bits, Tag>(a) ^= b;
|
||||
}
|
||||
|
||||
template <std::size_t Bits, class Tag>
|
||||
constexpr BaseUint<Bits, Tag>
|
||||
operator&(BaseUint<Bits, Tag> const& a, BaseUint<Bits, Tag> const& b)
|
||||
constexpr BaseUInt<Bits, Tag>
|
||||
operator&(BaseUInt<Bits, Tag> const& a, BaseUInt<Bits, Tag> const& b)
|
||||
{
|
||||
return BaseUint<Bits, Tag>(a) &= b;
|
||||
return BaseUInt<Bits, Tag>(a) &= b;
|
||||
}
|
||||
|
||||
template <std::size_t Bits, class Tag>
|
||||
constexpr BaseUint<Bits, Tag>
|
||||
operator|(BaseUint<Bits, Tag> const& a, BaseUint<Bits, Tag> const& b)
|
||||
constexpr BaseUInt<Bits, Tag>
|
||||
operator|(BaseUInt<Bits, Tag> const& a, BaseUInt<Bits, Tag> const& b)
|
||||
{
|
||||
return BaseUint<Bits, Tag>(a) |= b;
|
||||
return BaseUInt<Bits, Tag>(a) |= b;
|
||||
}
|
||||
|
||||
template <std::size_t Bits, class Tag>
|
||||
constexpr BaseUint<Bits, Tag>
|
||||
operator+(BaseUint<Bits, Tag> const& a, BaseUint<Bits, Tag> const& b)
|
||||
constexpr BaseUInt<Bits, Tag>
|
||||
operator+(BaseUInt<Bits, Tag> const& a, BaseUInt<Bits, Tag> const& b)
|
||||
{
|
||||
return BaseUint<Bits, Tag>(a) += b;
|
||||
return BaseUInt<Bits, Tag>(a) += b;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
template <std::size_t Bits, class Tag>
|
||||
inline std::string
|
||||
to_string(BaseUint<Bits, Tag> const& a)
|
||||
to_string(BaseUInt<Bits, Tag> const& a)
|
||||
{
|
||||
return strHex(a.cbegin(), a.cend());
|
||||
}
|
||||
|
||||
template <std::size_t Bits, class Tag>
|
||||
inline std::string
|
||||
toShortString(BaseUint<Bits, Tag> const& a)
|
||||
toShortString(BaseUInt<Bits, Tag> const& a)
|
||||
{
|
||||
static_assert(BaseUint<Bits, Tag>::kBYTES > 4, "For 4 bytes or less, use a native type");
|
||||
static_assert(BaseUInt<Bits, Tag>::kBYTES > 4, "For 4 bytes or less, use a native type");
|
||||
return strHex(a.cbegin(), a.cbegin() + 4) + "...";
|
||||
}
|
||||
|
||||
template <std::size_t Bits, class Tag>
|
||||
inline std::ostream&
|
||||
operator<<(std::ostream& out, BaseUint<Bits, Tag> const& u)
|
||||
operator<<(std::ostream& out, BaseUInt<Bits, Tag> const& u)
|
||||
{
|
||||
return out << to_string(u);
|
||||
}
|
||||
@@ -650,7 +650,7 @@ static_assert(sizeof(uint256) == 256 / 8, "There should be no padding bytes");
|
||||
namespace beast {
|
||||
|
||||
template <std::size_t Bits, class Tag>
|
||||
struct IsUniquelyRepresented<xrpl::BaseUint<Bits, Tag>> : public std::true_type
|
||||
struct IsUniquelyRepresented<xrpl::BaseUInt<Bits, Tag>> : public std::true_type
|
||||
{
|
||||
explicit IsUniquelyRepresented() = default;
|
||||
};
|
||||
|
||||
@@ -236,7 +236,7 @@ public:
|
||||
map_.resize(partitions_);
|
||||
XRPL_ASSERT(
|
||||
partitions_,
|
||||
"xrpl::partitioned_unordered_map::partitioned_unordered_map : "
|
||||
"xrpl::PartitionedUnorderedMap::PartitionedUnorderedMap : "
|
||||
"nonzero partitions");
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ template <class Engine, class Integral>
|
||||
std::enable_if_t<std::is_integral_v<Integral> && detail::is_engine<Engine>::value, Integral>
|
||||
randInt(Engine& engine, Integral min, Integral max)
|
||||
{
|
||||
XRPL_ASSERT(max > min, "xrpl::rand_int : max over min inputs");
|
||||
XRPL_ASSERT(max > min, "xrpl::randInt : max over min inputs");
|
||||
|
||||
// This should have no state and constructing it should
|
||||
// be very cheap. If that turns out not to be the case
|
||||
|
||||
@@ -81,7 +81,7 @@ safeDowncast(Src* s) noexcept
|
||||
return static_cast<Dest>(s); // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast)
|
||||
#else
|
||||
auto* result = dynamic_cast<Dest>(s);
|
||||
XRPL_ASSERT(result != nullptr, "xrpl::safe_downcast : pointer downcast is valid");
|
||||
XRPL_ASSERT(result != nullptr, "xrpl::safeDowncast : pointer downcast is valid");
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
@@ -94,7 +94,7 @@ safeDowncast(Src& s) noexcept
|
||||
#ifndef NDEBUG
|
||||
XRPL_ASSERT(
|
||||
dynamic_cast<std::add_pointer_t<std::remove_reference_t<Dest>>>(&s) != nullptr,
|
||||
"xrpl::safe_downcast : reference downcast is valid");
|
||||
"xrpl::safeDowncast : reference downcast is valid");
|
||||
#endif
|
||||
return static_cast<Dest>(s); // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast)
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ class ScopeUnlock
|
||||
public:
|
||||
explicit ScopeUnlock(std::unique_lock<Mutex>& lock) noexcept(true) : plock_(&lock)
|
||||
{
|
||||
XRPL_ASSERT(plock_->owns_lock(), "xrpl::scope_unlock::scope_unlock : mutex must be locked");
|
||||
XRPL_ASSERT(plock_->owns_lock(), "xrpl::ScopeUnlock::ScopeUnlock : mutex must be locked");
|
||||
plock_->unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
index >= 0 && (mask_ != 0),
|
||||
"xrpl::packed_spinlock::packed_spinlock : valid index and mask");
|
||||
"xrpl::PackedSpinlock::PackedSpinlock : valid index and mask");
|
||||
}
|
||||
|
||||
[[nodiscard]] bool
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace beast {
|
||||
|
||||
/** Measures handler latency on an io_context queue. */
|
||||
template <class Clock>
|
||||
class IoLatencyProbe
|
||||
class IOLatencyProbe
|
||||
{
|
||||
private:
|
||||
using duration = typename Clock::duration;
|
||||
@@ -30,12 +30,12 @@ private:
|
||||
bool cancel_{false};
|
||||
|
||||
public:
|
||||
IoLatencyProbe(duration const& period, boost::asio::io_context& ios)
|
||||
IOLatencyProbe(duration const& period, boost::asio::io_context& ios)
|
||||
: period_(period), ios_(ios), timer_(ios_)
|
||||
{
|
||||
}
|
||||
|
||||
~IoLatencyProbe()
|
||||
~IOLatencyProbe()
|
||||
{
|
||||
std::unique_lock<decltype(mutex_)> lock(mutex_);
|
||||
cancel(lock, true);
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
{
|
||||
std::scoped_lock const lock(mutex_);
|
||||
if (cancel_)
|
||||
throw std::logic_error("io_latency_probe is canceled");
|
||||
throw std::logic_error("IOLatencyProbe is canceled");
|
||||
boost::asio::post(
|
||||
ios_, SampleOp<Handler>(std::forward<Handler>(handler), Clock::now(), false, this));
|
||||
}
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
{
|
||||
std::scoped_lock const lock(mutex_);
|
||||
if (cancel_)
|
||||
throw std::logic_error("io_latency_probe is canceled");
|
||||
throw std::logic_error("IOLatencyProbe is canceled");
|
||||
boost::asio::post(
|
||||
ios_, SampleOp<Handler>(std::forward<Handler>(handler), Clock::now(), true, this));
|
||||
}
|
||||
@@ -140,18 +140,18 @@ private:
|
||||
Handler handler;
|
||||
time_point start;
|
||||
bool repeat;
|
||||
IoLatencyProbe* probe;
|
||||
IOLatencyProbe* probe;
|
||||
|
||||
SampleOp(
|
||||
Handler const& handler,
|
||||
time_point const& start,
|
||||
bool repeat,
|
||||
IoLatencyProbe* probe)
|
||||
IOLatencyProbe* probe)
|
||||
: handler(handler), start(start), repeat(repeat), probe(probe)
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
probe,
|
||||
"beast::io_latency_probe::sample_op::sample_op : non-null "
|
||||
"beast::IOLatencyProbe::SampleOp::SampleOp : non-null "
|
||||
"probe input");
|
||||
probe->addref();
|
||||
}
|
||||
@@ -164,7 +164,7 @@ private:
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
probe,
|
||||
"beast::io_latency_probe::sample_op::sample_op(sample_op&&) : "
|
||||
"beast::IOLatencyProbe::SampleOp::SampleOp(SampleOp&&) : "
|
||||
"non-null probe input");
|
||||
from.probe = nullptr;
|
||||
}
|
||||
|
||||
@@ -1370,7 +1370,7 @@ private:
|
||||
buck_.resize(size() + additional, cont_);
|
||||
XRPL_ASSERT(
|
||||
loadFactor() <= maxLoadFactor(),
|
||||
"beast::detail::AgedUnorderedContainer::maybe_rehash : maximum "
|
||||
"beast::detail::AgedUnorderedContainer::maybeRehash : maximum "
|
||||
"load factor");
|
||||
}
|
||||
|
||||
|
||||
@@ -19,14 +19,10 @@ namespace credentials {
|
||||
|
||||
// Check if credential sfExpiration field has passed ledger's parentCloseTime
|
||||
bool
|
||||
checkExpired(std::shared_ptr<SLE const> const& sleCredential, NetClock::time_point const& closed);
|
||||
|
||||
// Return true if any expired credential was found in arr (and deleted)
|
||||
bool
|
||||
removeExpired(ApplyView& view, STVector256 const& arr, beast::Journal const j);
|
||||
checkExpired(SLE const& sleCredential, NetClock::time_point const& closed);
|
||||
|
||||
// Actually remove a credentials object from the ledger
|
||||
TER
|
||||
[[nodiscard]] TER
|
||||
deleteSLE(ApplyView& view, std::shared_ptr<SLE> const& sleCredential, beast::Journal j);
|
||||
|
||||
// Amendment and parameters checks for sfCredentialIDs field
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
} // namespace detail
|
||||
|
||||
/** A 160-bit unsigned that uniquely identifies an account. */
|
||||
using AccountID = BaseUint<160, detail::AccountIDTag>;
|
||||
using AccountID = BaseUInt<160, detail::AccountIDTag>;
|
||||
|
||||
/** Convert AccountID to base58 checked string */
|
||||
std::string
|
||||
|
||||
@@ -16,7 +16,7 @@ class STBitString final : public STBase, public CountedObject<STBitString<Bits>>
|
||||
static_assert(Bits > 0, "Number of bits must be positive");
|
||||
|
||||
public:
|
||||
using value_type = BaseUint<Bits>;
|
||||
using value_type = BaseUInt<Bits>;
|
||||
|
||||
private:
|
||||
value_type value_{};
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
|
||||
template <typename Tag>
|
||||
void
|
||||
setValue(BaseUint<Bits, Tag> const& v);
|
||||
setValue(BaseUInt<Bits, Tag> const& v);
|
||||
|
||||
[[nodiscard]] value_type const&
|
||||
value() const;
|
||||
@@ -157,7 +157,7 @@ STBitString<Bits>::add(Serializer& s) const
|
||||
template <int Bits>
|
||||
template <typename Tag>
|
||||
void
|
||||
STBitString<Bits>::setValue(BaseUint<Bits, Tag> const& v)
|
||||
STBitString<Bits>::setValue(BaseUInt<Bits, Tag> const& v)
|
||||
{
|
||||
value_ = v;
|
||||
}
|
||||
|
||||
@@ -381,7 +381,7 @@ public:
|
||||
|
||||
template <class Tag>
|
||||
void
|
||||
setFieldH160(SField const& field, BaseUint<160, Tag> const& v);
|
||||
setFieldH160(SField const& field, BaseUInt<160, Tag> const& v);
|
||||
|
||||
STObject&
|
||||
peekFieldObject(SField const& field);
|
||||
@@ -1143,7 +1143,7 @@ STObject::at(OptionaledField<T> const& of) -> OptionalProxy<T>
|
||||
|
||||
template <class Tag>
|
||||
void
|
||||
STObject::setFieldH160(SField const& field, BaseUint<160, Tag> const& v)
|
||||
STObject::setFieldH160(SField const& field, BaseUInt<160, Tag> const& v)
|
||||
{
|
||||
STBase* rf = getPField(field, true);
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
|
||||
template <std::size_t Bits, class Tag>
|
||||
int
|
||||
addBitString(BaseUint<Bits, Tag> const& v)
|
||||
addBitString(BaseUInt<Bits, Tag> const& v)
|
||||
{
|
||||
return addRaw(v.data(), v.size());
|
||||
}
|
||||
@@ -151,7 +151,7 @@ public:
|
||||
|
||||
template <std::size_t Bits, typename Tag = void>
|
||||
bool
|
||||
getBitString(BaseUint<Bits, Tag>& data, int offset) const
|
||||
getBitString(BaseUInt<Bits, Tag>& data, int offset) const
|
||||
{
|
||||
auto success = (offset + (Bits / 8)) <= data_.size();
|
||||
if (success)
|
||||
@@ -369,7 +369,7 @@ public:
|
||||
geti64();
|
||||
|
||||
template <std::size_t Bits, class Tag = void>
|
||||
BaseUint<Bits, Tag>
|
||||
BaseUInt<Bits, Tag>
|
||||
getBitString();
|
||||
|
||||
uint128
|
||||
@@ -428,7 +428,7 @@ public:
|
||||
};
|
||||
|
||||
template <std::size_t Bits, class Tag>
|
||||
BaseUint<Bits, Tag>
|
||||
BaseUInt<Bits, Tag>
|
||||
SerialIter::getBitString()
|
||||
{
|
||||
auto const n = Bits / 8;
|
||||
@@ -442,7 +442,7 @@ SerialIter::getBitString()
|
||||
used_ += n;
|
||||
remain_ -= n;
|
||||
|
||||
return BaseUint<Bits, Tag>::fromVoid(x);
|
||||
return BaseUInt<Bits, Tag>::fromVoid(x);
|
||||
}
|
||||
|
||||
} // namespace xrpl
|
||||
|
||||
@@ -30,21 +30,21 @@ public:
|
||||
|
||||
/** Directory is an index into the directory of offer books.
|
||||
The last 64 bits of this are the quality. */
|
||||
using Directory = BaseUint<256, detail::DirectoryTag>;
|
||||
using Directory = BaseUInt<256, detail::DirectoryTag>;
|
||||
|
||||
/** Currency is a hash representing a specific currency. */
|
||||
using Currency = BaseUint<160, detail::CurrencyTag>;
|
||||
using Currency = BaseUInt<160, detail::CurrencyTag>;
|
||||
|
||||
/** NodeID is a 160-bit hash representing one node. */
|
||||
using NodeID = BaseUint<160, detail::NodeIDTag>;
|
||||
using NodeID = BaseUInt<160, detail::NodeIDTag>;
|
||||
|
||||
/** MPTID is a 192-bit value representing MPT Issuance ID,
|
||||
* which is a concatenation of a 32-bit sequence (big endian)
|
||||
* and a 160-bit account */
|
||||
using MPTID = BaseUint<192>;
|
||||
using MPTID = BaseUInt<192>;
|
||||
|
||||
/** Domain is a 256-bit hash representing a specific domain. */
|
||||
using Domain = BaseUint<256>;
|
||||
using Domain = BaseUInt<256>;
|
||||
|
||||
/** XRP currency. */
|
||||
Currency const&
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace xrpl {
|
||||
|
||||
/** Represents an active connection. */
|
||||
template <class Handler, class Impl>
|
||||
class BaseHTTPPeer : public IoList::Work, public Session
|
||||
class BaseHTTPPeer : public IOList::Work, public Session
|
||||
{
|
||||
protected:
|
||||
using clock_type = std::chrono::system_clock;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace xrpl {
|
||||
|
||||
// Common part of all peers
|
||||
template <class Handler, class Impl>
|
||||
class BasePeer : public IoList::Work
|
||||
class BasePeer : public IOList::Work
|
||||
{
|
||||
protected:
|
||||
using clock_type = std::chrono::system_clock;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace xrpl {
|
||||
|
||||
/** A listening socket. */
|
||||
template <class Handler>
|
||||
class Door : public IoList::Work, public std::enable_shared_from_this<Door<Handler>>
|
||||
class Door : public IOList::Work, public std::enable_shared_from_this<Door<Handler>>
|
||||
{
|
||||
private:
|
||||
using clock_type = std::chrono::steady_clock;
|
||||
@@ -53,7 +53,7 @@ private:
|
||||
using stream_type = boost::beast::tcp_stream;
|
||||
|
||||
// Detects SSL on a socket
|
||||
class Detector : public IoList::Work, public std::enable_shared_from_this<Detector>
|
||||
class Detector : public IOList::Work, public std::enable_shared_from_this<Detector>
|
||||
{
|
||||
private:
|
||||
Port const& port_;
|
||||
|
||||
@@ -78,7 +78,7 @@ private:
|
||||
int high_ = 0;
|
||||
std::array<std::size_t, 64> hist_{};
|
||||
|
||||
IoList ios_;
|
||||
IOList ios_;
|
||||
|
||||
public:
|
||||
ServerImpl(Handler& handler, boost::asio::io_context& ioContext, beast::Journal journal);
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
void
|
||||
close() override;
|
||||
|
||||
IoList&
|
||||
IOList&
|
||||
ios()
|
||||
{
|
||||
return ios_;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace xrpl {
|
||||
|
||||
/** Manages a set of objects performing asynchronous I/O. */
|
||||
class IoList final
|
||||
class IOList final
|
||||
{
|
||||
public:
|
||||
class Work
|
||||
@@ -21,8 +21,8 @@ public:
|
||||
void
|
||||
destroy();
|
||||
|
||||
friend class IoList;
|
||||
IoList* ios_ = nullptr;
|
||||
friend class IOList;
|
||||
IOList* ios_ = nullptr;
|
||||
|
||||
public:
|
||||
virtual ~Work()
|
||||
@@ -30,13 +30,13 @@ public:
|
||||
destroy();
|
||||
}
|
||||
|
||||
/** Return the IoList associated with the work.
|
||||
/** Return the IOList associated with the work.
|
||||
|
||||
Requirements:
|
||||
The call to IoList::emplace to
|
||||
The call to IOList::emplace to
|
||||
create the work has already returned.
|
||||
*/
|
||||
IoList&
|
||||
IOList&
|
||||
ios()
|
||||
{
|
||||
return *ios_;
|
||||
@@ -59,17 +59,17 @@ private:
|
||||
std::function<void(void)> f_;
|
||||
|
||||
public:
|
||||
IoList() = default;
|
||||
IOList() = default;
|
||||
|
||||
/** Destroy the list.
|
||||
|
||||
Effects:
|
||||
Closes the IoList if it was not previously
|
||||
Closes the IOList if it was not previously
|
||||
closed. No finisher is invoked in this case.
|
||||
|
||||
Blocks until all work is destroyed.
|
||||
*/
|
||||
~IoList()
|
||||
~IOList()
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
@@ -159,7 +159,7 @@ public:
|
||||
|
||||
template <class>
|
||||
void
|
||||
IoList::Work::destroy()
|
||||
IOList::Work::destroy()
|
||||
{
|
||||
if (!ios_)
|
||||
return;
|
||||
@@ -179,7 +179,7 @@ IoList::Work::destroy()
|
||||
|
||||
template <class>
|
||||
void
|
||||
IoList::destroy()
|
||||
IOList::destroy()
|
||||
{
|
||||
close();
|
||||
join();
|
||||
@@ -187,9 +187,9 @@ IoList::destroy()
|
||||
|
||||
template <class T, class... Args>
|
||||
std::shared_ptr<T>
|
||||
IoList::emplace(Args&&... args)
|
||||
IOList::emplace(Args&&... args)
|
||||
{
|
||||
static_assert(std::is_base_of_v<Work, T>, "T must derive from IoList::Work");
|
||||
static_assert(std::is_base_of_v<Work, T>, "T must derive from IOList::Work");
|
||||
if (closed_)
|
||||
return nullptr;
|
||||
auto sp = std::make_shared<T>(std::forward<Args>(args)...);
|
||||
@@ -211,7 +211,7 @@ IoList::emplace(Args&&... args)
|
||||
|
||||
template <class Finisher>
|
||||
void
|
||||
IoList::close(Finisher&& f)
|
||||
IOList::close(Finisher&& f)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_);
|
||||
if (closed_)
|
||||
@@ -237,7 +237,7 @@ IoList::close(Finisher&& f)
|
||||
|
||||
template <class>
|
||||
void
|
||||
IoList::join()
|
||||
IOList::join()
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_);
|
||||
cv_.wait(lock, [&] { return closed_ && n_ == 0; });
|
||||
|
||||
@@ -624,7 +624,7 @@ private:
|
||||
|
||||
inline SHAMap::ConstIterator::ConstIterator(SHAMap const* map) : map_(map)
|
||||
{
|
||||
XRPL_ASSERT(map_, "xrpl::SHAMap::const_iterator::const_iterator : non-null input");
|
||||
XRPL_ASSERT(map_, "xrpl::SHAMap::ConstIterator::ConstIterator : non-null input");
|
||||
|
||||
if (auto temp = map_->peekFirstItem(stack_))
|
||||
item_ = temp->peekItem().get();
|
||||
|
||||
@@ -139,7 +139,7 @@ inline boost::intrusive_ptr<SHAMapItem>
|
||||
makeShamapitem(uint256 const& tag, Slice data)
|
||||
{
|
||||
XRPL_ASSERT(
|
||||
data.size() <= megabytes<std::size_t>(16), "xrpl::make_shamapitem : maximum input size");
|
||||
data.size() <= megabytes<std::size_t>(16), "xrpl::makeShamapitem : maximum input size");
|
||||
|
||||
// NOLINTNEXTLINE(misc-const-correctness)
|
||||
std::uint8_t* raw = detail::gSlabber.allocate(data.size());
|
||||
|
||||
Reference in New Issue
Block a user