mirror of
https://github.com/Xahau/xahaud.git
synced 2026-01-17 13:15:15 +00:00
Compare commits
5 Commits
strict-bui
...
multiple_t
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1343056df | ||
|
|
0e818fc0f4 | ||
|
|
f5705fa6db | ||
|
|
d921c87c88 | ||
|
|
7b94d3d99d |
@@ -433,17 +433,13 @@ target_sources (rippled PRIVATE
|
||||
src/ripple/app/tx/impl/CancelOffer.cpp
|
||||
src/ripple/app/tx/impl/CashCheck.cpp
|
||||
src/ripple/app/tx/impl/Change.cpp
|
||||
src/ripple/app/tx/impl/ClaimReward.cpp
|
||||
src/ripple/app/tx/impl/CreateCheck.cpp
|
||||
src/ripple/app/tx/impl/CreateOffer.cpp
|
||||
src/ripple/app/tx/impl/CreateTicket.cpp
|
||||
src/ripple/app/tx/impl/DeleteAccount.cpp
|
||||
src/ripple/app/tx/impl/DepositPreauth.cpp
|
||||
src/ripple/app/tx/impl/Escrow.cpp
|
||||
src/ripple/app/tx/impl/GenesisMint.cpp
|
||||
src/ripple/app/tx/impl/Import.cpp
|
||||
src/ripple/app/tx/impl/InvariantCheck.cpp
|
||||
src/ripple/app/tx/impl/Invoke.cpp
|
||||
src/ripple/app/tx/impl/NFTokenAcceptOffer.cpp
|
||||
src/ripple/app/tx/impl/NFTokenBurn.cpp
|
||||
src/ripple/app/tx/impl/NFTokenCancelOffer.cpp
|
||||
@@ -452,10 +448,14 @@ target_sources (rippled PRIVATE
|
||||
src/ripple/app/tx/impl/OfferStream.cpp
|
||||
src/ripple/app/tx/impl/PayChan.cpp
|
||||
src/ripple/app/tx/impl/Payment.cpp
|
||||
src/ripple/app/tx/impl/Remit.cpp
|
||||
src/ripple/app/tx/impl/SetAccount.cpp
|
||||
src/ripple/app/tx/impl/SetHook.cpp
|
||||
src/ripple/app/tx/impl/SetRegularKey.cpp
|
||||
src/ripple/app/tx/impl/SetHook.cpp
|
||||
src/ripple/app/tx/impl/ClaimReward.cpp
|
||||
src/ripple/app/tx/impl/GenesisMint.cpp
|
||||
src/ripple/app/tx/impl/Import.cpp
|
||||
src/ripple/app/tx/impl/Invoke.cpp
|
||||
src/ripple/app/tx/impl/Remit.cpp
|
||||
src/ripple/app/tx/impl/SetSignerList.cpp
|
||||
src/ripple/app/tx/impl/SetTrust.cpp
|
||||
src/ripple/app/tx/impl/SignerEntries.cpp
|
||||
|
||||
@@ -53,7 +53,7 @@ Loop: test.app test.jtx
|
||||
test.app > test.jtx
|
||||
|
||||
Loop: test.app test.rpc
|
||||
test.rpc ~= test.app
|
||||
test.rpc == test.app
|
||||
|
||||
Loop: test.jtx test.toplevel
|
||||
test.toplevel > test.jtx
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
#include <ripple/app/hook/applyHook.h>
|
||||
#include <ripple/app/ledger/OpenLedger.h>
|
||||
#include <ripple/app/ledger/TransactionMaster.h>
|
||||
#include <ripple/app/misc/HashRouter.h>
|
||||
#include <ripple/app/misc/NetworkOPs.h>
|
||||
#include <ripple/app/misc/Transaction.h>
|
||||
#include <ripple/app/misc/TxQ.h>
|
||||
#include <ripple/app/tx/impl/Import.h>
|
||||
#include <ripple/app/tx/impl/details/NFTokenUtils.h>
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/basics/Slice.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/TxFlags.h>
|
||||
#include <ripple/protocol/st.h>
|
||||
#include <ripple/protocol/tokens.h>
|
||||
#include <boost/multiprecision/cpp_dec_float.hpp>
|
||||
#include <any>
|
||||
|
||||
@@ -58,12 +58,15 @@ LedgerHistory::insert(std::shared_ptr<Ledger const> ledger, bool validated)
|
||||
|
||||
assert(ledger->stateMap().getHash().isNonZero());
|
||||
|
||||
std::unique_lock sl(m_ledgers_by_hash.peekMutex());
|
||||
std::unique_lock sl(m_ledgers_by_hash.peekMutex(ledger->info().hash));
|
||||
|
||||
const bool alreadyHad = m_ledgers_by_hash.canonicalize_replace_cache(
|
||||
ledger->info().hash, ledger);
|
||||
if (validated)
|
||||
{
|
||||
std::unique_lock<std::shared_mutex> lock(mLedgersByIndexMutex);
|
||||
mLedgersByIndex[ledger->info().seq] = ledger->info().hash;
|
||||
}
|
||||
|
||||
return alreadyHad;
|
||||
}
|
||||
@@ -71,7 +74,7 @@ LedgerHistory::insert(std::shared_ptr<Ledger const> ledger, bool validated)
|
||||
LedgerHash
|
||||
LedgerHistory::getLedgerHash(LedgerIndex index)
|
||||
{
|
||||
std::unique_lock sl(m_ledgers_by_hash.peekMutex());
|
||||
std::unique_lock<std::shared_mutex> lock(mLedgersByIndexMutex);
|
||||
auto it = mLedgersByIndex.find(index);
|
||||
|
||||
if (it != mLedgersByIndex.end())
|
||||
@@ -84,13 +87,13 @@ std::shared_ptr<Ledger const>
|
||||
LedgerHistory::getLedgerBySeq(LedgerIndex index)
|
||||
{
|
||||
{
|
||||
std::unique_lock sl(m_ledgers_by_hash.peekMutex());
|
||||
std::unique_lock<std::shared_mutex> lock(mLedgersByIndexMutex);
|
||||
|
||||
auto it = mLedgersByIndex.find(index);
|
||||
|
||||
if (it != mLedgersByIndex.end())
|
||||
{
|
||||
uint256 hash = it->second;
|
||||
sl.unlock();
|
||||
return getLedgerByHash(hash);
|
||||
}
|
||||
}
|
||||
@@ -104,11 +107,17 @@ LedgerHistory::getLedgerBySeq(LedgerIndex index)
|
||||
|
||||
{
|
||||
// Add this ledger to the local tracking by index
|
||||
std::unique_lock sl(m_ledgers_by_hash.peekMutex());
|
||||
{
|
||||
std::unique_lock sl(m_ledgers_by_hash.peekMutex(ret->info().hash));
|
||||
assert(ret->isImmutable());
|
||||
m_ledgers_by_hash.canonicalize_replace_client(
|
||||
ret->info().hash, ret);
|
||||
}
|
||||
|
||||
assert(ret->isImmutable());
|
||||
m_ledgers_by_hash.canonicalize_replace_client(ret->info().hash, ret);
|
||||
mLedgersByIndex[ret->info().seq] = ret->info().hash;
|
||||
{
|
||||
std::unique_lock<std::shared_mutex> lock(mLedgersByIndexMutex);
|
||||
mLedgersByIndex[ret->info().seq] = ret->info().hash;
|
||||
}
|
||||
return (ret->info().seq == index) ? ret : nullptr;
|
||||
}
|
||||
}
|
||||
@@ -440,7 +449,7 @@ LedgerHistory::builtLedger(
|
||||
LedgerHash hash = ledger->info().hash;
|
||||
assert(!hash.isZero());
|
||||
|
||||
std::unique_lock sl(m_consensus_validated.peekMutex());
|
||||
std::unique_lock sl(m_consensus_validated.peekMutex(index));
|
||||
|
||||
auto entry = std::make_shared<cv_entry>();
|
||||
m_consensus_validated.canonicalize_replace_client(index, entry);
|
||||
@@ -480,7 +489,7 @@ LedgerHistory::validatedLedger(
|
||||
LedgerHash hash = ledger->info().hash;
|
||||
assert(!hash.isZero());
|
||||
|
||||
std::unique_lock sl(m_consensus_validated.peekMutex());
|
||||
std::unique_lock sl(m_consensus_validated.peekMutex(index));
|
||||
|
||||
auto entry = std::make_shared<cv_entry>();
|
||||
m_consensus_validated.canonicalize_replace_client(index, entry);
|
||||
@@ -515,7 +524,7 @@ LedgerHistory::validatedLedger(
|
||||
bool
|
||||
LedgerHistory::fixIndex(LedgerIndex ledgerIndex, LedgerHash const& ledgerHash)
|
||||
{
|
||||
std::unique_lock sl(m_ledgers_by_hash.peekMutex());
|
||||
std::unique_lock<std::shared_mutex> lock(mLedgersByIndexMutex);
|
||||
auto it = mLedgersByIndex.find(ledgerIndex);
|
||||
|
||||
if ((it != mLedgersByIndex.end()) && (it->second != ledgerHash))
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <ripple/protocol/RippleLedgerHash.h>
|
||||
|
||||
#include <optional>
|
||||
#include <shared_mutex>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -150,6 +151,7 @@ private:
|
||||
|
||||
// Maps ledger indexes to the corresponding hash.
|
||||
std::map<LedgerIndex, LedgerHash> mLedgersByIndex; // validated ledgers
|
||||
std::shared_mutex mLedgersByIndexMutex;
|
||||
|
||||
beast::Journal j_;
|
||||
};
|
||||
|
||||
@@ -19,9 +19,7 @@
|
||||
|
||||
#include <ripple/app/consensus/RCLValidations.h>
|
||||
#include <ripple/app/ledger/Ledger.h>
|
||||
#include <ripple/app/main/Application.h>
|
||||
#include <ripple/app/misc/NegativeUNLVote.h>
|
||||
#include <ripple/json/to_string.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
std::uint32_t minimumTxnInLedgerSA = 1000;
|
||||
/// Number of transactions per ledger that fee escalation "works
|
||||
/// towards".
|
||||
std::uint32_t targetTxnInLedger = 256;
|
||||
std::uint32_t targetTxnInLedger = 1000;
|
||||
/** Optional maximum allowed value of transactions per ledger before
|
||||
fee escalation kicks in. By default, the maximum is an emergent
|
||||
property of network, validator, and consensus performance. This
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <ripple/ledger/View.h>
|
||||
#include <ripple/protocol/Feature.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/st.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
|
||||
@@ -24,15 +24,12 @@
|
||||
#include <ripple/basics/base64.h>
|
||||
#include <ripple/json/json_reader.h>
|
||||
#include <ripple/json/json_value.h>
|
||||
#include <ripple/json/to_string.h>
|
||||
#include <ripple/ledger/View.h>
|
||||
#include <ripple/protocol/Feature.h>
|
||||
#include <ripple/protocol/Import.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/PublicKey.h>
|
||||
#include <ripple/protocol/STTx.h>
|
||||
#include <ripple/protocol/STValidation.h>
|
||||
#include <ripple/protocol/st.h>
|
||||
#include <algorithm>
|
||||
#include <charconv>
|
||||
#include <iostream>
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <ripple/ledger/View.h>
|
||||
#include <ripple/protocol/Feature.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/st.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
#include <ripple/ledger/View.h>
|
||||
#include <ripple/protocol/Feature.h>
|
||||
#include <ripple/protocol/Indexes.h>
|
||||
#include <ripple/protocol/TxFlags.h>
|
||||
#include <ripple/protocol/st.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
TxConsequences
|
||||
|
||||
@@ -153,10 +153,8 @@ SetSignerList::preCompute()
|
||||
// NOTE: This way of computing the OwnerCount associated with a SignerList
|
||||
// is valid until the featureMultiSignReserve amendment passes. Once it
|
||||
// passes then just 1 OwnerCount is associated with a SignerList.
|
||||
int
|
||||
SetSignerList::signerCountBasedOwnerCountDelta(
|
||||
std::size_t entryCount,
|
||||
Rules const& rules)
|
||||
static int
|
||||
signerCountBasedOwnerCountDelta(std::size_t entryCount, Rules const& rules)
|
||||
{
|
||||
// We always compute the full change in OwnerCount, taking into account:
|
||||
// o The fact that we're adding/removing a SignerList and
|
||||
@@ -178,8 +176,8 @@ SetSignerList::signerCountBasedOwnerCountDelta(
|
||||
return 2 + static_cast<int>(entryCount);
|
||||
}
|
||||
|
||||
TER
|
||||
SetSignerList::removeSignersFromLedger(
|
||||
static TER
|
||||
removeSignersFromLedger(
|
||||
Application& app,
|
||||
ApplyView& view,
|
||||
Keylet const& accountKeylet,
|
||||
|
||||
@@ -71,18 +71,6 @@ public:
|
||||
AccountID const& account,
|
||||
beast::Journal j);
|
||||
|
||||
static TER
|
||||
removeSignersFromLedger(
|
||||
Application& app,
|
||||
ApplyView& view,
|
||||
Keylet const& accountKeylet,
|
||||
Keylet const& ownerDirKeylet,
|
||||
Keylet const& signerListKeylet,
|
||||
beast::Journal j);
|
||||
|
||||
static int
|
||||
signerCountBasedOwnerCountDelta(std::size_t entryCount, Rules const& rules);
|
||||
|
||||
private:
|
||||
static void
|
||||
writeSignersToSLE(
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <ripple/app/tx/impl/CancelOffer.h>
|
||||
#include <ripple/app/tx/impl/CashCheck.h>
|
||||
#include <ripple/app/tx/impl/Change.h>
|
||||
#include <ripple/app/tx/impl/ClaimReward.h>
|
||||
#include <ripple/app/tx/impl/CreateCheck.h>
|
||||
#include <ripple/app/tx/impl/CreateOffer.h>
|
||||
#include <ripple/app/tx/impl/CreateTicket.h>
|
||||
@@ -40,14 +39,12 @@
|
||||
#include <ripple/app/tx/impl/NFTokenMint.h>
|
||||
#include <ripple/app/tx/impl/PayChan.h>
|
||||
#include <ripple/app/tx/impl/Payment.h>
|
||||
#include <ripple/app/tx/impl/Remit.h>
|
||||
#include <ripple/app/tx/impl/SetAccount.h>
|
||||
#include <ripple/app/tx/impl/SetHook.h>
|
||||
#include <ripple/app/tx/impl/SetRegularKey.h>
|
||||
#include <ripple/app/tx/impl/SetSignerList.h>
|
||||
#include <ripple/app/tx/impl/SetTrust.h>
|
||||
#include <ripple/app/tx/impl/URIToken.h>
|
||||
#include <ripple/app/tx/impl/XahauGenesis.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ template <
|
||||
class Hash = hardened_hash<>,
|
||||
class KeyEqual = std::equal_to<Key>,
|
||||
class Mutex = std::recursive_mutex>
|
||||
class TaggedCache
|
||||
class TaggedCacheSingle
|
||||
{
|
||||
public:
|
||||
using mutex_type = Mutex;
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
using clock_type = beast::abstract_clock<std::chrono::steady_clock>;
|
||||
|
||||
public:
|
||||
TaggedCache(
|
||||
TaggedCacheSingle(
|
||||
std::string const& name,
|
||||
int size,
|
||||
clock_type::duration expiration,
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
, m_clock(clock)
|
||||
, m_stats(
|
||||
name,
|
||||
std::bind(&TaggedCache::collect_metrics, this),
|
||||
std::bind(&TaggedCacheSingle::collect_metrics, this),
|
||||
collector)
|
||||
, m_name(name)
|
||||
, m_target_size(size)
|
||||
@@ -258,7 +258,7 @@ public:
|
||||
// At this point allStuffToSweep will go out of scope outside the lock
|
||||
// and decrement the reference count on each strong pointer.
|
||||
JLOG(m_journal.debug())
|
||||
<< m_name << " TaggedCache sweep lock duration "
|
||||
<< m_name << " TaggedCacheSingle sweep lock duration "
|
||||
<< std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
.count()
|
||||
@@ -715,7 +715,7 @@ private:
|
||||
if (mapRemovals || cacheRemovals)
|
||||
{
|
||||
JLOG(m_journal.debug())
|
||||
<< "TaggedCache partition sweep " << m_name
|
||||
<< "TaggedCacheSingle partition sweep " << m_name
|
||||
<< ": cache = " << partition.size() << "-" << cacheRemovals
|
||||
<< ", map-=" << mapRemovals;
|
||||
}
|
||||
@@ -762,7 +762,7 @@ private:
|
||||
if (mapRemovals || cacheRemovals)
|
||||
{
|
||||
JLOG(m_journal.debug())
|
||||
<< "TaggedCache partition sweep " << m_name
|
||||
<< "TaggedCacheSingle partition sweep " << m_name
|
||||
<< ": cache = " << partition.size() << "-" << cacheRemovals
|
||||
<< ", map-=" << mapRemovals;
|
||||
}
|
||||
@@ -793,6 +793,253 @@ private:
|
||||
std::uint64_t m_misses;
|
||||
};
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
template <
|
||||
class Key,
|
||||
class T,
|
||||
bool IsKeyCache = false,
|
||||
class Hash = hardened_hash<>,
|
||||
class KeyEqual = std::equal_to<Key>,
|
||||
class Mutex = std::recursive_mutex>
|
||||
class TaggedCache
|
||||
{
|
||||
private:
|
||||
static constexpr size_t NUM_CACHES = 16;
|
||||
|
||||
using CacheType =
|
||||
TaggedCacheSingle<Key, T, IsKeyCache, Hash, KeyEqual, Mutex>;
|
||||
std::array<std::unique_ptr<CacheType>, NUM_CACHES> caches;
|
||||
|
||||
// Helper function to get the index of the cache based on the key
|
||||
size_t
|
||||
getCacheIndex(const Key& key) const
|
||||
{
|
||||
// Assuming Key can be hashed
|
||||
size_t hash = Hash{}(key);
|
||||
return hash & 0xF; // Use the least significant nibble
|
||||
}
|
||||
|
||||
public:
|
||||
using mutex_type = Mutex;
|
||||
using key_type = Key;
|
||||
using mapped_type = T;
|
||||
using clock_type = beast::abstract_clock<std::chrono::steady_clock>;
|
||||
|
||||
TaggedCache(
|
||||
std::string const& name,
|
||||
int size,
|
||||
clock_type::duration expiration,
|
||||
clock_type& clock,
|
||||
beast::Journal journal,
|
||||
beast::insight::Collector::ptr const& collector =
|
||||
beast::insight::NullCollector::New())
|
||||
{
|
||||
for (size_t i = 0; i < NUM_CACHES; ++i)
|
||||
{
|
||||
caches[i] = std::make_unique<CacheType>(
|
||||
name + "_" + std::to_string(i),
|
||||
size / NUM_CACHES, // Distribute size across caches
|
||||
expiration,
|
||||
clock,
|
||||
journal,
|
||||
collector);
|
||||
}
|
||||
}
|
||||
|
||||
// Implement all public methods of TaggedCache, delegating to the
|
||||
// appropriate cache instance
|
||||
|
||||
clock_type&
|
||||
clock()
|
||||
{
|
||||
return caches[0]->clock(); // All caches share the same clock
|
||||
}
|
||||
|
||||
std::size_t
|
||||
size() const
|
||||
{
|
||||
std::size_t total = 0;
|
||||
for (const auto& cache : caches)
|
||||
total += cache->size();
|
||||
return total;
|
||||
}
|
||||
|
||||
void
|
||||
setTargetSize(int s)
|
||||
{
|
||||
int sizePerCache = s / NUM_CACHES;
|
||||
for (auto& cache : caches)
|
||||
cache->setTargetSize(sizePerCache);
|
||||
}
|
||||
|
||||
clock_type::duration
|
||||
getTargetAge() const
|
||||
{
|
||||
return caches[0]
|
||||
->getTargetAge(); // All caches share the same target age
|
||||
}
|
||||
|
||||
void
|
||||
setTargetAge(clock_type::duration s)
|
||||
{
|
||||
for (auto& cache : caches)
|
||||
cache->setTargetAge(s);
|
||||
}
|
||||
|
||||
int
|
||||
getCacheSize() const
|
||||
{
|
||||
int total = 0;
|
||||
for (const auto& cache : caches)
|
||||
total += cache->getCacheSize();
|
||||
return total;
|
||||
}
|
||||
|
||||
int
|
||||
getTrackSize() const
|
||||
{
|
||||
int total = 0;
|
||||
for (const auto& cache : caches)
|
||||
total += cache->getTrackSize();
|
||||
return total;
|
||||
}
|
||||
|
||||
float
|
||||
getHitRate()
|
||||
{
|
||||
float totalHitRate = 0;
|
||||
for (const auto& cache : caches)
|
||||
totalHitRate += cache->getHitRate();
|
||||
return totalHitRate / NUM_CACHES;
|
||||
}
|
||||
|
||||
void
|
||||
clear()
|
||||
{
|
||||
for (auto& cache : caches)
|
||||
cache->clear();
|
||||
}
|
||||
|
||||
void
|
||||
reset()
|
||||
{
|
||||
for (auto& cache : caches)
|
||||
cache->reset();
|
||||
}
|
||||
|
||||
template <class KeyComparable>
|
||||
bool
|
||||
touch_if_exists(KeyComparable const& key)
|
||||
{
|
||||
return caches[getCacheIndex(key)]->touch_if_exists(key);
|
||||
}
|
||||
|
||||
void
|
||||
sweep()
|
||||
{
|
||||
for (auto& cache : caches)
|
||||
cache->sweep();
|
||||
}
|
||||
|
||||
bool
|
||||
del(const key_type& key, bool valid)
|
||||
{
|
||||
return caches[getCacheIndex(key)]->del(key, valid);
|
||||
}
|
||||
|
||||
bool
|
||||
canonicalize(
|
||||
const key_type& key,
|
||||
std::shared_ptr<T>& data,
|
||||
std::function<bool(std::shared_ptr<T> const&)>&& replace)
|
||||
{
|
||||
return caches[getCacheIndex(key)]->canonicalize(
|
||||
key, data, std::move(replace));
|
||||
}
|
||||
|
||||
bool
|
||||
canonicalize_replace_cache(
|
||||
const key_type& key,
|
||||
std::shared_ptr<T> const& data)
|
||||
{
|
||||
return caches[getCacheIndex(key)]->canonicalize_replace_cache(
|
||||
key, data);
|
||||
}
|
||||
|
||||
bool
|
||||
canonicalize_replace_client(const key_type& key, std::shared_ptr<T>& data)
|
||||
{
|
||||
return caches[getCacheIndex(key)]->canonicalize_replace_client(
|
||||
key, data);
|
||||
}
|
||||
|
||||
std::shared_ptr<T>
|
||||
fetch(const key_type& key)
|
||||
{
|
||||
return caches[getCacheIndex(key)]->fetch(key);
|
||||
}
|
||||
|
||||
template <class ReturnType = bool>
|
||||
auto
|
||||
insert(key_type const& key, T const& value)
|
||||
-> std::enable_if_t<!IsKeyCache, ReturnType>
|
||||
{
|
||||
return caches[getCacheIndex(key)]->insert(key, value);
|
||||
}
|
||||
|
||||
template <class ReturnType = bool>
|
||||
auto
|
||||
insert(key_type const& key) -> std::enable_if_t<IsKeyCache, ReturnType>
|
||||
{
|
||||
return caches[getCacheIndex(key)]->insert(key);
|
||||
}
|
||||
|
||||
bool
|
||||
retrieve(const key_type& key, T& data)
|
||||
{
|
||||
return caches[getCacheIndex(key)]->retrieve(key, data);
|
||||
}
|
||||
|
||||
mutex_type&
|
||||
peekMutex(key_type const& key)
|
||||
{
|
||||
return caches[getCacheIndex(key)]->peekMutex();
|
||||
}
|
||||
|
||||
std::vector<key_type>
|
||||
getKeys() const
|
||||
{
|
||||
std::vector<key_type> allKeys;
|
||||
for (const auto& cache : caches)
|
||||
{
|
||||
auto keys = cache->getKeys();
|
||||
allKeys.insert(allKeys.end(), keys.begin(), keys.end());
|
||||
}
|
||||
return allKeys;
|
||||
}
|
||||
|
||||
double
|
||||
rate() const
|
||||
{
|
||||
double totalRate = 0;
|
||||
for (const auto& cache : caches)
|
||||
totalRate += cache->rate();
|
||||
return totalRate / NUM_CACHES;
|
||||
}
|
||||
|
||||
template <class Handler>
|
||||
std::shared_ptr<T>
|
||||
fetch(key_type const& digest, Handler const& h)
|
||||
{
|
||||
return caches[getCacheIndex(digest)]->fetch(digest, h);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,7 +30,7 @@ mulDiv(std::uint64_t value, std::uint64_t mul, std::uint64_t div)
|
||||
{
|
||||
using namespace boost::multiprecision;
|
||||
|
||||
boost::multiprecision::uint128_t result;
|
||||
uint128_t result;
|
||||
result = multiply(result, value, mul);
|
||||
|
||||
result /= div;
|
||||
|
||||
@@ -240,7 +240,7 @@ public:
|
||||
bool LEDGER_REPLAY = false;
|
||||
|
||||
// Work queue limits
|
||||
int MAX_TRANSACTIONS = 250;
|
||||
int MAX_TRANSACTIONS = 1000;
|
||||
static constexpr int MAX_JOB_QUEUE_TX = 1000;
|
||||
static constexpr int MIN_JOB_QUEUE_TX = 100;
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <ripple/basics/contract.h>
|
||||
#include <ripple/ledger/detail/ApplyViewBase.h>
|
||||
#include <ripple/protocol/STAccount.h>
|
||||
|
||||
namespace ripple {
|
||||
namespace detail {
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <ripple/app/main/Application.h>
|
||||
#include <ripple/app/misc/NetworkOPs.h>
|
||||
#include <ripple/app/reporting/P2pProxy.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
#include <ripple/rpc/Context.h>
|
||||
#include <ripple/rpc/Role.h>
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/app/ledger/LedgerMaster.h>
|
||||
#include <ripple/protocol/Feature.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
#include <test/jtx.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/app/tx/impl/XahauGenesis.h>
|
||||
#include <ripple/protocol/Feature.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
#include <optional>
|
||||
#include <test/jtx.h>
|
||||
|
||||
@@ -94,7 +94,7 @@ struct GenesisMint_test : public beast::unit_test::suite
|
||||
using namespace jtx;
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
Env env{*this, envconfig(), features};
|
||||
Env env{*this, envconfig(), features, nullptr};
|
||||
auto const alice = Account("alice");
|
||||
auto const bob = Account("bob");
|
||||
auto const invoker = Account("invoker");
|
||||
@@ -133,7 +133,11 @@ struct GenesisMint_test : public beast::unit_test::suite
|
||||
using namespace jtx;
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
Env env{*this, envconfig(), features};
|
||||
Env env{*this, envconfig(), features, nullptr};
|
||||
// Env env{*this, envconfig(), features, nullptr,
|
||||
// // beast::severities::kWarning
|
||||
// beast::severities::kTrace
|
||||
// };
|
||||
auto const alice = Account("alice");
|
||||
auto const bob = Account("bob");
|
||||
auto const invoker = Account("invoker");
|
||||
@@ -635,7 +639,7 @@ struct GenesisMint_test : public beast::unit_test::suite
|
||||
using namespace jtx;
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
Env env{*this, envconfig(), features};
|
||||
Env env{*this, envconfig(), features, nullptr};
|
||||
auto const alice = Account("alice");
|
||||
auto const bob = Account("bob");
|
||||
env.fund(XRP(10000), alice, bob);
|
||||
@@ -657,7 +661,7 @@ struct GenesisMint_test : public beast::unit_test::suite
|
||||
using namespace jtx;
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
Env env{*this, envconfig(), features};
|
||||
Env env{*this, envconfig(), features, nullptr};
|
||||
auto const alice = Account("alice");
|
||||
auto const bob = Account("bob");
|
||||
env.fund(XRP(10000), alice, bob);
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/protocol/jss.h>
|
||||
#include <test/jtx.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -2132,6 +2132,7 @@ struct Remit_test : public beast::unit_test::suite
|
||||
auto const delta = USD(100);
|
||||
env(remit::remit(alice, bob), remit::amts({delta}));
|
||||
env.close();
|
||||
auto xferRate = transferRate(*env.current(), gw);
|
||||
auto const postAlice = env.balance(alice, USD.issue());
|
||||
BEAST_EXPECT(env.balance(bob, USD.issue()) == preBob + delta);
|
||||
BEAST_EXPECT(to_string(postAlice.value()) == tc.result);
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/app/hook/Enum.h>
|
||||
#include <ripple/app/misc/HashRouter.h>
|
||||
#include <ripple/app/misc/TxQ.h>
|
||||
#include <ripple/app/tx/apply.h>
|
||||
@@ -32,13 +31,6 @@
|
||||
namespace ripple {
|
||||
namespace test {
|
||||
|
||||
#define BEAST_REQUIRE(x) \
|
||||
{ \
|
||||
BEAST_EXPECT(!!(x)); \
|
||||
if (!(x)) \
|
||||
return; \
|
||||
}
|
||||
|
||||
struct SetHookTSH_test : public beast::unit_test::suite
|
||||
{
|
||||
private:
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/protocol/jss.h>
|
||||
#include <test/jtx/Env.h>
|
||||
#include <test/jtx/acctdelete.h>
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/protocol/TxFlags.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
#include <test/jtx/escrow.h>
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/basics/StringUtilities.h>
|
||||
#include <ripple/json/json_reader.h>
|
||||
#include <ripple/json/json_writer.h>
|
||||
#include <ripple/protocol/Feature.h>
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/protocol/TxFlags.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
#include <test/jtx/paychan.h>
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <ripple/json/json_value.h>
|
||||
#include <ripple/protocol/STAmount.h>
|
||||
#include <test/jtx/Account.h>
|
||||
#include <test/jtx/Env.h>
|
||||
|
||||
namespace ripple {
|
||||
namespace test {
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <ripple/beast/unit_test.h>
|
||||
#include <ripple/protocol/ErrorCodes.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
#include <test/app/Import_json.h>
|
||||
#include <test/jtx.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <ripple/app/misc/AmendmentTable.h>
|
||||
#include <ripple/beast/unit_test.h>
|
||||
#include <ripple/json/json_reader.h>
|
||||
#include <ripple/protocol/Feature.h>
|
||||
#include <ripple/protocol/jss.h>
|
||||
#include <test/jtx.h>
|
||||
|
||||
Reference in New Issue
Block a user