mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-26 14:45:52 +00:00
@@ -1,7 +1,39 @@
|
|||||||
target_compile_options (clio PUBLIC
|
set(COMPILER_FLAGS
|
||||||
-Wall
|
-Wall
|
||||||
|
-Wcast-align
|
||||||
|
-Wdouble-promotion
|
||||||
|
-Wextra
|
||||||
-Werror
|
-Werror
|
||||||
|
-Wformat=2
|
||||||
|
-Wimplicit-fallthrough
|
||||||
|
-Wmisleading-indentation
|
||||||
-Wno-narrowing
|
-Wno-narrowing
|
||||||
-Wno-deprecated-declarations
|
-Wno-deprecated-declarations
|
||||||
-Wno-dangling-else
|
-Wno-dangling-else
|
||||||
-Wno-unused-but-set-variable)
|
-Wno-unused-but-set-variable
|
||||||
|
-Wnon-virtual-dtor
|
||||||
|
-Wnull-dereference
|
||||||
|
-Wold-style-cast
|
||||||
|
-pedantic
|
||||||
|
-Wpedantic
|
||||||
|
-Wunused
|
||||||
|
)
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
|
list(APPEND COMPILER_FLAGS
|
||||||
|
-Wshadow # gcc is to aggressive with shadowing https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78147
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
list(APPEND COMPILER_FLAGS
|
||||||
|
-Wduplicated-branches
|
||||||
|
-Wduplicated-cond
|
||||||
|
-Wlogical-op
|
||||||
|
-Wuseless-cast
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# See https://github.com/cpp-best-practices/cppbestpractices/blob/master/02-Use_the_Tools_Available.md#gcc--clang for the flags description
|
||||||
|
|
||||||
|
target_compile_options (clio PUBLIC ${COMPILER_FLAGS})
|
||||||
|
|||||||
@@ -649,11 +649,11 @@ public:
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ripple::uint256> keys;
|
std::vector<ripple::uint256> resultKeys;
|
||||||
for (auto [key] : extract<ripple::uint256>(results))
|
for (auto [key] : extract<ripple::uint256>(results))
|
||||||
keys.push_back(key);
|
resultKeys.push_back(key);
|
||||||
|
|
||||||
return keys;
|
return resultKeys;
|
||||||
});
|
});
|
||||||
|
|
||||||
// one of the above errors must have happened
|
// one of the above errors must have happened
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ struct AccountTransactionsData
|
|||||||
std::uint32_t transactionIndex;
|
std::uint32_t transactionIndex;
|
||||||
ripple::uint256 txHash;
|
ripple::uint256 txHash;
|
||||||
|
|
||||||
AccountTransactionsData(ripple::TxMeta& meta, ripple::uint256 const& txHash, beast::Journal& j)
|
AccountTransactionsData(ripple::TxMeta& meta, ripple::uint256 const& txHash)
|
||||||
: accounts(meta.getAffectedAccounts())
|
: accounts(meta.getAffectedAccounts())
|
||||||
, ledgerSequence(meta.getLgrSeq())
|
, ledgerSequence(meta.getLgrSeq())
|
||||||
, transactionIndex(meta.getIndex())
|
, transactionIndex(meta.getIndex())
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ LedgerCache::getObjectHitRate() const
|
|||||||
{
|
{
|
||||||
if (!objectReqCounter_)
|
if (!objectReqCounter_)
|
||||||
return 1;
|
return 1;
|
||||||
return ((float)objectHitCounter_) / objectReqCounter_;
|
return static_cast<float>(objectHitCounter_) / objectReqCounter_;
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
@@ -154,7 +154,7 @@ LedgerCache::getSuccessorHitRate() const
|
|||||||
{
|
{
|
||||||
if (!successorReqCounter_)
|
if (!successorReqCounter_)
|
||||||
return 1;
|
return 1;
|
||||||
return ((float)successorHitCounter_) / successorReqCounter_;
|
return static_cast<float>(successorHitCounter_) / successorReqCounter_;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace data
|
} // namespace data
|
||||||
|
|||||||
@@ -118,6 +118,8 @@ struct TransactionsCursor
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TransactionsCursor(TransactionsCursor const&) = default;
|
||||||
|
|
||||||
TransactionsCursor&
|
TransactionsCursor&
|
||||||
operator=(TransactionsCursor const&) = default;
|
operator=(TransactionsCursor const&) = default;
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ struct Settings
|
|||||||
struct ContactPoints
|
struct ContactPoints
|
||||||
{
|
{
|
||||||
std::string contactPoints = "127.0.0.1"; // defaults to localhost
|
std::string contactPoints = "127.0.0.1"; // defaults to localhost
|
||||||
std::optional<uint16_t> port;
|
std::optional<uint16_t> port = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public:
|
|||||||
}
|
}
|
||||||
ManagedObject(ManagedObject&&) = default;
|
ManagedObject(ManagedObject&&) = default;
|
||||||
|
|
||||||
operator Managed* const() const
|
operator Managed*() const
|
||||||
{
|
{
|
||||||
return ptr_.get();
|
return ptr_.get();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,6 +142,13 @@ ETLService::monitor()
|
|||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
nextSequence = publishNextSequence(nextSequence);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
ETLService::publishNextSequence(uint32_t nextSequence)
|
||||||
|
{
|
||||||
if (auto rng = backend_->hardFetchLedgerRangeNoThrow(); rng && rng->maxSequence >= nextSequence)
|
if (auto rng = backend_->hardFetchLedgerRangeNoThrow(); rng && rng->maxSequence >= nextSequence)
|
||||||
{
|
{
|
||||||
ledgerPublisher_.publish(nextSequence, {});
|
ledgerPublisher_.publish(nextSequence, {});
|
||||||
@@ -178,7 +185,7 @@ ETLService::monitor()
|
|||||||
++nextSequence;
|
++nextSequence;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return nextSequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -186,20 +193,28 @@ ETLService::monitorReadOnly()
|
|||||||
{
|
{
|
||||||
LOG(log_.debug()) << "Starting reporting in strict read only mode";
|
LOG(log_.debug()) << "Starting reporting in strict read only mode";
|
||||||
|
|
||||||
|
const auto latestSequenceOpt = [this]() -> std::optional<uint32_t> {
|
||||||
auto rng = backend_->hardFetchLedgerRangeNoThrow();
|
auto rng = backend_->hardFetchLedgerRangeNoThrow();
|
||||||
uint32_t latestSequence;
|
|
||||||
|
|
||||||
if (!rng)
|
if (!rng)
|
||||||
{
|
{
|
||||||
if (auto net = networkValidatedLedgers_->getMostRecent())
|
if (auto net = networkValidatedLedgers_->getMostRecent())
|
||||||
latestSequence = *net;
|
return *net;
|
||||||
else
|
else
|
||||||
return;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
latestSequence = rng->maxSequence;
|
return rng->maxSequence;
|
||||||
}
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
|
if (!latestSequenceOpt.has_value())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t latestSequence = *latestSequenceOpt;
|
||||||
|
|
||||||
cacheLoader_.load(latestSequence);
|
cacheLoader_.load(latestSequence);
|
||||||
latestSequence++;
|
latestSequence++;
|
||||||
|
|||||||
@@ -230,6 +230,15 @@ private:
|
|||||||
void
|
void
|
||||||
monitor();
|
monitor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Monitor the network for newly validated ledgers and publish them to the ledgers stream
|
||||||
|
*
|
||||||
|
* @param nextSequence the ledger sequence to publish
|
||||||
|
* @return the next ledger sequence to publish
|
||||||
|
*/
|
||||||
|
uint32_t
|
||||||
|
publishNextSequence(uint32_t nextSequence);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Monitor the database for newly written ledgers.
|
* @brief Monitor the database for newly written ledgers.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ LoadBalancer::forwardToRippled(
|
|||||||
std::string const& clientIp,
|
std::string const& clientIp,
|
||||||
boost::asio::yield_context yield) const
|
boost::asio::yield_context yield) const
|
||||||
{
|
{
|
||||||
srand((unsigned)time(0));
|
srand(static_cast<unsigned>(time(0)));
|
||||||
auto sourceIdx = rand() % sources_.size();
|
auto sourceIdx = rand() % sources_.size();
|
||||||
auto numAttempts = 0u;
|
auto numAttempts = 0u;
|
||||||
|
|
||||||
@@ -193,7 +193,7 @@ template <class Func>
|
|||||||
bool
|
bool
|
||||||
LoadBalancer::execute(Func f, uint32_t ledgerSequence)
|
LoadBalancer::execute(Func f, uint32_t ledgerSequence)
|
||||||
{
|
{
|
||||||
srand((unsigned)time(0));
|
srand(static_cast<unsigned>(time(0)));
|
||||||
auto sourceIdx = rand() % sources_.size();
|
auto sourceIdx = rand() % sources_.size();
|
||||||
auto numAttempts = 0;
|
auto numAttempts = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ ProbingSource::make_SSLHooks() noexcept
|
|||||||
return SourceHooks::Action::PROCEED;
|
return SourceHooks::Action::PROCEED;
|
||||||
},
|
},
|
||||||
// onDisconnected
|
// onDisconnected
|
||||||
[this](auto ec) {
|
[this](auto /* ec */) {
|
||||||
std::lock_guard lck(mtx_);
|
std::lock_guard lck(mtx_);
|
||||||
if (currentSrc_)
|
if (currentSrc_)
|
||||||
{
|
{
|
||||||
@@ -189,7 +189,7 @@ ProbingSource::make_PlainHooks() noexcept
|
|||||||
return SourceHooks::Action::PROCEED;
|
return SourceHooks::Action::PROCEED;
|
||||||
},
|
},
|
||||||
// onDisconnected
|
// onDisconnected
|
||||||
[this](auto ec) {
|
[this](auto /* ec */) {
|
||||||
std::lock_guard lck(mtx_);
|
std::lock_guard lck(mtx_);
|
||||||
if (currentSrc_)
|
if (currentSrc_)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ public:
|
|||||||
auto& obj = *(cur_->mutable_ledger_objects()->mutable_objects(i));
|
auto& obj = *(cur_->mutable_ledger_objects()->mutable_objects(i));
|
||||||
if (!more && nextPrefix_ != 0x00)
|
if (!more && nextPrefix_ != 0x00)
|
||||||
{
|
{
|
||||||
if (((unsigned char)obj.key()[0]) >= nextPrefix_)
|
if (static_cast<unsigned char>(obj.key()[0]) >= nextPrefix_)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
cacheUpdates.push_back(
|
cacheUpdates.push_back(
|
||||||
|
|||||||
@@ -107,9 +107,8 @@ public:
|
|||||||
if (maybeNFT)
|
if (maybeNFT)
|
||||||
result.nfTokensData.push_back(*maybeNFT);
|
result.nfTokensData.push_back(*maybeNFT);
|
||||||
|
|
||||||
auto journal = ripple::debugLog();
|
result.accountTxData.emplace_back(txMeta, sttx.getTransactionID());
|
||||||
result.accountTxData.emplace_back(txMeta, sttx.getTransactionID(), journal);
|
std::string keyStr{reinterpret_cast<const char*>(sttx.getTransactionID().data()), 32};
|
||||||
std::string keyStr{(const char*)sttx.getTransactionID().data(), 32};
|
|
||||||
backend_->writeTransaction(
|
backend_->writeTransaction(
|
||||||
std::move(keyStr),
|
std::move(keyStr),
|
||||||
ledger.seq,
|
ledger.seq,
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ try
|
|||||||
auto const handlerProvider = std::make_shared<rpc::detail::ProductionHandlerProvider const>(
|
auto const handlerProvider = std::make_shared<rpc::detail::ProductionHandlerProvider const>(
|
||||||
config, backend, subscriptions, balancer, etl, counters);
|
config, backend, subscriptions, balancer, etl, counters);
|
||||||
auto const rpcEngine = rpc::RPCEngine::make_RPCEngine(
|
auto const rpcEngine = rpc::RPCEngine::make_RPCEngine(
|
||||||
config, backend, subscriptions, balancer, etl, dosGuard, workQueue, counters, handlerProvider);
|
backend, subscriptions, balancer, dosGuard, workQueue, counters, handlerProvider);
|
||||||
|
|
||||||
// Init the web server
|
// Init the web server
|
||||||
auto handler = std::make_shared<web::RPCServerHandler<rpc::RPCEngine, etl::ETLService>>(
|
auto handler = std::make_shared<web::RPCServerHandler<rpc::RPCEngine, etl::ETLService>>(
|
||||||
|
|||||||
@@ -199,6 +199,7 @@ private:
|
|||||||
case ripple::ttOFFER_CREATE:
|
case ripple::ttOFFER_CREATE:
|
||||||
if (tx->isFieldPresent(ripple::sfOfferSequence))
|
if (tx->isFieldPresent(ripple::sfOfferSequence))
|
||||||
return tx->getFieldU32(ripple::sfOfferSequence);
|
return tx->getFieldU32(ripple::sfOfferSequence);
|
||||||
|
[[fallthrough]];
|
||||||
default:
|
default:
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,8 +35,6 @@ make_WsContext(
|
|||||||
string const& clientIp,
|
string const& clientIp,
|
||||||
std::reference_wrapper<APIVersionParser const> apiVersionParser)
|
std::reference_wrapper<APIVersionParser const> apiVersionParser)
|
||||||
{
|
{
|
||||||
using Error = Unexpected<Status>;
|
|
||||||
|
|
||||||
boost::json::value commandValue = nullptr;
|
boost::json::value commandValue = nullptr;
|
||||||
if (!request.contains("command") && request.contains("method"))
|
if (!request.contains("command") && request.contains("method"))
|
||||||
commandValue = request.at("method");
|
commandValue = request.at("method");
|
||||||
@@ -63,8 +61,6 @@ make_HttpContext(
|
|||||||
string const& clientIp,
|
string const& clientIp,
|
||||||
std::reference_wrapper<APIVersionParser const> apiVersionParser)
|
std::reference_wrapper<APIVersionParser const> apiVersionParser)
|
||||||
{
|
{
|
||||||
using Error = Unexpected<Status>;
|
|
||||||
|
|
||||||
if (!request.contains("method"))
|
if (!request.contains("method"))
|
||||||
return Error{{ClioError::rpcCOMMAND_IS_MISSING}};
|
return Error{{ClioError::rpcCOMMAND_IS_MISSING}};
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ public:
|
|||||||
std::shared_ptr<BackendInterface> const& backend,
|
std::shared_ptr<BackendInterface> const& backend,
|
||||||
std::shared_ptr<feed::SubscriptionManager> const& subscriptions,
|
std::shared_ptr<feed::SubscriptionManager> const& subscriptions,
|
||||||
std::shared_ptr<etl::LoadBalancer> const& balancer,
|
std::shared_ptr<etl::LoadBalancer> const& balancer,
|
||||||
std::shared_ptr<etl::ETLService> const& etl,
|
|
||||||
web::DOSGuard const& dosGuard,
|
web::DOSGuard const& dosGuard,
|
||||||
WorkQueue& workQueue,
|
WorkQueue& workQueue,
|
||||||
Counters& counters,
|
Counters& counters,
|
||||||
@@ -101,18 +100,16 @@ public:
|
|||||||
|
|
||||||
static std::shared_ptr<RPCEngineBase>
|
static std::shared_ptr<RPCEngineBase>
|
||||||
make_RPCEngine(
|
make_RPCEngine(
|
||||||
util::Config const& config,
|
|
||||||
std::shared_ptr<BackendInterface> const& backend,
|
std::shared_ptr<BackendInterface> const& backend,
|
||||||
std::shared_ptr<feed::SubscriptionManager> const& subscriptions,
|
std::shared_ptr<feed::SubscriptionManager> const& subscriptions,
|
||||||
std::shared_ptr<etl::LoadBalancer> const& balancer,
|
std::shared_ptr<etl::LoadBalancer> const& balancer,
|
||||||
std::shared_ptr<etl::ETLService> const& etl,
|
|
||||||
web::DOSGuard const& dosGuard,
|
web::DOSGuard const& dosGuard,
|
||||||
WorkQueue& workQueue,
|
WorkQueue& workQueue,
|
||||||
Counters& counters,
|
Counters& counters,
|
||||||
std::shared_ptr<HandlerProvider const> const& handlerProvider)
|
std::shared_ptr<HandlerProvider const> const& handlerProvider)
|
||||||
{
|
{
|
||||||
return std::make_shared<RPCEngineBase>(
|
return std::make_shared<RPCEngineBase>(
|
||||||
backend, subscriptions, balancer, etl, dosGuard, workQueue, counters, handlerProvider);
|
backend, subscriptions, balancer, dosGuard, workQueue, counters, handlerProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
// local to compilation unit loggers
|
// local to compilation unit loggers
|
||||||
namespace {
|
namespace {
|
||||||
util::Logger gLog{"RPC"};
|
util::Logger gLog{"RPC"};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace rpc {
|
namespace rpc {
|
||||||
@@ -565,10 +566,10 @@ traverseOwnedNodes(
|
|||||||
if (!hintDir)
|
if (!hintDir)
|
||||||
return Status(ripple::rpcINVALID_PARAMS, "Invalid marker.");
|
return Status(ripple::rpcINVALID_PARAMS, "Invalid marker.");
|
||||||
|
|
||||||
ripple::SerialIter it{hintDir->data(), hintDir->size()};
|
ripple::SerialIter hintDirIt{hintDir->data(), hintDir->size()};
|
||||||
ripple::SLE sle{it, hintIndex.key};
|
ripple::SLE hintDirSle{hintDirIt, hintIndex.key};
|
||||||
|
|
||||||
if (auto const& indexes = sle.getFieldV256(ripple::sfIndexes);
|
if (auto const& indexes = hintDirSle.getFieldV256(ripple::sfIndexes);
|
||||||
std::find(std::begin(indexes), std::end(indexes), hexMarker) == std::end(indexes))
|
std::find(std::begin(indexes), std::end(indexes), hexMarker) == std::end(indexes))
|
||||||
{
|
{
|
||||||
// the index specified by marker is not in the page specified by marker
|
// the index specified by marker is not in the page specified by marker
|
||||||
@@ -584,10 +585,10 @@ traverseOwnedNodes(
|
|||||||
if (!ownerDir)
|
if (!ownerDir)
|
||||||
return Status(ripple::rpcINVALID_PARAMS, "Owner directory not found.");
|
return Status(ripple::rpcINVALID_PARAMS, "Owner directory not found.");
|
||||||
|
|
||||||
ripple::SerialIter it{ownerDir->data(), ownerDir->size()};
|
ripple::SerialIter ownedDirIt{ownerDir->data(), ownerDir->size()};
|
||||||
ripple::SLE sle{it, currentIndex.key};
|
ripple::SLE ownedDirSle{ownedDirIt, currentIndex.key};
|
||||||
|
|
||||||
for (auto const& key : sle.getFieldV256(ripple::sfIndexes))
|
for (auto const& key : ownedDirSle.getFieldV256(ripple::sfIndexes))
|
||||||
{
|
{
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
@@ -611,7 +612,7 @@ traverseOwnedNodes(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// the next page
|
// the next page
|
||||||
auto const uNodeNext = sle.getFieldU64(ripple::sfIndexNext);
|
auto const uNodeNext = ownedDirSle.getFieldU64(ripple::sfIndexNext);
|
||||||
if (uNodeNext == 0)
|
if (uNodeNext == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -628,10 +629,10 @@ traverseOwnedNodes(
|
|||||||
if (!ownerDir)
|
if (!ownerDir)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ripple::SerialIter it{ownerDir->data(), ownerDir->size()};
|
ripple::SerialIter ownedDirIt{ownerDir->data(), ownerDir->size()};
|
||||||
ripple::SLE sle{it, currentIndex.key};
|
ripple::SLE ownedDirSle{ownedDirIt, currentIndex.key};
|
||||||
|
|
||||||
for (auto const& key : sle.getFieldV256(ripple::sfIndexes))
|
for (auto const& key : ownedDirSle.getFieldV256(ripple::sfIndexes))
|
||||||
{
|
{
|
||||||
keys.push_back(key);
|
keys.push_back(key);
|
||||||
|
|
||||||
@@ -645,7 +646,7 @@ traverseOwnedNodes(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto const uNodeNext = sle.getFieldU64(ripple::sfIndexNext);
|
auto const uNodeNext = ownedDirSle.getFieldU64(ripple::sfIndexNext);
|
||||||
if (uNodeNext == 0)
|
if (uNodeNext == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -83,9 +83,9 @@ struct VoidOutput
|
|||||||
struct Context
|
struct Context
|
||||||
{
|
{
|
||||||
boost::asio::yield_context yield;
|
boost::asio::yield_context yield;
|
||||||
std::shared_ptr<web::ConnectionBase> session;
|
std::shared_ptr<web::ConnectionBase> session = {};
|
||||||
bool isAdmin = false;
|
bool isAdmin = false;
|
||||||
std::string clientIp;
|
std::string clientIp = {};
|
||||||
uint32_t apiVersion = 0u; // invalid by default
|
uint32_t apiVersion = 0u; // invalid by default
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ CustomValidator Uint256HexStringValidator =
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
CustomValidator LedgerIndexValidator =
|
CustomValidator LedgerIndexValidator =
|
||||||
CustomValidator{[](boost::json::value const& value, std::string_view key) -> MaybeError {
|
CustomValidator{[](boost::json::value const& value, std::string_view /* key */) -> MaybeError {
|
||||||
auto err = Error{Status{RippledError::rpcINVALID_PARAMS, "ledgerIndexMalformed"}};
|
auto err = Error{Status{RippledError::rpcINVALID_PARAMS, "ledgerIndexMalformed"}};
|
||||||
|
|
||||||
if (!value.is_string() && !(value.is_uint64() || value.is_int64()))
|
if (!value.is_string() && !(value.is_uint64() || value.is_int64()))
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public:
|
|||||||
// The accounts array must have two different elements
|
// The accounts array must have two different elements
|
||||||
// Each element must be a valid address
|
// Each element must be a valid address
|
||||||
static auto const rippleStateAccountsCheck =
|
static auto const rippleStateAccountsCheck =
|
||||||
validation::CustomValidator{[](boost::json::value const& value, std::string_view key) -> MaybeError {
|
validation::CustomValidator{[](boost::json::value const& value, std::string_view /* key */) -> MaybeError {
|
||||||
if (!value.is_array() || value.as_array().size() != 2 || !value.as_array()[0].is_string() ||
|
if (!value.is_array() || value.as_array().size() != 2 || !value.as_array()[0].is_string() ||
|
||||||
!value.as_array()[1].is_string() ||
|
!value.as_array()[1].is_string() ||
|
||||||
value.as_array()[0].as_string() == value.as_array()[1].as_string())
|
value.as_array()[0].as_string() == value.as_array()[1].as_string())
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ NFTOffersHandlerBase::iterateOfferDirectory(
|
|||||||
|
|
||||||
std::move(std::begin(offers), std::end(offers), std::back_inserter(output.offers));
|
std::move(std::begin(offers), std::end(offers), std::back_inserter(output.offers));
|
||||||
|
|
||||||
return std::move(output);
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -38,13 +38,13 @@ public:
|
|||||||
|
|
||||||
struct Output
|
struct Output
|
||||||
{
|
{
|
||||||
std::string nftID;
|
std::string nftID = {};
|
||||||
std::vector<ripple::SLE> offers;
|
std::vector<ripple::SLE> offers = {};
|
||||||
|
|
||||||
// validated should be sent via framework
|
// validated should be sent via framework
|
||||||
bool validated = true;
|
bool validated = true;
|
||||||
std::optional<uint32_t> limit;
|
std::optional<uint32_t> limit = {};
|
||||||
std::optional<std::string> marker;
|
std::optional<std::string> marker = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Input
|
struct Input
|
||||||
|
|||||||
@@ -190,13 +190,13 @@ private:
|
|||||||
return web::detail::ErrorHelper(connection, request).sendError(err);
|
return web::detail::ErrorHelper(connection, request).sendError(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto [v, timeDiff] = util::timed([&]() { return rpcEngine_->buildResponse(*context); });
|
auto [result, timeDiff] = util::timed([&]() { return rpcEngine_->buildResponse(*context); });
|
||||||
|
|
||||||
auto us = std::chrono::duration<int, std::milli>(timeDiff);
|
auto us = std::chrono::duration<int, std::milli>(timeDiff);
|
||||||
rpc::logDuration(*context, us);
|
rpc::logDuration(*context, us);
|
||||||
|
|
||||||
boost::json::object response;
|
boost::json::object response;
|
||||||
if (auto const status = std::get_if<rpc::Status>(&v))
|
if (auto const status = std::get_if<rpc::Status>(&result))
|
||||||
{
|
{
|
||||||
// note: error statuses are counted/notified in buildResponse itself
|
// note: error statuses are counted/notified in buildResponse itself
|
||||||
response = web::detail::ErrorHelper(connection, request).composeError(*status);
|
response = web::detail::ErrorHelper(connection, request).composeError(*status);
|
||||||
@@ -210,20 +210,20 @@ private:
|
|||||||
// This can still technically be an error. Clio counts forwarded requests as successful.
|
// This can still technically be an error. Clio counts forwarded requests as successful.
|
||||||
rpcEngine_->notifyComplete(context->method, us);
|
rpcEngine_->notifyComplete(context->method, us);
|
||||||
|
|
||||||
auto& result = std::get<boost::json::object>(v);
|
auto& json = std::get<boost::json::object>(result);
|
||||||
auto const isForwarded = result.contains("forwarded") && result.at("forwarded").is_bool() &&
|
auto const isForwarded =
|
||||||
result.at("forwarded").as_bool();
|
json.contains("forwarded") && json.at("forwarded").is_bool() && json.at("forwarded").as_bool();
|
||||||
|
|
||||||
// if the result is forwarded - just use it as is
|
// if the result is forwarded - just use it as is
|
||||||
// if forwarded request has error, for http, error should be in "result"; for ws, error should be at top
|
// if forwarded request has error, for http, error should be in "result"; for ws, error should be at top
|
||||||
if (isForwarded && (result.contains("result") || connection->upgraded))
|
if (isForwarded && (json.contains("result") || connection->upgraded))
|
||||||
{
|
{
|
||||||
for (auto const& [k, v] : result)
|
for (auto const& [k, v] : json)
|
||||||
response.insert_or_assign(k, v);
|
response.insert_or_assign(k, v);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
response["result"] = result;
|
response["result"] = json;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for ws there is an additional field "status" in the response,
|
// for ws there is an additional field "status" in the response,
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ public:
|
|||||||
* If the DOSGuard is triggered, the message will be modified to include a warning
|
* If the DOSGuard is triggered, the message will be modified to include a warning
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
send(std::string&& msg, http::status _ = http::status::ok) override
|
send(std::string&& msg, http::status = http::status::ok) override
|
||||||
{
|
{
|
||||||
if (!dosGuard_.get().add(clientIp, msg.size()))
|
if (!dosGuard_.get().add(clientIp, msg.size()))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -68,8 +68,7 @@ public:
|
|||||||
* @param msg The message to send
|
* @param msg The message to send
|
||||||
* @throws Not supported unless implemented in child classes. Will always throw std::logic_error.
|
* @throws Not supported unless implemented in child classes. Will always throw std::logic_error.
|
||||||
*/
|
*/
|
||||||
virtual void
|
virtual void send(std::shared_ptr<std::string> /* msg */)
|
||||||
send(std::shared_ptr<std::string> msg)
|
|
||||||
{
|
{
|
||||||
throw std::logic_error("web server can not send the shared payload");
|
throw std::logic_error("web server can not send the shared payload");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ TEST_F(SubscriptionManagerSimpleBackendTest, SubscriptionManagerAccountProposedT
|
|||||||
})";
|
})";
|
||||||
subManagerPtr->forwardProposedTransaction(json::parse(dummyTransaction).get_object());
|
subManagerPtr->forwardProposedTransaction(json::parse(dummyTransaction).get_object());
|
||||||
CheckSubscriberMessage(dummyTransaction, session);
|
CheckSubscriberMessage(dummyTransaction, session);
|
||||||
auto rawIdle = (MockSession*)(sessionIdle.get());
|
auto rawIdle = static_cast<MockSession*>(sessionIdle.get());
|
||||||
EXPECT_EQ("", rawIdle->message);
|
EXPECT_EQ("", rawIdle->message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
#include <boost/json/parse.hpp>
|
#include <boost/json/parse.hpp>
|
||||||
#include <gmock/gmock.h>
|
#include <gmock/gmock.h>
|
||||||
|
|
||||||
namespace json = boost::json;
|
|
||||||
using namespace feed;
|
using namespace feed;
|
||||||
|
|
||||||
// io_context
|
// io_context
|
||||||
@@ -83,9 +82,9 @@ TEST_F(SubscriptionTest, SubscriptionPublish)
|
|||||||
sub.publish(std::make_shared<std::string>("message"));
|
sub.publish(std::make_shared<std::string>("message"));
|
||||||
ctx.restart();
|
ctx.restart();
|
||||||
ctx.run();
|
ctx.run();
|
||||||
MockSession* p1 = (MockSession*)(session1.get());
|
MockSession* p1 = static_cast<MockSession*>(session1.get());
|
||||||
EXPECT_EQ(p1->message, "message");
|
EXPECT_EQ(p1->message, "message");
|
||||||
MockSession* p2 = (MockSession*)(session2.get());
|
MockSession* p2 = static_cast<MockSession*>(session2.get());
|
||||||
EXPECT_EQ(p2->message, "message");
|
EXPECT_EQ(p2->message, "message");
|
||||||
sub.unsubscribe(session1);
|
sub.unsubscribe(session1);
|
||||||
ctx.restart();
|
ctx.restart();
|
||||||
@@ -166,9 +165,9 @@ TEST_F(SubscriptionMapTest, SubscriptionMapPublish)
|
|||||||
subMap.publish(std::make_shared<std::string>(topic2Message.data()), topic2); // rvalue
|
subMap.publish(std::make_shared<std::string>(topic2Message.data()), topic2); // rvalue
|
||||||
ctx.restart();
|
ctx.restart();
|
||||||
ctx.run();
|
ctx.run();
|
||||||
MockSession* p1 = (MockSession*)(session1.get());
|
MockSession* p1 = static_cast<MockSession*>(session1.get());
|
||||||
EXPECT_EQ(p1->message, topic1Message);
|
EXPECT_EQ(p1->message, topic1Message);
|
||||||
MockSession* p2 = (MockSession*)(session2.get());
|
MockSession* p2 = static_cast<MockSession*>(session2.get());
|
||||||
EXPECT_EQ(p2->message, topic2Message);
|
EXPECT_EQ(p2->message, topic2Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,9 +189,9 @@ TEST_F(SubscriptionMapTest, SubscriptionMapDeadRemoveSubscriber)
|
|||||||
subMap.publish(std::make_shared<std::string>(topic2Message), topic2); // rvalue
|
subMap.publish(std::make_shared<std::string>(topic2Message), topic2); // rvalue
|
||||||
ctx.restart();
|
ctx.restart();
|
||||||
ctx.run();
|
ctx.run();
|
||||||
MockDeadSession* p1 = (MockDeadSession*)(session1.get());
|
MockDeadSession* p1 = static_cast<MockDeadSession*>(session1.get());
|
||||||
EXPECT_EQ(p1->dead(), true);
|
EXPECT_EQ(p1->dead(), true);
|
||||||
MockSession* p2 = (MockSession*)(session2.get());
|
MockSession* p2 = static_cast<MockSession*>(session2.get());
|
||||||
EXPECT_EQ(p2->message, topic2Message);
|
EXPECT_EQ(p2->message, topic2Message);
|
||||||
subMap.publish(message1, topic1);
|
subMap.publish(message1, topic1);
|
||||||
ctx.restart();
|
ctx.restart();
|
||||||
|
|||||||
@@ -122,9 +122,9 @@ TEST_F(BackendCassandraTest, Basic)
|
|||||||
lgrInfoNext.hash++;
|
lgrInfoNext.hash++;
|
||||||
lgrInfoNext.accountHash = ~lgrInfo.accountHash;
|
lgrInfoNext.accountHash = ~lgrInfo.accountHash;
|
||||||
{
|
{
|
||||||
std::string rawHeaderBlob = ledgerInfoToBinaryString(lgrInfoNext);
|
std::string infoBlob = ledgerInfoToBinaryString(lgrInfoNext);
|
||||||
|
|
||||||
backend->writeLedger(lgrInfoNext, std::move(rawHeaderBlob));
|
backend->writeLedger(lgrInfoNext, std::move(infoBlob));
|
||||||
ASSERT_TRUE(backend->finishWrites(lgrInfoNext.seq));
|
ASSERT_TRUE(backend->finishWrites(lgrInfoNext.seq));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@@ -349,14 +349,13 @@ TEST_F(BackendCassandraTest, Basic)
|
|||||||
ripple::uint256 hash256;
|
ripple::uint256 hash256;
|
||||||
EXPECT_TRUE(hash256.parseHex(hashHex));
|
EXPECT_TRUE(hash256.parseHex(hashHex));
|
||||||
ripple::TxMeta txMeta{hash256, lgrInfoNext.seq, metaBlob};
|
ripple::TxMeta txMeta{hash256, lgrInfoNext.seq, metaBlob};
|
||||||
auto journal = ripple::debugLog();
|
|
||||||
auto accountsSet = txMeta.getAffectedAccounts();
|
auto accountsSet = txMeta.getAffectedAccounts();
|
||||||
for (auto& a : accountsSet)
|
for (auto& a : accountsSet)
|
||||||
{
|
{
|
||||||
affectedAccounts.push_back(a);
|
affectedAccounts.push_back(a);
|
||||||
}
|
}
|
||||||
std::vector<AccountTransactionsData> accountTxData;
|
std::vector<AccountTransactionsData> accountTxData;
|
||||||
accountTxData.emplace_back(txMeta, hash256, journal);
|
accountTxData.emplace_back(txMeta, hash256);
|
||||||
|
|
||||||
ripple::uint256 nftHash256;
|
ripple::uint256 nftHash256;
|
||||||
EXPECT_TRUE(nftHash256.parseHex(nftTxnHashHex));
|
EXPECT_TRUE(nftHash256.parseHex(nftTxnHashHex));
|
||||||
@@ -399,18 +398,22 @@ TEST_F(BackendCassandraTest, Basic)
|
|||||||
auto retLgr = backend->fetchLedgerBySequence(lgrInfoNext.seq, yield);
|
auto retLgr = backend->fetchLedgerBySequence(lgrInfoNext.seq, yield);
|
||||||
EXPECT_TRUE(retLgr);
|
EXPECT_TRUE(retLgr);
|
||||||
EXPECT_EQ(ledgerInfoToBlob(*retLgr), ledgerInfoToBlob(lgrInfoNext));
|
EXPECT_EQ(ledgerInfoToBlob(*retLgr), ledgerInfoToBlob(lgrInfoNext));
|
||||||
auto txns = backend->fetchAllTransactionsInLedger(lgrInfoNext.seq, yield);
|
auto allTransactions = backend->fetchAllTransactionsInLedger(lgrInfoNext.seq, yield);
|
||||||
ASSERT_EQ(txns.size(), 1);
|
ASSERT_EQ(allTransactions.size(), 1);
|
||||||
EXPECT_STREQ((const char*)txns[0].transaction.data(), (const char*)txnBlob.data());
|
EXPECT_STREQ(
|
||||||
EXPECT_STREQ((const char*)txns[0].metadata.data(), (const char*)metaBlob.data());
|
reinterpret_cast<const char*>(allTransactions[0].transaction.data()),
|
||||||
|
static_cast<const char*>(txnBlob.data()));
|
||||||
|
EXPECT_STREQ(
|
||||||
|
reinterpret_cast<const char*>(allTransactions[0].metadata.data()),
|
||||||
|
static_cast<const char*>(metaBlob.data()));
|
||||||
auto hashes = backend->fetchAllTransactionHashesInLedger(lgrInfoNext.seq, yield);
|
auto hashes = backend->fetchAllTransactionHashesInLedger(lgrInfoNext.seq, yield);
|
||||||
EXPECT_EQ(hashes.size(), 1);
|
EXPECT_EQ(hashes.size(), 1);
|
||||||
EXPECT_EQ(ripple::strHex(hashes[0]), hashHex);
|
EXPECT_EQ(ripple::strHex(hashes[0]), hashHex);
|
||||||
for (auto& a : affectedAccounts)
|
for (auto& a : affectedAccounts)
|
||||||
{
|
{
|
||||||
auto [txns, cursor] = backend->fetchAccountTransactions(a, 100, true, {}, yield);
|
auto [accountTransactions, cursor] = backend->fetchAccountTransactions(a, 100, true, {}, yield);
|
||||||
EXPECT_EQ(txns.size(), 1);
|
EXPECT_EQ(accountTransactions.size(), 1);
|
||||||
EXPECT_EQ(txns[0], txns[0]);
|
EXPECT_EQ(accountTransactions[0], accountTransactions[0]);
|
||||||
EXPECT_FALSE(cursor);
|
EXPECT_FALSE(cursor);
|
||||||
}
|
}
|
||||||
auto nft = backend->fetchNFT(nftID, lgrInfoNext.seq, yield);
|
auto nft = backend->fetchNFT(nftID, lgrInfoNext.seq, yield);
|
||||||
@@ -424,10 +427,10 @@ TEST_F(BackendCassandraTest, Basic)
|
|||||||
EXPECT_TRUE(key256.parseHex(accountIndexHex));
|
EXPECT_TRUE(key256.parseHex(accountIndexHex));
|
||||||
auto obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq, yield);
|
auto obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq, yield);
|
||||||
EXPECT_TRUE(obj);
|
EXPECT_TRUE(obj);
|
||||||
EXPECT_STREQ((const char*)obj->data(), (const char*)accountBlob.data());
|
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlob.data()));
|
||||||
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq + 1, yield);
|
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq + 1, yield);
|
||||||
EXPECT_TRUE(obj);
|
EXPECT_TRUE(obj);
|
||||||
EXPECT_STREQ((const char*)obj->data(), (const char*)accountBlob.data());
|
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlob.data()));
|
||||||
obj = backend->fetchLedgerObject(key256, lgrInfoOld.seq - 1, yield);
|
obj = backend->fetchLedgerObject(key256, lgrInfoOld.seq - 1, yield);
|
||||||
EXPECT_FALSE(obj);
|
EXPECT_FALSE(obj);
|
||||||
}
|
}
|
||||||
@@ -463,13 +466,13 @@ TEST_F(BackendCassandraTest, Basic)
|
|||||||
EXPECT_TRUE(key256.parseHex(accountIndexHex));
|
EXPECT_TRUE(key256.parseHex(accountIndexHex));
|
||||||
auto obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq, yield);
|
auto obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq, yield);
|
||||||
EXPECT_TRUE(obj);
|
EXPECT_TRUE(obj);
|
||||||
EXPECT_STREQ((const char*)obj->data(), (const char*)accountBlob.data());
|
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlob.data()));
|
||||||
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq + 1, yield);
|
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq + 1, yield);
|
||||||
EXPECT_TRUE(obj);
|
EXPECT_TRUE(obj);
|
||||||
EXPECT_STREQ((const char*)obj->data(), (const char*)accountBlob.data());
|
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlob.data()));
|
||||||
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq - 1, yield);
|
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq - 1, yield);
|
||||||
EXPECT_TRUE(obj);
|
EXPECT_TRUE(obj);
|
||||||
EXPECT_STREQ((const char*)obj->data(), (const char*)accountBlobOld.data());
|
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlobOld.data()));
|
||||||
obj = backend->fetchLedgerObject(key256, lgrInfoOld.seq - 1, yield);
|
obj = backend->fetchLedgerObject(key256, lgrInfoOld.seq - 1, yield);
|
||||||
EXPECT_FALSE(obj);
|
EXPECT_FALSE(obj);
|
||||||
}
|
}
|
||||||
@@ -505,7 +508,7 @@ TEST_F(BackendCassandraTest, Basic)
|
|||||||
EXPECT_FALSE(obj);
|
EXPECT_FALSE(obj);
|
||||||
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq - 2, yield);
|
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq - 2, yield);
|
||||||
EXPECT_TRUE(obj);
|
EXPECT_TRUE(obj);
|
||||||
EXPECT_STREQ((const char*)obj->data(), (const char*)accountBlobOld.data());
|
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlobOld.data()));
|
||||||
obj = backend->fetchLedgerObject(key256, lgrInfoOld.seq - 1, yield);
|
obj = backend->fetchLedgerObject(key256, lgrInfoOld.seq - 1, yield);
|
||||||
EXPECT_FALSE(obj);
|
EXPECT_FALSE(obj);
|
||||||
}
|
}
|
||||||
@@ -518,7 +521,7 @@ TEST_F(BackendCassandraTest, Basic)
|
|||||||
for (auto& blob : res)
|
for (auto& blob : res)
|
||||||
{
|
{
|
||||||
++key;
|
++key;
|
||||||
std::string keyStr{(const char*)key.data(), key.size()};
|
std::string keyStr{reinterpret_cast<const char*>(key.data()), key.size()};
|
||||||
blob.first = keyStr;
|
blob.first = keyStr;
|
||||||
blob.second = std::to_string(ledgerSequence) + keyStr;
|
blob.second = std::to_string(ledgerSequence) + keyStr;
|
||||||
}
|
}
|
||||||
@@ -538,7 +541,7 @@ TEST_F(BackendCassandraTest, Basic)
|
|||||||
for (auto& blob : res)
|
for (auto& blob : res)
|
||||||
{
|
{
|
||||||
++base;
|
++base;
|
||||||
std::string hashStr{(const char*)base.data(), base.size()};
|
std::string hashStr{reinterpret_cast<const char*>(base.data()), base.size()};
|
||||||
std::string txnStr = "tx" + std::to_string(ledgerSequence) + hashStr;
|
std::string txnStr = "tx" + std::to_string(ledgerSequence) + hashStr;
|
||||||
std::string metaStr = "meta" + std::to_string(ledgerSequence) + hashStr;
|
std::string metaStr = "meta" + std::to_string(ledgerSequence) + hashStr;
|
||||||
blob = std::make_tuple(hashStr, txnStr, metaStr);
|
blob = std::make_tuple(hashStr, txnStr, metaStr);
|
||||||
@@ -642,8 +645,14 @@ TEST_F(BackendCassandraTest, Basic)
|
|||||||
bool found = false;
|
bool found = false;
|
||||||
for (auto [retTxn, retMeta, retSeq, retDate] : retTxns)
|
for (auto [retTxn, retMeta, retSeq, retDate] : retTxns)
|
||||||
{
|
{
|
||||||
if (std::strncmp((const char*)retTxn.data(), (const char*)txn.data(), txn.size()) == 0 &&
|
if (std::strncmp(
|
||||||
std::strncmp((const char*)retMeta.data(), (const char*)meta.data(), meta.size()) == 0)
|
reinterpret_cast<const char*>(retTxn.data()),
|
||||||
|
static_cast<const char*>(txn.data()),
|
||||||
|
txn.size()) == 0 &&
|
||||||
|
std::strncmp(
|
||||||
|
reinterpret_cast<const char*>(retMeta.data()),
|
||||||
|
static_cast<const char*>(meta.data()),
|
||||||
|
meta.size()) == 0)
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
ASSERT_TRUE(found);
|
ASSERT_TRUE(found);
|
||||||
@@ -655,19 +664,20 @@ TEST_F(BackendCassandraTest, Basic)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
uint32_t limit = 10;
|
uint32_t limit = 10;
|
||||||
auto [txns, retCursor] = backend->fetchAccountTransactions(account, limit, false, cursor, yield);
|
auto [accountTransactions, retCursor] =
|
||||||
|
backend->fetchAccountTransactions(account, limit, false, cursor, yield);
|
||||||
if (retCursor)
|
if (retCursor)
|
||||||
EXPECT_EQ(txns.size(), limit);
|
EXPECT_EQ(accountTransactions.size(), limit);
|
||||||
retData.insert(retData.end(), txns.begin(), txns.end());
|
retData.insert(retData.end(), accountTransactions.begin(), accountTransactions.end());
|
||||||
cursor = retCursor;
|
cursor = retCursor;
|
||||||
} while (cursor);
|
} while (cursor);
|
||||||
EXPECT_EQ(retData.size(), data.size());
|
EXPECT_EQ(retData.size(), data.size());
|
||||||
for (size_t i = 0; i < retData.size(); ++i)
|
for (size_t i = 0; i < retData.size(); ++i)
|
||||||
{
|
{
|
||||||
auto [txn, meta, seq, date] = retData[i];
|
auto [txn, meta, _, __] = retData[i];
|
||||||
auto [hash, expTxn, expMeta] = data[i];
|
auto [___, expTxn, expMeta] = data[i];
|
||||||
EXPECT_STREQ((const char*)txn.data(), (const char*)expTxn.data());
|
EXPECT_STREQ(reinterpret_cast<const char*>(txn.data()), static_cast<const char*>(expTxn.data()));
|
||||||
EXPECT_STREQ((const char*)meta.data(), (const char*)expMeta.data());
|
EXPECT_STREQ(reinterpret_cast<const char*>(meta.data()), static_cast<const char*>(expMeta.data()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::vector<ripple::uint256> keys;
|
std::vector<ripple::uint256> keys;
|
||||||
@@ -677,7 +687,7 @@ TEST_F(BackendCassandraTest, Basic)
|
|||||||
if (obj.size())
|
if (obj.size())
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(retObj.has_value());
|
ASSERT_TRUE(retObj.has_value());
|
||||||
EXPECT_STREQ((const char*)obj.data(), (const char*)retObj->data());
|
EXPECT_STREQ(static_cast<const char*>(obj.data()), reinterpret_cast<const char*>(retObj->data()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -697,7 +707,8 @@ TEST_F(BackendCassandraTest, Basic)
|
|||||||
if (obj.size())
|
if (obj.size())
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(retObj.size());
|
ASSERT_TRUE(retObj.size());
|
||||||
EXPECT_STREQ((const char*)obj.data(), (const char*)retObj.data());
|
EXPECT_STREQ(
|
||||||
|
static_cast<const char*>(obj.data()), reinterpret_cast<const char*>(retObj.data()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -747,7 +758,7 @@ TEST_F(BackendCassandraTest, Basic)
|
|||||||
for (auto account : rec.accounts)
|
for (auto account : rec.accounts)
|
||||||
{
|
{
|
||||||
allAccountTx[lgrInfoNext.seq][account].push_back(
|
allAccountTx[lgrInfoNext.seq][account].push_back(
|
||||||
std::string{(const char*)rec.txHash.data(), rec.txHash.size()});
|
std::string{reinterpret_cast<const char*>(rec.txHash.data()), rec.txHash.size()});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EXPECT_EQ(objs.size(), 25);
|
EXPECT_EQ(objs.size(), 25);
|
||||||
@@ -780,7 +791,7 @@ TEST_F(BackendCassandraTest, Basic)
|
|||||||
for (auto account : rec.accounts)
|
for (auto account : rec.accounts)
|
||||||
{
|
{
|
||||||
allAccountTx[lgrInfoNext.seq][account].push_back(
|
allAccountTx[lgrInfoNext.seq][account].push_back(
|
||||||
std::string{(const char*)rec.txHash.data(), rec.txHash.size()});
|
std::string{reinterpret_cast<const char*>(rec.txHash.data()), rec.txHash.size()});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EXPECT_EQ(objs.size(), 25);
|
EXPECT_EQ(objs.size(), 25);
|
||||||
@@ -916,10 +927,10 @@ TEST_F(BackendCassandraTest, CacheIntegration)
|
|||||||
lgrInfoNext.hash++;
|
lgrInfoNext.hash++;
|
||||||
lgrInfoNext.accountHash = ~lgrInfo.accountHash;
|
lgrInfoNext.accountHash = ~lgrInfo.accountHash;
|
||||||
{
|
{
|
||||||
std::string rawHeaderBlob = ledgerInfoToBinaryString(lgrInfoNext);
|
std::string infoBlob = ledgerInfoToBinaryString(lgrInfoNext);
|
||||||
|
|
||||||
backend->startWrites();
|
backend->startWrites();
|
||||||
backend->writeLedger(lgrInfoNext, std::move(rawHeaderBlob));
|
backend->writeLedger(lgrInfoNext, std::move(infoBlob));
|
||||||
ASSERT_TRUE(backend->finishWrites(lgrInfoNext.seq));
|
ASSERT_TRUE(backend->finishWrites(lgrInfoNext.seq));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@@ -979,10 +990,10 @@ TEST_F(BackendCassandraTest, CacheIntegration)
|
|||||||
EXPECT_TRUE(key256.parseHex(accountIndexHex));
|
EXPECT_TRUE(key256.parseHex(accountIndexHex));
|
||||||
auto obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq, yield);
|
auto obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq, yield);
|
||||||
EXPECT_TRUE(obj);
|
EXPECT_TRUE(obj);
|
||||||
EXPECT_STREQ((const char*)obj->data(), (const char*)accountBlob.data());
|
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlob.data()));
|
||||||
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq + 1, yield);
|
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq + 1, yield);
|
||||||
EXPECT_TRUE(obj);
|
EXPECT_TRUE(obj);
|
||||||
EXPECT_STREQ((const char*)obj->data(), (const char*)accountBlob.data());
|
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlob.data()));
|
||||||
obj = backend->fetchLedgerObject(key256, lgrInfoOld.seq - 1, yield);
|
obj = backend->fetchLedgerObject(key256, lgrInfoOld.seq - 1, yield);
|
||||||
EXPECT_FALSE(obj);
|
EXPECT_FALSE(obj);
|
||||||
}
|
}
|
||||||
@@ -1017,13 +1028,13 @@ TEST_F(BackendCassandraTest, CacheIntegration)
|
|||||||
EXPECT_TRUE(key256.parseHex(accountIndexHex));
|
EXPECT_TRUE(key256.parseHex(accountIndexHex));
|
||||||
auto obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq, yield);
|
auto obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq, yield);
|
||||||
EXPECT_TRUE(obj);
|
EXPECT_TRUE(obj);
|
||||||
EXPECT_STREQ((const char*)obj->data(), (const char*)accountBlob.data());
|
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlob.data()));
|
||||||
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq + 1, yield);
|
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq + 1, yield);
|
||||||
EXPECT_TRUE(obj);
|
EXPECT_TRUE(obj);
|
||||||
EXPECT_STREQ((const char*)obj->data(), (const char*)accountBlob.data());
|
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlob.data()));
|
||||||
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq - 1, yield);
|
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq - 1, yield);
|
||||||
EXPECT_TRUE(obj);
|
EXPECT_TRUE(obj);
|
||||||
EXPECT_STREQ((const char*)obj->data(), (const char*)accountBlobOld.data());
|
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlobOld.data()));
|
||||||
obj = backend->fetchLedgerObject(key256, lgrInfoOld.seq - 1, yield);
|
obj = backend->fetchLedgerObject(key256, lgrInfoOld.seq - 1, yield);
|
||||||
EXPECT_FALSE(obj);
|
EXPECT_FALSE(obj);
|
||||||
}
|
}
|
||||||
@@ -1059,7 +1070,7 @@ TEST_F(BackendCassandraTest, CacheIntegration)
|
|||||||
EXPECT_FALSE(obj);
|
EXPECT_FALSE(obj);
|
||||||
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq - 2, yield);
|
obj = backend->fetchLedgerObject(key256, lgrInfoNext.seq - 2, yield);
|
||||||
EXPECT_TRUE(obj);
|
EXPECT_TRUE(obj);
|
||||||
EXPECT_STREQ((const char*)obj->data(), (const char*)accountBlobOld.data());
|
EXPECT_STREQ(reinterpret_cast<const char*>(obj->data()), static_cast<const char*>(accountBlobOld.data()));
|
||||||
obj = backend->fetchLedgerObject(key256, lgrInfoOld.seq - 1, yield);
|
obj = backend->fetchLedgerObject(key256, lgrInfoOld.seq - 1, yield);
|
||||||
EXPECT_FALSE(obj);
|
EXPECT_FALSE(obj);
|
||||||
}
|
}
|
||||||
@@ -1072,7 +1083,7 @@ TEST_F(BackendCassandraTest, CacheIntegration)
|
|||||||
for (auto& blob : res)
|
for (auto& blob : res)
|
||||||
{
|
{
|
||||||
++key;
|
++key;
|
||||||
std::string keyStr{(const char*)key.data(), key.size()};
|
std::string keyStr{reinterpret_cast<const char*>(key.data()), key.size()};
|
||||||
blob.first = keyStr;
|
blob.first = keyStr;
|
||||||
blob.second = std::to_string(ledgerSequence) + keyStr;
|
blob.second = std::to_string(ledgerSequence) + keyStr;
|
||||||
}
|
}
|
||||||
@@ -1154,7 +1165,7 @@ TEST_F(BackendCassandraTest, CacheIntegration)
|
|||||||
if (obj.size())
|
if (obj.size())
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(retObj.has_value());
|
ASSERT_TRUE(retObj.has_value());
|
||||||
EXPECT_STREQ((const char*)obj.data(), (const char*)retObj->data());
|
EXPECT_STREQ(static_cast<const char*>(obj.data()), reinterpret_cast<const char*>(retObj->data()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1174,7 +1185,8 @@ TEST_F(BackendCassandraTest, CacheIntegration)
|
|||||||
if (obj.size())
|
if (obj.size())
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(retObj.size());
|
ASSERT_TRUE(retObj.size());
|
||||||
EXPECT_STREQ((const char*)obj.data(), (const char*)retObj.data());
|
EXPECT_STREQ(
|
||||||
|
static_cast<const char*>(obj.data()), reinterpret_cast<const char*>(retObj.data()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ using namespace std;
|
|||||||
|
|
||||||
using namespace data::cassandra;
|
using namespace data::cassandra;
|
||||||
|
|
||||||
namespace json = boost::json;
|
|
||||||
|
|
||||||
class BackendCassandraBaseTest : public NoLoggerFixture
|
class BackendCassandraBaseTest : public NoLoggerFixture
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
@@ -88,7 +86,7 @@ protected:
|
|||||||
int64_t idx = 1000;
|
int64_t idx = 1000;
|
||||||
|
|
||||||
for (auto const& entry : entries)
|
for (auto const& entry : entries)
|
||||||
statements.push_back(insert.bind(entry, static_cast<int64_t>(idx++)));
|
statements.push_back(insert.bind(entry, idx++));
|
||||||
|
|
||||||
EXPECT_EQ(statements.size(), entries.size());
|
EXPECT_EQ(statements.size(), entries.size());
|
||||||
EXPECT_TRUE(handle.execute(statements));
|
EXPECT_TRUE(handle.execute(statements));
|
||||||
@@ -241,9 +239,11 @@ TEST_F(BackendCassandraBaseTest, CreateTableWithStrings)
|
|||||||
)",
|
)",
|
||||||
5000);
|
5000);
|
||||||
|
|
||||||
|
{
|
||||||
auto const f1 = handle.asyncExecute(q1);
|
auto const f1 = handle.asyncExecute(q1);
|
||||||
auto const rc = f1.await();
|
auto const rc = f1.await();
|
||||||
ASSERT_TRUE(rc) << rc.error();
|
ASSERT_TRUE(rc) << rc.error();
|
||||||
|
}
|
||||||
|
|
||||||
std::string q2 = "INSERT INTO strings (hash, sequence) VALUES (?, ?)";
|
std::string q2 = "INSERT INTO strings (hash, sequence) VALUES (?, ?)";
|
||||||
auto insert = handle.prepare(q2);
|
auto insert = handle.prepare(q2);
|
||||||
@@ -254,7 +254,7 @@ TEST_F(BackendCassandraBaseTest, CreateTableWithStrings)
|
|||||||
int64_t idx = 1000;
|
int64_t idx = 1000;
|
||||||
|
|
||||||
for (auto const& entry : entries)
|
for (auto const& entry : entries)
|
||||||
futures.push_back(handle.asyncExecute(insert, entry, static_cast<int64_t>(idx++)));
|
futures.push_back(handle.asyncExecute(insert, entry, idx++));
|
||||||
|
|
||||||
ASSERT_EQ(futures.size(), entries.size());
|
ASSERT_EQ(futures.size(), entries.size());
|
||||||
for (auto const& f : futures)
|
for (auto const& f : futures)
|
||||||
@@ -302,9 +302,11 @@ TEST_F(BackendCassandraBaseTest, BatchInsert)
|
|||||||
WITH default_time_to_live = {}
|
WITH default_time_to_live = {}
|
||||||
)",
|
)",
|
||||||
5000);
|
5000);
|
||||||
|
{
|
||||||
auto const f1 = handle.asyncExecute(q1);
|
auto const f1 = handle.asyncExecute(q1);
|
||||||
auto const rc = f1.await();
|
auto const rc = f1.await();
|
||||||
ASSERT_TRUE(rc) << rc.error();
|
ASSERT_TRUE(rc) << rc.error();
|
||||||
|
}
|
||||||
|
|
||||||
std::string q2 = "INSERT INTO strings (hash, sequence) VALUES (?, ?)";
|
std::string q2 = "INSERT INTO strings (hash, sequence) VALUES (?, ?)";
|
||||||
auto const insert = handle.prepare(q2);
|
auto const insert = handle.prepare(q2);
|
||||||
@@ -315,7 +317,7 @@ TEST_F(BackendCassandraBaseTest, BatchInsert)
|
|||||||
int64_t idx = 1000;
|
int64_t idx = 1000;
|
||||||
|
|
||||||
for (auto const& entry : entries)
|
for (auto const& entry : entries)
|
||||||
statements.push_back(insert.bind(entry, static_cast<int64_t>(idx++)));
|
statements.push_back(insert.bind(entry, idx++));
|
||||||
|
|
||||||
ASSERT_EQ(statements.size(), entries.size());
|
ASSERT_EQ(statements.size(), entries.size());
|
||||||
|
|
||||||
@@ -374,7 +376,7 @@ TEST_F(BackendCassandraBaseTest, BatchInsertAsync)
|
|||||||
int64_t idx = 1000;
|
int64_t idx = 1000;
|
||||||
|
|
||||||
for (auto const& entry : entries)
|
for (auto const& entry : entries)
|
||||||
statements.push_back(insert.bind(entry, static_cast<int64_t>(idx++)));
|
statements.push_back(insert.bind(entry, idx++));
|
||||||
|
|
||||||
ASSERT_EQ(statements.size(), entries.size());
|
ASSERT_EQ(statements.size(), entries.size());
|
||||||
fut.emplace(handle.asyncExecute(statements, [&](auto const res) {
|
fut.emplace(handle.asyncExecute(statements, [&](auto const res) {
|
||||||
@@ -434,8 +436,7 @@ TEST_F(BackendCassandraBaseTest, AlterTableMoveToNewTable)
|
|||||||
{
|
{
|
||||||
static_assert(std::is_same_v<decltype(hash), std::string>);
|
static_assert(std::is_same_v<decltype(hash), std::string>);
|
||||||
static_assert(std::is_same_v<decltype(seq), int64_t>);
|
static_assert(std::is_same_v<decltype(seq), int64_t>);
|
||||||
migrationStatements.push_back(
|
migrationStatements.push_back(migrationInsert.bind(hash, seq, seq + 1u));
|
||||||
migrationInsert.bind(hash, static_cast<int64_t>(seq), static_cast<int64_t>(seq + 1u)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECT_TRUE(handle.execute(migrationStatements));
|
EXPECT_TRUE(handle.execute(migrationStatements));
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ TEST_F(BackendCassandraExecutionStrategyTest, ReadOneInCoroutineSuccessful)
|
|||||||
auto strat = DefaultExecutionStrategy{Settings{}, handle};
|
auto strat = DefaultExecutionStrategy{Settings{}, handle};
|
||||||
|
|
||||||
ON_CALL(handle, asyncExecute(An<FakeStatement const&>(), An<std::function<void(FakeResultOrError)>&&>()))
|
ON_CALL(handle, asyncExecute(An<FakeStatement const&>(), An<std::function<void(FakeResultOrError)>&&>()))
|
||||||
.WillByDefault([](auto const& statement, auto&& cb) {
|
.WillByDefault([](auto const& /* statement */, auto&& cb) {
|
||||||
cb({}); // pretend we got data
|
cb({}); // pretend we got data
|
||||||
return FakeFutureWithCallback{};
|
return FakeFutureWithCallback{};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -115,8 +115,7 @@ struct FakeRetryPolicy
|
|||||||
{
|
{
|
||||||
FakeRetryPolicy(boost::asio::io_context&){}; // required by concept
|
FakeRetryPolicy(boost::asio::io_context&){}; // required by concept
|
||||||
|
|
||||||
std::chrono::milliseconds
|
std::chrono::milliseconds calculateDelay(uint32_t /* attempt */)
|
||||||
calculateDelay(uint32_t attempt)
|
|
||||||
{
|
{
|
||||||
return std::chrono::milliseconds{1};
|
return std::chrono::milliseconds{1};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,8 +68,7 @@ public:
|
|||||||
|
|
||||||
TEST_F(ETLExtractorTest, StopsWhenCurrentSequenceExceedsFinishSequence)
|
TEST_F(ETLExtractorTest, StopsWhenCurrentSequenceExceedsFinishSequence)
|
||||||
{
|
{
|
||||||
auto const rawNetworkValidatedLedgersPtr =
|
auto const rawNetworkValidatedLedgersPtr = networkValidatedLedgers_.get();
|
||||||
static_cast<MockNetworkValidatedLedgers*>(networkValidatedLedgers_.get());
|
|
||||||
|
|
||||||
ON_CALL(*rawNetworkValidatedLedgersPtr, waitUntilValidatedByNetwork).WillByDefault(Return(true));
|
ON_CALL(*rawNetworkValidatedLedgersPtr, waitUntilValidatedByNetwork).WillByDefault(Return(true));
|
||||||
EXPECT_CALL(*rawNetworkValidatedLedgersPtr, waitUntilValidatedByNetwork).Times(3);
|
EXPECT_CALL(*rawNetworkValidatedLedgersPtr, waitUntilValidatedByNetwork).Times(3);
|
||||||
@@ -107,8 +106,7 @@ TEST_F(ETLExtractorTest, StopsOnServerShutdown)
|
|||||||
// stop extractor thread if fetcheResponse is empty
|
// stop extractor thread if fetcheResponse is empty
|
||||||
TEST_F(ETLExtractorTest, StopsIfFetchIsUnsuccessful)
|
TEST_F(ETLExtractorTest, StopsIfFetchIsUnsuccessful)
|
||||||
{
|
{
|
||||||
auto const rawNetworkValidatedLedgersPtr =
|
auto const rawNetworkValidatedLedgersPtr = networkValidatedLedgers_.get();
|
||||||
static_cast<MockNetworkValidatedLedgers*>(networkValidatedLedgers_.get());
|
|
||||||
|
|
||||||
ON_CALL(*rawNetworkValidatedLedgersPtr, waitUntilValidatedByNetwork).WillByDefault(Return(true));
|
ON_CALL(*rawNetworkValidatedLedgersPtr, waitUntilValidatedByNetwork).WillByDefault(Return(true));
|
||||||
EXPECT_CALL(*rawNetworkValidatedLedgersPtr, waitUntilValidatedByNetwork).Times(1);
|
EXPECT_CALL(*rawNetworkValidatedLedgersPtr, waitUntilValidatedByNetwork).Times(1);
|
||||||
@@ -123,8 +121,7 @@ TEST_F(ETLExtractorTest, StopsIfFetchIsUnsuccessful)
|
|||||||
|
|
||||||
TEST_F(ETLExtractorTest, StopsIfWaitingUntilValidatedByNetworkTimesOut)
|
TEST_F(ETLExtractorTest, StopsIfWaitingUntilValidatedByNetworkTimesOut)
|
||||||
{
|
{
|
||||||
auto const rawNetworkValidatedLedgersPtr =
|
auto const rawNetworkValidatedLedgersPtr = networkValidatedLedgers_.get();
|
||||||
static_cast<MockNetworkValidatedLedgers*>(networkValidatedLedgers_.get());
|
|
||||||
|
|
||||||
// note that in actual clio code we don't return false unless a timeout is specified and exceeded
|
// note that in actual clio code we don't return false unless a timeout is specified and exceeded
|
||||||
ON_CALL(*rawNetworkValidatedLedgersPtr, waitUntilValidatedByNetwork).WillByDefault(Return(false));
|
ON_CALL(*rawNetworkValidatedLedgersPtr, waitUntilValidatedByNetwork).WillByDefault(Return(false));
|
||||||
@@ -137,8 +134,7 @@ TEST_F(ETLExtractorTest, StopsIfWaitingUntilValidatedByNetworkTimesOut)
|
|||||||
|
|
||||||
TEST_F(ETLExtractorTest, SendsCorrectResponseToDataPipe)
|
TEST_F(ETLExtractorTest, SendsCorrectResponseToDataPipe)
|
||||||
{
|
{
|
||||||
auto const rawNetworkValidatedLedgersPtr =
|
auto const rawNetworkValidatedLedgersPtr = networkValidatedLedgers_.get();
|
||||||
static_cast<MockNetworkValidatedLedgers*>(networkValidatedLedgers_.get());
|
|
||||||
|
|
||||||
ON_CALL(*rawNetworkValidatedLedgersPtr, waitUntilValidatedByNetwork).WillByDefault(Return(true));
|
ON_CALL(*rawNetworkValidatedLedgersPtr, waitUntilValidatedByNetwork).WillByDefault(Return(true));
|
||||||
EXPECT_CALL(*rawNetworkValidatedLedgersPtr, waitUntilValidatedByNetwork).Times(1);
|
EXPECT_CALL(*rawNetworkValidatedLedgersPtr, waitUntilValidatedByNetwork).Times(1);
|
||||||
|
|||||||
@@ -346,7 +346,7 @@ TEST_F(RPCBaseTest, CustomValidator)
|
|||||||
{
|
{
|
||||||
// clang-format off
|
// clang-format off
|
||||||
auto customFormatCheck = CustomValidator{
|
auto customFormatCheck = CustomValidator{
|
||||||
[](json::value const& value, std::string_view key) -> MaybeError {
|
[](json::value const& value, std::string_view /* key */) -> MaybeError {
|
||||||
return value.as_string().size() == 34 ?
|
return value.as_string().size() == 34 ?
|
||||||
MaybeError{} : Error{rpc::Status{"Uh oh"}};
|
MaybeError{} : Error{rpc::Status{"Uh oh"}};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ protected:
|
|||||||
|
|
||||||
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsFalseIfClioOnly)
|
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsFalseIfClioOnly)
|
||||||
{
|
{
|
||||||
auto const rawHandlerProviderPtr = static_cast<MockHandlerProvider*>(handlerProvider.get());
|
auto const rawHandlerProviderPtr = handlerProvider.get();
|
||||||
auto const apiVersion = 2u;
|
auto const apiVersion = 2u;
|
||||||
auto const method = "test";
|
auto const method = "test";
|
||||||
auto const params = json::parse("{}");
|
auto const params = json::parse("{}");
|
||||||
@@ -72,7 +72,7 @@ TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsFalseIfClioOnly)
|
|||||||
|
|
||||||
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsTrueIfProxied)
|
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsTrueIfProxied)
|
||||||
{
|
{
|
||||||
auto const rawHandlerProviderPtr = static_cast<MockHandlerProvider*>(handlerProvider.get());
|
auto const rawHandlerProviderPtr = handlerProvider.get();
|
||||||
auto const apiVersion = 2u;
|
auto const apiVersion = 2u;
|
||||||
auto const method = "submit";
|
auto const method = "submit";
|
||||||
auto const params = json::parse("{}");
|
auto const params = json::parse("{}");
|
||||||
@@ -92,7 +92,7 @@ TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsTrueIfProxied)
|
|||||||
|
|
||||||
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsTrueIfCurrentLedgerSpecified)
|
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsTrueIfCurrentLedgerSpecified)
|
||||||
{
|
{
|
||||||
auto const rawHandlerProviderPtr = static_cast<MockHandlerProvider*>(handlerProvider.get());
|
auto const rawHandlerProviderPtr = handlerProvider.get();
|
||||||
auto const apiVersion = 2u;
|
auto const apiVersion = 2u;
|
||||||
auto const method = "anymethod";
|
auto const method = "anymethod";
|
||||||
auto const params = json::parse(R"({"ledger_index": "current"})");
|
auto const params = json::parse(R"({"ledger_index": "current"})");
|
||||||
@@ -112,7 +112,7 @@ TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsTrueIfCurrentLedgerSpecified)
|
|||||||
|
|
||||||
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsTrueIfClosedLedgerSpecified)
|
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsTrueIfClosedLedgerSpecified)
|
||||||
{
|
{
|
||||||
auto const rawHandlerProviderPtr = static_cast<MockHandlerProvider*>(handlerProvider.get());
|
auto const rawHandlerProviderPtr = handlerProvider.get();
|
||||||
auto const apiVersion = 2u;
|
auto const apiVersion = 2u;
|
||||||
auto const method = "anymethod";
|
auto const method = "anymethod";
|
||||||
auto const params = json::parse(R"({"ledger_index": "closed"})");
|
auto const params = json::parse(R"({"ledger_index": "closed"})");
|
||||||
@@ -132,7 +132,7 @@ TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsTrueIfClosedLedgerSpecified)
|
|||||||
|
|
||||||
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsTrueIfAccountInfoWithQueueSpecified)
|
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsTrueIfAccountInfoWithQueueSpecified)
|
||||||
{
|
{
|
||||||
auto const rawHandlerProviderPtr = static_cast<MockHandlerProvider*>(handlerProvider.get());
|
auto const rawHandlerProviderPtr = handlerProvider.get();
|
||||||
auto const apiVersion = 2u;
|
auto const apiVersion = 2u;
|
||||||
auto const method = "account_info";
|
auto const method = "account_info";
|
||||||
auto const params = json::parse(R"({"queue": true})");
|
auto const params = json::parse(R"({"queue": true})");
|
||||||
@@ -152,7 +152,7 @@ TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsTrueIfAccountInfoWithQueueSpe
|
|||||||
|
|
||||||
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsTrueIfLedgerWithQueueSpecified)
|
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsTrueIfLedgerWithQueueSpecified)
|
||||||
{
|
{
|
||||||
auto const rawHandlerProviderPtr = static_cast<MockHandlerProvider*>(handlerProvider.get());
|
auto const rawHandlerProviderPtr = handlerProvider.get();
|
||||||
auto const apiVersion = 2u;
|
auto const apiVersion = 2u;
|
||||||
auto const method = "ledger";
|
auto const method = "ledger";
|
||||||
auto const params = json::parse(R"({"queue": true})");
|
auto const params = json::parse(R"({"queue": true})");
|
||||||
@@ -172,7 +172,7 @@ TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsTrueIfLedgerWithQueueSpecifie
|
|||||||
|
|
||||||
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsTrueIfLedgerWithFullSpecified)
|
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsTrueIfLedgerWithFullSpecified)
|
||||||
{
|
{
|
||||||
auto const rawHandlerProviderPtr = static_cast<MockHandlerProvider*>(handlerProvider.get());
|
auto const rawHandlerProviderPtr = handlerProvider.get();
|
||||||
auto const apiVersion = 2u;
|
auto const apiVersion = 2u;
|
||||||
auto const method = "ledger";
|
auto const method = "ledger";
|
||||||
auto const params = json::parse(R"({"full": true})");
|
auto const params = json::parse(R"({"full": true})");
|
||||||
@@ -192,7 +192,7 @@ TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsTrueIfLedgerWithFullSpecified
|
|||||||
|
|
||||||
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsTrueIfLedgerWithAccountsSpecified)
|
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsTrueIfLedgerWithAccountsSpecified)
|
||||||
{
|
{
|
||||||
auto const rawHandlerProviderPtr = static_cast<MockHandlerProvider*>(handlerProvider.get());
|
auto const rawHandlerProviderPtr = handlerProvider.get();
|
||||||
auto const apiVersion = 2u;
|
auto const apiVersion = 2u;
|
||||||
auto const method = "ledger";
|
auto const method = "ledger";
|
||||||
auto const params = json::parse(R"({"accounts": true})");
|
auto const params = json::parse(R"({"accounts": true})");
|
||||||
@@ -212,7 +212,7 @@ TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsTrueIfLedgerWithAccountsSpeci
|
|||||||
|
|
||||||
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsFalseIfAccountInfoQueueIsFalse)
|
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsFalseIfAccountInfoQueueIsFalse)
|
||||||
{
|
{
|
||||||
auto const rawHandlerProviderPtr = static_cast<MockHandlerProvider*>(handlerProvider.get());
|
auto const rawHandlerProviderPtr = handlerProvider.get();
|
||||||
auto const apiVersion = 2u;
|
auto const apiVersion = 2u;
|
||||||
auto const method = "account_info";
|
auto const method = "account_info";
|
||||||
auto const params = json::parse(R"({"queue": false})");
|
auto const params = json::parse(R"({"queue": false})");
|
||||||
@@ -232,7 +232,7 @@ TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsFalseIfAccountInfoQueueIsFals
|
|||||||
|
|
||||||
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsFalseIfLedgerQueueIsFalse)
|
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsFalseIfLedgerQueueIsFalse)
|
||||||
{
|
{
|
||||||
auto const rawHandlerProviderPtr = static_cast<MockHandlerProvider*>(handlerProvider.get());
|
auto const rawHandlerProviderPtr = handlerProvider.get();
|
||||||
auto const apiVersion = 2u;
|
auto const apiVersion = 2u;
|
||||||
auto const method = "ledger";
|
auto const method = "ledger";
|
||||||
auto const params = json::parse(R"({"queue": false})");
|
auto const params = json::parse(R"({"queue": false})");
|
||||||
@@ -252,7 +252,7 @@ TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsFalseIfLedgerQueueIsFalse)
|
|||||||
|
|
||||||
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsFalseIfLedgerFullIsFalse)
|
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsFalseIfLedgerFullIsFalse)
|
||||||
{
|
{
|
||||||
auto const rawHandlerProviderPtr = static_cast<MockHandlerProvider*>(handlerProvider.get());
|
auto const rawHandlerProviderPtr = handlerProvider.get();
|
||||||
auto const apiVersion = 2u;
|
auto const apiVersion = 2u;
|
||||||
auto const method = "ledger";
|
auto const method = "ledger";
|
||||||
auto const params = json::parse(R"({"full": false})");
|
auto const params = json::parse(R"({"full": false})");
|
||||||
@@ -272,7 +272,7 @@ TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsFalseIfLedgerFullIsFalse)
|
|||||||
|
|
||||||
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsFalseIfLedgerAccountsIsFalse)
|
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsFalseIfLedgerAccountsIsFalse)
|
||||||
{
|
{
|
||||||
auto const rawHandlerProviderPtr = static_cast<MockHandlerProvider*>(handlerProvider.get());
|
auto const rawHandlerProviderPtr = handlerProvider.get();
|
||||||
auto const apiVersion = 2u;
|
auto const apiVersion = 2u;
|
||||||
auto const method = "ledger";
|
auto const method = "ledger";
|
||||||
auto const params = json::parse(R"({"accounts": false})");
|
auto const params = json::parse(R"({"accounts": false})");
|
||||||
@@ -296,7 +296,7 @@ TEST_F(RPCForwardingProxyTest, ShouldNotForwardReturnsTrueIfAPIVersionIsV1)
|
|||||||
auto const method = "api_version_check";
|
auto const method = "api_version_check";
|
||||||
auto const params = json::parse("{}");
|
auto const params = json::parse("{}");
|
||||||
|
|
||||||
auto const rawHandlerProviderPtr = static_cast<MockHandlerProvider*>(handlerProvider.get());
|
auto const rawHandlerProviderPtr = handlerProvider.get();
|
||||||
ON_CALL(*rawHandlerProviderPtr, isClioOnly(_)).WillByDefault(Return(false));
|
ON_CALL(*rawHandlerProviderPtr, isClioOnly(_)).WillByDefault(Return(false));
|
||||||
EXPECT_CALL(*rawHandlerProviderPtr, isClioOnly(method)).Times(1);
|
EXPECT_CALL(*rawHandlerProviderPtr, isClioOnly(method)).Times(1);
|
||||||
|
|
||||||
@@ -312,7 +312,7 @@ TEST_F(RPCForwardingProxyTest, ShouldNotForwardReturnsTrueIfAPIVersionIsV1)
|
|||||||
|
|
||||||
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsFalseIfAPIVersionIsV2)
|
TEST_F(RPCForwardingProxyTest, ShouldForwardReturnsFalseIfAPIVersionIsV2)
|
||||||
{
|
{
|
||||||
auto const rawHandlerProviderPtr = static_cast<MockHandlerProvider*>(handlerProvider.get());
|
auto const rawHandlerProviderPtr = handlerProvider.get();
|
||||||
auto const apiVersion = 2u;
|
auto const apiVersion = 2u;
|
||||||
auto const method = "api_version_check";
|
auto const method = "api_version_check";
|
||||||
auto const params = json::parse("{}");
|
auto const params = json::parse("{}");
|
||||||
@@ -364,8 +364,8 @@ TEST_F(RPCForwardingProxyTest, ShouldNeverForwardUnsubscribe)
|
|||||||
|
|
||||||
TEST_F(RPCForwardingProxyTest, ForwardCallsBalancerWithCorrectParams)
|
TEST_F(RPCForwardingProxyTest, ForwardCallsBalancerWithCorrectParams)
|
||||||
{
|
{
|
||||||
auto const rawHandlerProviderPtr = static_cast<MockHandlerProvider*>(handlerProvider.get());
|
auto const rawHandlerProviderPtr = handlerProvider.get();
|
||||||
auto const rawBalancerPtr = static_cast<MockLoadBalancer*>(loadBalancer.get());
|
auto const rawBalancerPtr = loadBalancer.get();
|
||||||
auto const apiVersion = 2u;
|
auto const apiVersion = 2u;
|
||||||
auto const method = "submit";
|
auto const method = "submit";
|
||||||
auto const params = json::parse(R"({"test": true})");
|
auto const params = json::parse(R"({"test": true})");
|
||||||
@@ -394,8 +394,8 @@ TEST_F(RPCForwardingProxyTest, ForwardCallsBalancerWithCorrectParams)
|
|||||||
|
|
||||||
TEST_F(RPCForwardingProxyTest, ForwardingFailYieldsErrorStatus)
|
TEST_F(RPCForwardingProxyTest, ForwardingFailYieldsErrorStatus)
|
||||||
{
|
{
|
||||||
auto const rawHandlerProviderPtr = static_cast<MockHandlerProvider*>(handlerProvider.get());
|
auto const rawHandlerProviderPtr = handlerProvider.get();
|
||||||
auto const rawBalancerPtr = static_cast<MockLoadBalancer*>(loadBalancer.get());
|
auto const rawBalancerPtr = loadBalancer.get();
|
||||||
auto const apiVersion = 2u;
|
auto const apiVersion = 2u;
|
||||||
auto const method = "submit";
|
auto const method = "submit";
|
||||||
auto const params = json::parse(R"({"test": true})");
|
auto const params = json::parse(R"({"test": true})");
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ TEST_F(RPCWorkQueueTest, WhitelistedExecutionCountAddsUp)
|
|||||||
for (auto i = 0u; i < TOTAL; ++i)
|
for (auto i = 0u; i < TOTAL; ++i)
|
||||||
{
|
{
|
||||||
queue.postCoro(
|
queue.postCoro(
|
||||||
[&executeCount, &sem, &mtx](auto yield) {
|
[&executeCount, &sem, &mtx](auto /* yield */) {
|
||||||
std::lock_guard lk(mtx);
|
std::lock_guard lk(mtx);
|
||||||
if (++executeCount; executeCount == TOTAL)
|
if (++executeCount; executeCount == TOTAL)
|
||||||
sem.release(); // 1) note we are still in user function
|
sem.release(); // 1) note we are still in user function
|
||||||
@@ -91,7 +91,7 @@ TEST_F(RPCWorkQueueTest, NonWhitelistedPreventSchedulingAtQueueLimitExceeded)
|
|||||||
for (auto i = 0u; i < TOTAL; ++i)
|
for (auto i = 0u; i < TOTAL; ++i)
|
||||||
{
|
{
|
||||||
auto res = queue.postCoro(
|
auto res = queue.postCoro(
|
||||||
[&](auto yield) {
|
[&](auto /* yield */) {
|
||||||
std::unique_lock lk{mtx};
|
std::unique_lock lk{mtx};
|
||||||
cv.wait(lk, [&] { return unblocked == true; });
|
cv.wait(lk, [&] { return unblocked == true; });
|
||||||
|
|
||||||
|
|||||||
@@ -180,16 +180,13 @@ TEST_F(RPCAccountCurrenciesHandlerTest, DefaultParameter)
|
|||||||
|
|
||||||
// ACCOUNT can receive USD 10 from ACCOUNT2 and send USD 20 to ACCOUNT2, now
|
// ACCOUNT can receive USD 10 from ACCOUNT2 and send USD 20 to ACCOUNT2, now
|
||||||
// the balance is 100, ACCOUNT can only send USD to ACCOUNT2
|
// the balance is 100, ACCOUNT can only send USD to ACCOUNT2
|
||||||
auto const line1 =
|
auto const line1 = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
// ACCOUNT2 can receive JPY 10 from ACCOUNT and send JPY 20 to ACCOUNT, now
|
// ACCOUNT2 can receive JPY 10 from ACCOUNT and send JPY 20 to ACCOUNT, now
|
||||||
// the balance is 100, ACCOUNT2 can only send JPY to ACCOUNT
|
// the balance is 100, ACCOUNT2 can only send JPY to ACCOUNT
|
||||||
auto const line2 =
|
auto const line2 = CreateRippleStateLedgerObject("JPY", ISSUER, 100, ACCOUNT2, 10, ACCOUNT, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "JPY", ISSUER, 100, ACCOUNT2, 10, ACCOUNT, 20, TXNID, 123, 0);
|
|
||||||
// ACCOUNT can receive EUR 10 from ACCOUNT and send EUR 20 to ACCOUNT2, now
|
// ACCOUNT can receive EUR 10 from ACCOUNT and send EUR 20 to ACCOUNT2, now
|
||||||
// the balance is 8, ACCOUNT can receive/send EUR to/from ACCOUNT2
|
// the balance is 8, ACCOUNT can receive/send EUR to/from ACCOUNT2
|
||||||
auto const line3 =
|
auto const line3 = CreateRippleStateLedgerObject("EUR", ISSUER, 8, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "EUR", ISSUER, 8, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
bbs.push_back(line2.getSerializer().peekData());
|
bbs.push_back(line2.getSerializer().peekData());
|
||||||
@@ -229,8 +226,7 @@ TEST_F(RPCAccountCurrenciesHandlerTest, RequestViaLegderHash)
|
|||||||
.WillByDefault(Return(ownerDir.getSerializer().peekData()));
|
.WillByDefault(Return(ownerDir.getSerializer().peekData()));
|
||||||
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(2);
|
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(2);
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
auto const line1 =
|
auto const line1 = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
|
|
||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
||||||
@@ -270,8 +266,7 @@ TEST_F(RPCAccountCurrenciesHandlerTest, RequestViaLegderSeq)
|
|||||||
.WillByDefault(Return(ownerDir.getSerializer().peekData()));
|
.WillByDefault(Return(ownerDir.getSerializer().peekData()));
|
||||||
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(2);
|
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(2);
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
auto const line1 =
|
auto const line1 = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
|
|
||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
||||||
|
|||||||
@@ -465,10 +465,8 @@ TEST_F(RPCAccountLinesHandlerTest, DefaultParameterTest)
|
|||||||
|
|
||||||
// return two trust lines
|
// return two trust lines
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
auto const line1 =
|
auto const line1 = CreateRippleStateLedgerObject("USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
auto const line2 = CreateRippleStateLedgerObject("USD", ACCOUNT, 10, ACCOUNT2, 100, ACCOUNT, 200, TXNID, 123);
|
||||||
auto const line2 =
|
|
||||||
CreateRippleStateLedgerObject(ACCOUNT2, "USD", ACCOUNT, 10, ACCOUNT2, 100, ACCOUNT, 200, TXNID, 123);
|
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
bbs.push_back(line2.getSerializer().peekData());
|
bbs.push_back(line2.getSerializer().peekData());
|
||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
||||||
@@ -545,8 +543,7 @@ TEST_F(RPCAccountLinesHandlerTest, UseLimit)
|
|||||||
while (repetitions--)
|
while (repetitions--)
|
||||||
{
|
{
|
||||||
indexes.push_back(ripple::uint256{INDEX1});
|
indexes.push_back(ripple::uint256{INDEX1});
|
||||||
auto const line =
|
auto const line = CreateRippleStateLedgerObject("USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
|
||||||
bbs.push_back(line.getSerializer().peekData());
|
bbs.push_back(line.getSerializer().peekData());
|
||||||
}
|
}
|
||||||
ripple::STObject ownerDir = CreateOwnerDirLedgerObject(indexes, INDEX1);
|
ripple::STObject ownerDir = CreateOwnerDirLedgerObject(indexes, INDEX1);
|
||||||
@@ -625,8 +622,7 @@ TEST_F(RPCAccountLinesHandlerTest, UseDestination)
|
|||||||
while (repetitions--)
|
while (repetitions--)
|
||||||
{
|
{
|
||||||
indexes.push_back(ripple::uint256{INDEX1});
|
indexes.push_back(ripple::uint256{INDEX1});
|
||||||
auto const line =
|
auto const line = CreateRippleStateLedgerObject("USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
|
||||||
bbs.push_back(line.getSerializer().peekData());
|
bbs.push_back(line.getSerializer().peekData());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -635,8 +631,7 @@ TEST_F(RPCAccountLinesHandlerTest, UseDestination)
|
|||||||
while (repetitions--)
|
while (repetitions--)
|
||||||
{
|
{
|
||||||
indexes.push_back(ripple::uint256{INDEX1});
|
indexes.push_back(ripple::uint256{INDEX1});
|
||||||
auto const line =
|
auto const line = CreateRippleStateLedgerObject("USD", ACCOUNT3, 10, ACCOUNT, 100, ACCOUNT3, 200, TXNID, 123);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ACCOUNT3, 10, ACCOUNT, 100, ACCOUNT3, 200, TXNID, 123);
|
|
||||||
bbs.push_back(line.getSerializer().peekData());
|
bbs.push_back(line.getSerializer().peekData());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -761,13 +756,13 @@ TEST_F(RPCAccountLinesHandlerTest, OptionalResponseField)
|
|||||||
|
|
||||||
// return few trust lines
|
// return few trust lines
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
auto line1 = CreateRippleStateLedgerObject(ACCOUNT, "USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 0);
|
auto line1 = CreateRippleStateLedgerObject("USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 0);
|
||||||
line1.setFlag(ripple::lsfHighAuth);
|
line1.setFlag(ripple::lsfHighAuth);
|
||||||
line1.setFlag(ripple::lsfHighNoRipple);
|
line1.setFlag(ripple::lsfHighNoRipple);
|
||||||
line1.setFlag(ripple::lsfHighFreeze);
|
line1.setFlag(ripple::lsfHighFreeze);
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
|
|
||||||
auto line2 = CreateRippleStateLedgerObject(ACCOUNT, "USD", ACCOUNT2, 20, ACCOUNT, 200, ACCOUNT2, 400, TXNID, 0);
|
auto line2 = CreateRippleStateLedgerObject("USD", ACCOUNT2, 20, ACCOUNT, 200, ACCOUNT2, 400, TXNID, 0);
|
||||||
line2.setFlag(ripple::lsfLowAuth);
|
line2.setFlag(ripple::lsfLowAuth);
|
||||||
line2.setFlag(ripple::lsfLowNoRipple);
|
line2.setFlag(ripple::lsfLowNoRipple);
|
||||||
line2.setFlag(ripple::lsfLowFreeze);
|
line2.setFlag(ripple::lsfLowFreeze);
|
||||||
@@ -809,7 +804,7 @@ TEST_F(RPCAccountLinesHandlerTest, MarkerOutput)
|
|||||||
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(3);
|
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(3);
|
||||||
|
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
auto line = CreateRippleStateLedgerObject(ACCOUNT, "USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 0);
|
auto line = CreateRippleStateLedgerObject("USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 0);
|
||||||
|
|
||||||
// owner dir contains 10 indexes
|
// owner dir contains 10 indexes
|
||||||
int objectsCount = 10;
|
int objectsCount = 10;
|
||||||
@@ -878,8 +873,7 @@ TEST_F(RPCAccountLinesHandlerTest, MarkerInput)
|
|||||||
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(3);
|
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(3);
|
||||||
|
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
auto const line =
|
auto const line = CreateRippleStateLedgerObject("USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 0);
|
|
||||||
int objectsCount = limit;
|
int objectsCount = limit;
|
||||||
std::vector<ripple::uint256> indexes;
|
std::vector<ripple::uint256> indexes;
|
||||||
while (objectsCount != 0)
|
while (objectsCount != 0)
|
||||||
@@ -944,10 +938,8 @@ TEST_F(RPCAccountLinesHandlerTest, LimitLessThanMin)
|
|||||||
|
|
||||||
// return two trust lines
|
// return two trust lines
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
auto const line1 =
|
auto const line1 = CreateRippleStateLedgerObject("USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
auto const line2 = CreateRippleStateLedgerObject("USD", ACCOUNT, 10, ACCOUNT2, 100, ACCOUNT, 200, TXNID, 123);
|
||||||
auto const line2 =
|
|
||||||
CreateRippleStateLedgerObject(ACCOUNT2, "USD", ACCOUNT, 10, ACCOUNT2, 100, ACCOUNT, 200, TXNID, 123);
|
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
bbs.push_back(line2.getSerializer().peekData());
|
bbs.push_back(line2.getSerializer().peekData());
|
||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
||||||
@@ -1027,10 +1019,8 @@ TEST_F(RPCAccountLinesHandlerTest, LimitMoreThanMax)
|
|||||||
|
|
||||||
// return two trust lines
|
// return two trust lines
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
auto const line1 =
|
auto const line1 = CreateRippleStateLedgerObject("USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
auto const line2 = CreateRippleStateLedgerObject("USD", ACCOUNT, 10, ACCOUNT2, 100, ACCOUNT, 200, TXNID, 123);
|
||||||
auto const line2 =
|
|
||||||
CreateRippleStateLedgerObject(ACCOUNT2, "USD", ACCOUNT, 10, ACCOUNT2, 100, ACCOUNT, 200, TXNID, 123);
|
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
bbs.push_back(line2.getSerializer().peekData());
|
bbs.push_back(line2.getSerializer().peekData());
|
||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
||||||
|
|||||||
@@ -327,8 +327,7 @@ TEST_F(RPCAccountObjectsHandlerTest, DefaultParameterNoNFTFound)
|
|||||||
|
|
||||||
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(3);
|
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(3);
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
auto const line1 =
|
auto const line1 = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
|
|
||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
||||||
@@ -378,8 +377,7 @@ TEST_F(RPCAccountObjectsHandlerTest, Limit)
|
|||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
while (count-- != 0)
|
while (count-- != 0)
|
||||||
{
|
{
|
||||||
auto const line1 =
|
auto const line1 = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
}
|
}
|
||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
||||||
@@ -427,8 +425,7 @@ TEST_F(RPCAccountObjectsHandlerTest, Marker)
|
|||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
while (count-- != 0)
|
while (count-- != 0)
|
||||||
{
|
{
|
||||||
auto const line1 =
|
auto const line1 = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
}
|
}
|
||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
||||||
@@ -489,8 +486,7 @@ TEST_F(RPCAccountObjectsHandlerTest, MultipleDirNoNFT)
|
|||||||
cc = count * 2;
|
cc = count * 2;
|
||||||
while (cc-- != 0)
|
while (cc-- != 0)
|
||||||
{
|
{
|
||||||
auto const line1 =
|
auto const line1 = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
}
|
}
|
||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
||||||
@@ -538,8 +534,7 @@ TEST_F(RPCAccountObjectsHandlerTest, TypeFilter)
|
|||||||
|
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
// put 1 state and 1 offer
|
// put 1 state and 1 offer
|
||||||
auto const line1 =
|
auto const line1 = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
auto const offer = CreateOfferLedgerObject(
|
auto const offer = CreateOfferLedgerObject(
|
||||||
ACCOUNT,
|
ACCOUNT,
|
||||||
10,
|
10,
|
||||||
@@ -594,8 +589,7 @@ TEST_F(RPCAccountObjectsHandlerTest, TypeFilterReturnEmpty)
|
|||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObject(nftMaxKK, 30, _)).WillByDefault(Return(std::nullopt));
|
ON_CALL(*rawBackendPtr, doFetchLedgerObject(nftMaxKK, 30, _)).WillByDefault(Return(std::nullopt));
|
||||||
|
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
auto const line1 =
|
auto const line1 = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
auto const offer = CreateOfferLedgerObject(
|
auto const offer = CreateOfferLedgerObject(
|
||||||
ACCOUNT,
|
ACCOUNT,
|
||||||
10,
|
10,
|
||||||
@@ -653,8 +647,7 @@ TEST_F(RPCAccountObjectsHandlerTest, DeletionBlockersOnlyFilter)
|
|||||||
|
|
||||||
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(3);
|
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(3);
|
||||||
|
|
||||||
auto const line =
|
auto const line = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
auto const channel = CreatePaymentChannelLedgerObject(ACCOUNT, ACCOUNT2, 100, 10, 32, TXNID, 28);
|
auto const channel = CreatePaymentChannelLedgerObject(ACCOUNT, ACCOUNT2, 100, 10, 32, TXNID, 28);
|
||||||
auto const offer = CreateOfferLedgerObject(
|
auto const offer = CreateOfferLedgerObject(
|
||||||
ACCOUNT,
|
ACCOUNT,
|
||||||
@@ -714,8 +707,7 @@ TEST_F(RPCAccountObjectsHandlerTest, DeletionBlockersOnlyFilterWithTypeFilter)
|
|||||||
auto const nftMaxKK = ripple::keylet::nftpage_max(account).key;
|
auto const nftMaxKK = ripple::keylet::nftpage_max(account).key;
|
||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObject(nftMaxKK, 30, _)).WillByDefault(Return(std::nullopt));
|
ON_CALL(*rawBackendPtr, doFetchLedgerObject(nftMaxKK, 30, _)).WillByDefault(Return(std::nullopt));
|
||||||
|
|
||||||
auto const line =
|
auto const line = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
auto const channel = CreatePaymentChannelLedgerObject(ACCOUNT, ACCOUNT2, 100, 10, 32, TXNID, 28);
|
auto const channel = CreatePaymentChannelLedgerObject(ACCOUNT, ACCOUNT2, 100, 10, 32, TXNID, 28);
|
||||||
|
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
@@ -971,8 +963,7 @@ TEST_F(RPCAccountObjectsHandlerTest, NFTMixOtherObjects)
|
|||||||
|
|
||||||
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(4);
|
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(4);
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
auto const line1 =
|
auto const line1 = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
|
|
||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
||||||
@@ -1134,8 +1125,7 @@ TEST_F(RPCAccountObjectsHandlerTest, NFTMarker)
|
|||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObject(ownerDirKk, 30, _))
|
ON_CALL(*rawBackendPtr, doFetchLedgerObject(ownerDirKk, 30, _))
|
||||||
.WillByDefault(Return(ownerDir.getSerializer().peekData()));
|
.WillByDefault(Return(ownerDir.getSerializer().peekData()));
|
||||||
|
|
||||||
auto const line =
|
auto const line = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
auto const channel = CreatePaymentChannelLedgerObject(ACCOUNT, ACCOUNT2, 100, 10, 32, TXNID, 28);
|
auto const channel = CreatePaymentChannelLedgerObject(ACCOUNT, ACCOUNT2, 100, 10, 32, TXNID, 28);
|
||||||
auto const offer = CreateOfferLedgerObject(
|
auto const offer = CreateOfferLedgerObject(
|
||||||
ACCOUNT,
|
ACCOUNT,
|
||||||
@@ -1195,8 +1185,7 @@ TEST_F(RPCAccountObjectsHandlerTest, NFTMarkerNoMoreNFT)
|
|||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObject(ownerDirKk, 30, _))
|
ON_CALL(*rawBackendPtr, doFetchLedgerObject(ownerDirKk, 30, _))
|
||||||
.WillByDefault(Return(ownerDir.getSerializer().peekData()));
|
.WillByDefault(Return(ownerDir.getSerializer().peekData()));
|
||||||
|
|
||||||
auto const line =
|
auto const line = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
auto const channel = CreatePaymentChannelLedgerObject(ACCOUNT, ACCOUNT2, 100, 10, 32, TXNID, 28);
|
auto const channel = CreatePaymentChannelLedgerObject(ACCOUNT, ACCOUNT2, 100, 10, 32, TXNID, 28);
|
||||||
auto const offer = CreateOfferLedgerObject(
|
auto const offer = CreateOfferLedgerObject(
|
||||||
ACCOUNT,
|
ACCOUNT,
|
||||||
@@ -1344,8 +1333,7 @@ TEST_F(RPCAccountObjectsHandlerTest, NFTLimitAdjust)
|
|||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObject(ownerDirKk, 30, _))
|
ON_CALL(*rawBackendPtr, doFetchLedgerObject(ownerDirKk, 30, _))
|
||||||
.WillByDefault(Return(ownerDir.getSerializer().peekData()));
|
.WillByDefault(Return(ownerDir.getSerializer().peekData()));
|
||||||
|
|
||||||
auto const line =
|
auto const line = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
auto const channel = CreatePaymentChannelLedgerObject(ACCOUNT, ACCOUNT2, 100, 10, 32, TXNID, 28);
|
auto const channel = CreatePaymentChannelLedgerObject(ACCOUNT, ACCOUNT2, 100, 10, 32, TXNID, 28);
|
||||||
auto const offer = CreateOfferLedgerObject(
|
auto const offer = CreateOfferLedgerObject(
|
||||||
ACCOUNT,
|
ACCOUNT,
|
||||||
@@ -1462,8 +1450,7 @@ TEST_F(RPCAccountObjectsHandlerTest, FilterNFT)
|
|||||||
|
|
||||||
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(4);
|
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(4);
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
auto const line1 =
|
auto const line1 = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
|
|
||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
||||||
@@ -1510,8 +1497,7 @@ TEST_F(RPCAccountObjectsHandlerTest, NFTZeroMarkerNotAffectOtherMarker)
|
|||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
while (count-- != 0)
|
while (count-- != 0)
|
||||||
{
|
{
|
||||||
auto const line1 =
|
auto const line1 = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
}
|
}
|
||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
||||||
@@ -1595,8 +1581,7 @@ TEST_F(RPCAccountObjectsHandlerTest, LimitLessThanMin)
|
|||||||
|
|
||||||
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(3);
|
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(3);
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
auto const line1 =
|
auto const line1 = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
|
|
||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
||||||
@@ -1676,8 +1661,7 @@ TEST_F(RPCAccountObjectsHandlerTest, LimitMoreThanMax)
|
|||||||
|
|
||||||
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(3);
|
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(3);
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
auto const line1 =
|
auto const line1 = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
|
|
||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
||||||
|
|||||||
@@ -531,7 +531,7 @@ generateNormalPathBookOffersTestBundles()
|
|||||||
auto const account2 = GetAccountIDWithString(ACCOUNT2);
|
auto const account2 = GetAccountIDWithString(ACCOUNT2);
|
||||||
|
|
||||||
auto const frozenTrustLine = CreateRippleStateLedgerObject(
|
auto const frozenTrustLine = CreateRippleStateLedgerObject(
|
||||||
ACCOUNT2, "USD", ACCOUNT, -8, ACCOUNT2, 1000, ACCOUNT, 2000, INDEX1, 2, ripple::lsfLowFreeze);
|
"USD", ACCOUNT, -8, ACCOUNT2, 1000, ACCOUNT, 2000, INDEX1, 2, ripple::lsfLowFreeze);
|
||||||
|
|
||||||
auto const gets10USDPays20XRPOffer = CreateOfferLedgerObject(
|
auto const gets10USDPays20XRPOffer = CreateOfferLedgerObject(
|
||||||
ACCOUNT2,
|
ACCOUNT2,
|
||||||
@@ -599,10 +599,10 @@ generateNormalPathBookOffersTestBundles()
|
|||||||
auto const feeLedgerObject = CreateFeeSettingBlob(1, 2, 3, 4, 0);
|
auto const feeLedgerObject = CreateFeeSettingBlob(1, 2, 3, 4, 0);
|
||||||
|
|
||||||
auto const trustline30Balance =
|
auto const trustline30Balance =
|
||||||
CreateRippleStateLedgerObject(ACCOUNT2, "USD", ACCOUNT, -30, ACCOUNT2, 1000, ACCOUNT, 2000, INDEX1, 2, 0);
|
CreateRippleStateLedgerObject("USD", ACCOUNT, -30, ACCOUNT2, 1000, ACCOUNT, 2000, INDEX1, 2, 0);
|
||||||
|
|
||||||
auto const trustline8Balance =
|
auto const trustline8Balance =
|
||||||
CreateRippleStateLedgerObject(ACCOUNT2, "USD", ACCOUNT, -8, ACCOUNT2, 1000, ACCOUNT, 2000, INDEX1, 2, 0);
|
CreateRippleStateLedgerObject("USD", ACCOUNT, -8, ACCOUNT2, 1000, ACCOUNT, 2000, INDEX1, 2, 0);
|
||||||
|
|
||||||
return std::vector<BookOffersNormalTestBundle>{
|
return std::vector<BookOffersNormalTestBundle>{
|
||||||
BookOffersNormalTestBundle{
|
BookOffersNormalTestBundle{
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ TEST_F(RPCGatewayBalancesHandlerTest, InvalidHotWallet)
|
|||||||
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(2);
|
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(2);
|
||||||
|
|
||||||
// create a valid line, balance is 0
|
// create a valid line, balance is 0
|
||||||
auto const line1 = CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 0, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123);
|
auto const line1 = CreateRippleStateLedgerObject("USD", ISSUER, 0, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123);
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
||||||
@@ -415,12 +415,10 @@ TEST_P(NormalPathTest, CheckOutput)
|
|||||||
auto
|
auto
|
||||||
generateNormalPathTestBundles()
|
generateNormalPathTestBundles()
|
||||||
{
|
{
|
||||||
auto frozenState =
|
auto frozenState = CreateRippleStateLedgerObject("JPY", ISSUER, -50, ACCOUNT, 10, ACCOUNT3, 20, TXNID, 123);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "JPY", ISSUER, -50, ACCOUNT, 10, ACCOUNT3, 20, TXNID, 123);
|
|
||||||
frozenState.setFieldU32(ripple::sfFlags, ripple::lsfLowFreeze);
|
frozenState.setFieldU32(ripple::sfFlags, ripple::lsfLowFreeze);
|
||||||
|
|
||||||
auto overflowState =
|
auto overflowState = CreateRippleStateLedgerObject("JPY", ISSUER, 50, ACCOUNT, 10, ACCOUNT3, 20, TXNID, 123);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "JPY", ISSUER, 50, ACCOUNT, 10, ACCOUNT3, 20, TXNID, 123);
|
|
||||||
int64_t min64 = -9922966390934554;
|
int64_t min64 = -9922966390934554;
|
||||||
overflowState.setFieldAmount(ripple::sfBalance, ripple::STAmount(GetIssue("JPY", ISSUER), min64, 80));
|
overflowState.setFieldAmount(ripple::sfBalance, ripple::STAmount(GetIssue("JPY", ISSUER), min64, 80));
|
||||||
return std::vector<NormalTestBundle>{
|
return std::vector<NormalTestBundle>{
|
||||||
@@ -434,17 +432,16 @@ generateNormalPathTestBundles()
|
|||||||
ripple::uint256{INDEX2},
|
ripple::uint256{INDEX2},
|
||||||
ripple::uint256{INDEX2}},
|
ripple::uint256{INDEX2}},
|
||||||
INDEX1),
|
INDEX1),
|
||||||
std::vector{
|
std::vector{// hotwallet
|
||||||
|
CreateRippleStateLedgerObject("USD", ISSUER, -10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123),
|
||||||
// hotwallet
|
// hotwallet
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, -10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123),
|
CreateRippleStateLedgerObject("CNY", ISSUER, -20, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123),
|
||||||
// hotwallet
|
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "CNY", ISSUER, -20, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123),
|
|
||||||
// positive balance -> asset
|
// positive balance -> asset
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "EUR", ISSUER, 30, ACCOUNT, 100, ACCOUNT3, 200, TXNID, 123),
|
CreateRippleStateLedgerObject("EUR", ISSUER, 30, ACCOUNT, 100, ACCOUNT3, 200, TXNID, 123),
|
||||||
// positive balance -> asset
|
// positive balance -> asset
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "JPY", ISSUER, 40, ACCOUNT, 100, ACCOUNT3, 200, TXNID, 123),
|
CreateRippleStateLedgerObject("JPY", ISSUER, 40, ACCOUNT, 100, ACCOUNT3, 200, TXNID, 123),
|
||||||
// obligation
|
// obligation
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "JPY", ISSUER, -50, ACCOUNT, 10, ACCOUNT3, 20, TXNID, 123),
|
CreateRippleStateLedgerObject("JPY", ISSUER, -50, ACCOUNT, 10, ACCOUNT3, 20, TXNID, 123),
|
||||||
frozenState
|
frozenState
|
||||||
|
|
||||||
},
|
},
|
||||||
@@ -497,8 +494,7 @@ generateNormalPathTestBundles()
|
|||||||
NormalTestBundle{
|
NormalTestBundle{
|
||||||
"NoHotwallet",
|
"NoHotwallet",
|
||||||
CreateOwnerDirLedgerObject({ripple::uint256{INDEX2}}, INDEX1),
|
CreateOwnerDirLedgerObject({ripple::uint256{INDEX2}}, INDEX1),
|
||||||
std::vector{
|
std::vector{CreateRippleStateLedgerObject("JPY", ISSUER, -50, ACCOUNT, 10, ACCOUNT3, 20, TXNID, 123)},
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "JPY", ISSUER, -50, ACCOUNT, 10, ACCOUNT3, 20, TXNID, 123)},
|
|
||||||
fmt::format(
|
fmt::format(
|
||||||
R"({{
|
R"({{
|
||||||
"obligations":{{
|
"obligations":{{
|
||||||
@@ -530,13 +526,12 @@ generateNormalPathTestBundles()
|
|||||||
CreateOwnerDirLedgerObject(
|
CreateOwnerDirLedgerObject(
|
||||||
{ripple::uint256{INDEX2}, ripple::uint256{INDEX2}, ripple::uint256{INDEX2}, ripple::uint256{INDEX2}},
|
{ripple::uint256{INDEX2}, ripple::uint256{INDEX2}, ripple::uint256{INDEX2}, ripple::uint256{INDEX2}},
|
||||||
INDEX1),
|
INDEX1),
|
||||||
std::vector{
|
std::vector{// hotwallet
|
||||||
|
CreateRippleStateLedgerObject("USD", ISSUER, 10, ACCOUNT2, 100, ACCOUNT, 200, TXNID, 123),
|
||||||
// hotwallet
|
// hotwallet
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 10, ACCOUNT2, 100, ACCOUNT, 200, TXNID, 123),
|
CreateRippleStateLedgerObject("CNY", ISSUER, 20, ACCOUNT2, 100, ACCOUNT, 200, TXNID, 123),
|
||||||
// hotwallet
|
CreateRippleStateLedgerObject("EUR", ISSUER, 30, ACCOUNT3, 100, ACCOUNT, 200, TXNID, 123),
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "CNY", ISSUER, 20, ACCOUNT2, 100, ACCOUNT, 200, TXNID, 123),
|
CreateRippleStateLedgerObject("JPY", ISSUER, -50, ACCOUNT3, 10, ACCOUNT, 20, TXNID, 123)},
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "EUR", ISSUER, 30, ACCOUNT3, 100, ACCOUNT, 200, TXNID, 123),
|
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "JPY", ISSUER, -50, ACCOUNT3, 10, ACCOUNT, 20, TXNID, 123)},
|
|
||||||
fmt::format(
|
fmt::format(
|
||||||
R"({{
|
R"({{
|
||||||
"obligations":{{
|
"obligations":{{
|
||||||
@@ -575,9 +570,9 @@ generateNormalPathTestBundles()
|
|||||||
CreateOwnerDirLedgerObject(
|
CreateOwnerDirLedgerObject(
|
||||||
{ripple::uint256{INDEX2}, ripple::uint256{INDEX2}, ripple::uint256{INDEX2}}, INDEX1),
|
{ripple::uint256{INDEX2}, ripple::uint256{INDEX2}, ripple::uint256{INDEX2}}, INDEX1),
|
||||||
std::vector{
|
std::vector{
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, -10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123),
|
CreateRippleStateLedgerObject("USD", ISSUER, -10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123),
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "CNY", ISSUER, -20, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123),
|
CreateRippleStateLedgerObject("CNY", ISSUER, -20, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123),
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "EUR", ISSUER, -30, ACCOUNT, 100, ACCOUNT3, 200, TXNID, 123)
|
CreateRippleStateLedgerObject("EUR", ISSUER, -30, ACCOUNT, 100, ACCOUNT3, 200, TXNID, 123)
|
||||||
|
|
||||||
},
|
},
|
||||||
fmt::format(
|
fmt::format(
|
||||||
|
|||||||
@@ -252,8 +252,7 @@ TEST_F(RPCLedgerDataHandlerTest, NoMarker)
|
|||||||
|
|
||||||
while (limitLine--)
|
while (limitLine--)
|
||||||
{
|
{
|
||||||
auto const line =
|
auto const line = CreateRippleStateLedgerObject("USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
|
||||||
bbs.push_back(line.getSerializer().peekData());
|
bbs.push_back(line.getSerializer().peekData());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,8 +314,7 @@ TEST_F(RPCLedgerDataHandlerTest, TypeFilter)
|
|||||||
|
|
||||||
while (limitLine--)
|
while (limitLine--)
|
||||||
{
|
{
|
||||||
auto const line =
|
auto const line = CreateRippleStateLedgerObject("USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
|
||||||
bbs.push_back(line.getSerializer().peekData());
|
bbs.push_back(line.getSerializer().peekData());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -381,8 +379,7 @@ TEST_F(RPCLedgerDataHandlerTest, OutOfOrder)
|
|||||||
ON_CALL(*rawBackendPtr, doFetchSuccessorKey(ripple::uint256{INDEX2}, RANGEMAX, _))
|
ON_CALL(*rawBackendPtr, doFetchSuccessorKey(ripple::uint256{INDEX2}, RANGEMAX, _))
|
||||||
.WillByDefault(Return(std::nullopt));
|
.WillByDefault(Return(std::nullopt));
|
||||||
|
|
||||||
auto const line =
|
auto const line = CreateRippleStateLedgerObject("USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
|
||||||
bbs.push_back(line.getSerializer().peekData());
|
bbs.push_back(line.getSerializer().peekData());
|
||||||
|
|
||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
ON_CALL(*rawBackendPtr, doFetchLedgerObjects).WillByDefault(Return(bbs));
|
||||||
@@ -416,7 +413,7 @@ TEST_F(RPCLedgerDataHandlerTest, Marker)
|
|||||||
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(1);
|
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(1);
|
||||||
ON_CALL(*rawBackendPtr, doFetchLedgerObject(ripple::uint256{INDEX1}, RANGEMAX, _))
|
ON_CALL(*rawBackendPtr, doFetchLedgerObject(ripple::uint256{INDEX1}, RANGEMAX, _))
|
||||||
.WillByDefault(
|
.WillByDefault(
|
||||||
Return(CreateRippleStateLedgerObject(ACCOUNT, "USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123)
|
Return(CreateRippleStateLedgerObject("USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123)
|
||||||
.getSerializer()
|
.getSerializer()
|
||||||
.peekData()));
|
.peekData()));
|
||||||
|
|
||||||
@@ -430,8 +427,7 @@ TEST_F(RPCLedgerDataHandlerTest, Marker)
|
|||||||
|
|
||||||
while (limit--)
|
while (limit--)
|
||||||
{
|
{
|
||||||
auto const line =
|
auto const line = CreateRippleStateLedgerObject("USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
|
||||||
bbs.push_back(line.getSerializer().peekData());
|
bbs.push_back(line.getSerializer().peekData());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -474,8 +470,7 @@ TEST_F(RPCLedgerDataHandlerTest, DiffMarker)
|
|||||||
|
|
||||||
while (limit--)
|
while (limit--)
|
||||||
{
|
{
|
||||||
auto const line =
|
auto const line = CreateRippleStateLedgerObject("USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
|
||||||
bbs.push_back(line.getSerializer().peekData());
|
bbs.push_back(line.getSerializer().peekData());
|
||||||
los.push_back(LedgerObject{ripple::uint256{INDEX2}, Blob{}});
|
los.push_back(LedgerObject{ripple::uint256{INDEX2}, Blob{}});
|
||||||
}
|
}
|
||||||
@@ -521,8 +516,7 @@ TEST_F(RPCLedgerDataHandlerTest, Binary)
|
|||||||
|
|
||||||
while (limit--)
|
while (limit--)
|
||||||
{
|
{
|
||||||
auto const line =
|
auto const line = CreateRippleStateLedgerObject("USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
|
||||||
bbs.push_back(line.getSerializer().peekData());
|
bbs.push_back(line.getSerializer().peekData());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -565,8 +559,7 @@ TEST_F(RPCLedgerDataHandlerTest, BinaryLimitMoreThanMax)
|
|||||||
|
|
||||||
while (limit--)
|
while (limit--)
|
||||||
{
|
{
|
||||||
auto const line =
|
auto const line = CreateRippleStateLedgerObject("USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
|
||||||
bbs.push_back(line.getSerializer().peekData());
|
bbs.push_back(line.getSerializer().peekData());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -610,8 +603,7 @@ TEST_F(RPCLedgerDataHandlerTest, JsonLimitMoreThanMax)
|
|||||||
|
|
||||||
while (limit--)
|
while (limit--)
|
||||||
{
|
{
|
||||||
auto const line =
|
auto const line = CreateRippleStateLedgerObject("USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ACCOUNT2, 10, ACCOUNT, 100, ACCOUNT2, 200, TXNID, 123);
|
|
||||||
bbs.push_back(line.getSerializer().peekData());
|
bbs.push_back(line.getSerializer().peekData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -861,7 +861,7 @@ generateTestValuesForNormalPathTest()
|
|||||||
ACCOUNT,
|
ACCOUNT,
|
||||||
ACCOUNT2),
|
ACCOUNT2),
|
||||||
ripple::keylet::line(account1, account2, currency).key,
|
ripple::keylet::line(account1, account2, currency).key,
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ACCOUNT2, 100, ACCOUNT, 10, ACCOUNT2, 20, INDEX1, 123, 0)},
|
CreateRippleStateLedgerObject("USD", ACCOUNT2, 100, ACCOUNT, 10, ACCOUNT2, 20, INDEX1, 123, 0)},
|
||||||
NormalPathTestBundle{
|
NormalPathTestBundle{
|
||||||
"Ticket",
|
"Ticket",
|
||||||
fmt::format(
|
fmt::format(
|
||||||
|
|||||||
@@ -1035,8 +1035,8 @@ TEST_F(RPCLedgerHandlerTest, OwnerFundsNotXRP)
|
|||||||
ON_CALL(*rawBackendPtr, fetchLedgerBySequence(RANGEMAX, _)).WillByDefault(Return(ledgerinfo));
|
ON_CALL(*rawBackendPtr, fetchLedgerBySequence(RANGEMAX, _)).WillByDefault(Return(ledgerinfo));
|
||||||
|
|
||||||
// mock line
|
// mock line
|
||||||
auto const line = CreateRippleStateLedgerObject(
|
auto const line =
|
||||||
ACCOUNT, CURRENCY, ACCOUNT2, 50 /*balance*/, ACCOUNT, 10, ACCOUNT2, 20, INDEX1, 123);
|
CreateRippleStateLedgerObject(CURRENCY, ACCOUNT2, 50 /*balance*/, ACCOUNT, 10, ACCOUNT2, 20, INDEX1, 123);
|
||||||
auto lineKey = ripple::keylet::line(
|
auto lineKey = ripple::keylet::line(
|
||||||
GetAccountIDWithString(ACCOUNT),
|
GetAccountIDWithString(ACCOUNT),
|
||||||
GetAccountIDWithString(ACCOUNT2),
|
GetAccountIDWithString(ACCOUNT2),
|
||||||
@@ -1090,7 +1090,6 @@ TEST_F(RPCLedgerHandlerTest, OwnerFundsIgnoreFreezeLine)
|
|||||||
|
|
||||||
// mock line freeze
|
// mock line freeze
|
||||||
auto const line = CreateRippleStateLedgerObject(
|
auto const line = CreateRippleStateLedgerObject(
|
||||||
ACCOUNT,
|
|
||||||
CURRENCY,
|
CURRENCY,
|
||||||
ACCOUNT2,
|
ACCOUNT2,
|
||||||
50 /*balance*/,
|
50 /*balance*/,
|
||||||
|
|||||||
@@ -332,10 +332,10 @@ TEST_F(RPCNoRippleCheckTest, NormalPathRoleUserDefaultRippleSetTrustLineNoRipple
|
|||||||
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(2);
|
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(2);
|
||||||
|
|
||||||
auto const line1 = CreateRippleStateLedgerObject(
|
auto const line1 = CreateRippleStateLedgerObject(
|
||||||
ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, ripple::lsfLowNoRipple);
|
"USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, ripple::lsfLowNoRipple);
|
||||||
|
|
||||||
auto const line2 = CreateRippleStateLedgerObject(
|
auto const line2 = CreateRippleStateLedgerObject(
|
||||||
ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, ripple::lsfLowNoRipple);
|
"USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, ripple::lsfLowNoRipple);
|
||||||
|
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
@@ -389,11 +389,9 @@ TEST_F(RPCNoRippleCheckTest, NormalPathRoleUserDefaultRippleUnsetTrustLineNoRipp
|
|||||||
.WillByDefault(Return(ownerDir.getSerializer().peekData()));
|
.WillByDefault(Return(ownerDir.getSerializer().peekData()));
|
||||||
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(2);
|
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(2);
|
||||||
|
|
||||||
auto const line1 =
|
auto const line1 = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
|
|
||||||
auto const line2 =
|
auto const line2 = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
|
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
@@ -451,10 +449,10 @@ TEST_F(RPCNoRippleCheckTest, NormalPathRoleGatewayDefaultRippleSetTrustLineNoRip
|
|||||||
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(2);
|
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(2);
|
||||||
|
|
||||||
auto const line1 = CreateRippleStateLedgerObject(
|
auto const line1 = CreateRippleStateLedgerObject(
|
||||||
ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, ripple::lsfLowNoRipple);
|
"USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, ripple::lsfLowNoRipple);
|
||||||
|
|
||||||
auto const line2 = CreateRippleStateLedgerObject(
|
auto const line2 = CreateRippleStateLedgerObject(
|
||||||
ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, ripple::lsfLowNoRipple);
|
"USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, ripple::lsfLowNoRipple);
|
||||||
|
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
@@ -508,11 +506,9 @@ TEST_F(RPCNoRippleCheckTest, NormalPathRoleGatewayDefaultRippleUnsetTrustLineNoR
|
|||||||
.WillByDefault(Return(ownerDir.getSerializer().peekData()));
|
.WillByDefault(Return(ownerDir.getSerializer().peekData()));
|
||||||
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(2);
|
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(2);
|
||||||
|
|
||||||
auto const line1 =
|
auto const line1 = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
|
|
||||||
auto const line2 =
|
auto const line2 = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, 0);
|
|
||||||
|
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
@@ -558,11 +554,9 @@ TEST_F(RPCNoRippleCheckTest, NormalPathRoleGatewayDefaultRippleUnsetTrustLineNoR
|
|||||||
.WillByDefault(Return(CreateFeeSettingBlob(1, 2, 3, 4, 0)));
|
.WillByDefault(Return(CreateFeeSettingBlob(1, 2, 3, 4, 0)));
|
||||||
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(3);
|
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(3);
|
||||||
|
|
||||||
auto const line1 =
|
auto const line1 = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT2, 10, ACCOUNT, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT2, 10, ACCOUNT, 20, TXNID, 123, 0);
|
|
||||||
|
|
||||||
auto const line2 =
|
auto const line2 = CreateRippleStateLedgerObject("USD", ISSUER, 100, ACCOUNT2, 10, ACCOUNT, 20, TXNID, 123, 0);
|
||||||
CreateRippleStateLedgerObject(ACCOUNT, "USD", ISSUER, 100, ACCOUNT2, 10, ACCOUNT, 20, TXNID, 123, 0);
|
|
||||||
|
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
@@ -611,10 +605,10 @@ TEST_F(RPCNoRippleCheckTest, NormalPathLimit)
|
|||||||
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(2);
|
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(2);
|
||||||
|
|
||||||
auto const line1 = CreateRippleStateLedgerObject(
|
auto const line1 = CreateRippleStateLedgerObject(
|
||||||
ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, ripple::lsfLowNoRipple);
|
"USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, ripple::lsfLowNoRipple);
|
||||||
|
|
||||||
auto const line2 = CreateRippleStateLedgerObject(
|
auto const line2 = CreateRippleStateLedgerObject(
|
||||||
ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, ripple::lsfLowNoRipple);
|
"USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, ripple::lsfLowNoRipple);
|
||||||
|
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
@@ -713,10 +707,10 @@ TEST_F(RPCNoRippleCheckTest, NormalPathTransactions)
|
|||||||
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(3);
|
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(3);
|
||||||
|
|
||||||
auto const line1 = CreateRippleStateLedgerObject(
|
auto const line1 = CreateRippleStateLedgerObject(
|
||||||
ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, ripple::lsfLowNoRipple);
|
"USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, ripple::lsfLowNoRipple);
|
||||||
|
|
||||||
auto const line2 = CreateRippleStateLedgerObject(
|
auto const line2 = CreateRippleStateLedgerObject(
|
||||||
ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, ripple::lsfLowNoRipple);
|
"USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, ripple::lsfLowNoRipple);
|
||||||
|
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
bbs.push_back(line1.getSerializer().peekData());
|
bbs.push_back(line1.getSerializer().peekData());
|
||||||
@@ -765,7 +759,7 @@ TEST_F(RPCNoRippleCheckTest, LimitMoreThanMax)
|
|||||||
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(2);
|
EXPECT_CALL(*rawBackendPtr, doFetchLedgerObject).Times(2);
|
||||||
|
|
||||||
auto const line1 = CreateRippleStateLedgerObject(
|
auto const line1 = CreateRippleStateLedgerObject(
|
||||||
ACCOUNT, "USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, ripple::lsfLowNoRipple);
|
"USD", ISSUER, 100, ACCOUNT, 10, ACCOUNT2, 20, TXNID, 123, ripple::lsfLowNoRipple);
|
||||||
|
|
||||||
std::vector<Blob> bbs;
|
std::vector<Blob> bbs;
|
||||||
for (auto i = 0; i < NoRippleCheckHandler::LIMIT_MAX + 1; i++)
|
for (auto i = 0; i < NoRippleCheckHandler::LIMIT_MAX + 1; i++)
|
||||||
|
|||||||
@@ -190,9 +190,9 @@ TEST_F(RPCServerInfoHandlerTest, NoFeesErrorsOutWithInternal)
|
|||||||
TEST_F(RPCServerInfoHandlerTest, DefaultOutputIsPresent)
|
TEST_F(RPCServerInfoHandlerTest, DefaultOutputIsPresent)
|
||||||
{
|
{
|
||||||
MockBackend* rawBackendPtr = static_cast<MockBackend*>(mockBackendPtr.get());
|
MockBackend* rawBackendPtr = static_cast<MockBackend*>(mockBackendPtr.get());
|
||||||
MockLoadBalancer* rawBalancerPtr = static_cast<MockLoadBalancer*>(mockLoadBalancerPtr.get());
|
MockLoadBalancer* rawBalancerPtr = mockLoadBalancerPtr.get();
|
||||||
MockCounters* rawCountersPtr = static_cast<MockCounters*>(mockCountersPtr.get());
|
MockCounters* rawCountersPtr = mockCountersPtr.get();
|
||||||
MockETLService* rawETLServicePtr = static_cast<MockETLService*>(mockETLServicePtr.get());
|
MockETLService* rawETLServicePtr = mockETLServicePtr.get();
|
||||||
|
|
||||||
mockBackendPtr->updateRange(10); // min
|
mockBackendPtr->updateRange(10); // min
|
||||||
mockBackendPtr->updateRange(30); // max
|
mockBackendPtr->updateRange(30); // max
|
||||||
@@ -234,9 +234,9 @@ TEST_F(RPCServerInfoHandlerTest, DefaultOutputIsPresent)
|
|||||||
TEST_F(RPCServerInfoHandlerTest, AmendmentBlockedIsPresentIfSet)
|
TEST_F(RPCServerInfoHandlerTest, AmendmentBlockedIsPresentIfSet)
|
||||||
{
|
{
|
||||||
MockBackend* rawBackendPtr = static_cast<MockBackend*>(mockBackendPtr.get());
|
MockBackend* rawBackendPtr = static_cast<MockBackend*>(mockBackendPtr.get());
|
||||||
MockLoadBalancer* rawBalancerPtr = static_cast<MockLoadBalancer*>(mockLoadBalancerPtr.get());
|
MockLoadBalancer* rawBalancerPtr = mockLoadBalancerPtr.get();
|
||||||
MockCounters* rawCountersPtr = static_cast<MockCounters*>(mockCountersPtr.get());
|
MockCounters* rawCountersPtr = mockCountersPtr.get();
|
||||||
MockETLService* rawETLServicePtr = static_cast<MockETLService*>(mockETLServicePtr.get());
|
MockETLService* rawETLServicePtr = mockETLServicePtr.get();
|
||||||
|
|
||||||
mockBackendPtr->updateRange(10); // min
|
mockBackendPtr->updateRange(10); // min
|
||||||
mockBackendPtr->updateRange(30); // max
|
mockBackendPtr->updateRange(30); // max
|
||||||
@@ -276,11 +276,10 @@ TEST_F(RPCServerInfoHandlerTest, AmendmentBlockedIsPresentIfSet)
|
|||||||
TEST_F(RPCServerInfoHandlerTest, AdminSectionPresentWhenAdminFlagIsSet)
|
TEST_F(RPCServerInfoHandlerTest, AdminSectionPresentWhenAdminFlagIsSet)
|
||||||
{
|
{
|
||||||
MockBackend* rawBackendPtr = static_cast<MockBackend*>(mockBackendPtr.get());
|
MockBackend* rawBackendPtr = static_cast<MockBackend*>(mockBackendPtr.get());
|
||||||
MockLoadBalancer* rawBalancerPtr = static_cast<MockLoadBalancer*>(mockLoadBalancerPtr.get());
|
MockLoadBalancer* rawBalancerPtr = mockLoadBalancerPtr.get();
|
||||||
MockCounters* rawCountersPtr = static_cast<MockCounters*>(mockCountersPtr.get());
|
MockCounters* rawCountersPtr = mockCountersPtr.get();
|
||||||
MockSubscriptionManager* rawSubscriptionManagerPtr =
|
MockSubscriptionManager* rawSubscriptionManagerPtr = mockSubscriptionManagerPtr.get();
|
||||||
static_cast<MockSubscriptionManager*>(mockSubscriptionManagerPtr.get());
|
MockETLService* rawETLServicePtr = mockETLServicePtr.get();
|
||||||
MockETLService* rawETLServicePtr = static_cast<MockETLService*>(mockETLServicePtr.get());
|
|
||||||
|
|
||||||
mockBackendPtr->updateRange(10); // min
|
mockBackendPtr->updateRange(10); // min
|
||||||
mockBackendPtr->updateRange(30); // max
|
mockBackendPtr->updateRange(30); // max
|
||||||
@@ -328,11 +327,10 @@ TEST_F(RPCServerInfoHandlerTest, AdminSectionPresentWhenAdminFlagIsSet)
|
|||||||
TEST_F(RPCServerInfoHandlerTest, RippledForwardedValuesPresent)
|
TEST_F(RPCServerInfoHandlerTest, RippledForwardedValuesPresent)
|
||||||
{
|
{
|
||||||
MockBackend* rawBackendPtr = static_cast<MockBackend*>(mockBackendPtr.get());
|
MockBackend* rawBackendPtr = static_cast<MockBackend*>(mockBackendPtr.get());
|
||||||
MockLoadBalancer* rawBalancerPtr = static_cast<MockLoadBalancer*>(mockLoadBalancerPtr.get());
|
MockLoadBalancer* rawBalancerPtr = mockLoadBalancerPtr.get();
|
||||||
MockCounters* rawCountersPtr = static_cast<MockCounters*>(mockCountersPtr.get());
|
MockCounters* rawCountersPtr = mockCountersPtr.get();
|
||||||
MockSubscriptionManager* rawSubscriptionManagerPtr =
|
MockSubscriptionManager* rawSubscriptionManagerPtr = mockSubscriptionManagerPtr.get();
|
||||||
static_cast<MockSubscriptionManager*>(mockSubscriptionManagerPtr.get());
|
MockETLService* rawETLServicePtr = mockETLServicePtr.get();
|
||||||
MockETLService* rawETLServicePtr = static_cast<MockETLService*>(mockETLServicePtr.get());
|
|
||||||
|
|
||||||
mockBackendPtr->updateRange(10); // min
|
mockBackendPtr->updateRange(10); // min
|
||||||
mockBackendPtr->updateRange(30); // max
|
mockBackendPtr->updateRange(30); // max
|
||||||
@@ -391,11 +389,10 @@ TEST_F(RPCServerInfoHandlerTest, RippledForwardedValuesPresent)
|
|||||||
TEST_F(RPCServerInfoHandlerTest, RippledForwardedValuesMissingNoExceptionThrown)
|
TEST_F(RPCServerInfoHandlerTest, RippledForwardedValuesMissingNoExceptionThrown)
|
||||||
{
|
{
|
||||||
MockBackend* rawBackendPtr = static_cast<MockBackend*>(mockBackendPtr.get());
|
MockBackend* rawBackendPtr = static_cast<MockBackend*>(mockBackendPtr.get());
|
||||||
MockLoadBalancer* rawBalancerPtr = static_cast<MockLoadBalancer*>(mockLoadBalancerPtr.get());
|
MockLoadBalancer* rawBalancerPtr = mockLoadBalancerPtr.get();
|
||||||
MockCounters* rawCountersPtr = static_cast<MockCounters*>(mockCountersPtr.get());
|
MockCounters* rawCountersPtr = mockCountersPtr.get();
|
||||||
MockSubscriptionManager* rawSubscriptionManagerPtr =
|
MockSubscriptionManager* rawSubscriptionManagerPtr = mockSubscriptionManagerPtr.get();
|
||||||
static_cast<MockSubscriptionManager*>(mockSubscriptionManagerPtr.get());
|
MockETLService* rawETLServicePtr = mockETLServicePtr.get();
|
||||||
MockETLService* rawETLServicePtr = static_cast<MockETLService*>(mockETLServicePtr.get());
|
|
||||||
|
|
||||||
mockBackendPtr->updateRange(10); // min
|
mockBackendPtr->updateRange(10); // min
|
||||||
mockBackendPtr->updateRange(30); // max
|
mockBackendPtr->updateRange(30); // max
|
||||||
|
|||||||
@@ -521,8 +521,7 @@ TEST_F(RPCUnsubscribeTest, Streams)
|
|||||||
"streams": ["transactions_proposed","transactions","validations","manifests","book_changes","ledger"]
|
"streams": ["transactions_proposed","transactions","validations","manifests","book_changes","ledger"]
|
||||||
})");
|
})");
|
||||||
|
|
||||||
MockSubscriptionManager* rawSubscriptionManagerPtr =
|
MockSubscriptionManager* rawSubscriptionManagerPtr = mockSubscriptionManagerPtr.get();
|
||||||
static_cast<MockSubscriptionManager*>(mockSubscriptionManagerPtr.get());
|
|
||||||
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubLedger).Times(1);
|
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubLedger).Times(1);
|
||||||
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubTransactions).Times(1);
|
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubTransactions).Times(1);
|
||||||
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubValidation).Times(1);
|
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubValidation).Times(1);
|
||||||
@@ -547,8 +546,7 @@ TEST_F(RPCUnsubscribeTest, Accounts)
|
|||||||
ACCOUNT,
|
ACCOUNT,
|
||||||
ACCOUNT2));
|
ACCOUNT2));
|
||||||
|
|
||||||
MockSubscriptionManager* rawSubscriptionManagerPtr =
|
MockSubscriptionManager* rawSubscriptionManagerPtr = mockSubscriptionManagerPtr.get();
|
||||||
static_cast<MockSubscriptionManager*>(mockSubscriptionManagerPtr.get());
|
|
||||||
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubAccount(rpc::accountFromStringStrict(ACCOUNT).value(), _)).Times(1);
|
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubAccount(rpc::accountFromStringStrict(ACCOUNT).value(), _)).Times(1);
|
||||||
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubAccount(rpc::accountFromStringStrict(ACCOUNT2).value(), _)).Times(1);
|
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubAccount(rpc::accountFromStringStrict(ACCOUNT2).value(), _)).Times(1);
|
||||||
|
|
||||||
@@ -569,8 +567,7 @@ TEST_F(RPCUnsubscribeTest, AccountsProposed)
|
|||||||
ACCOUNT,
|
ACCOUNT,
|
||||||
ACCOUNT2));
|
ACCOUNT2));
|
||||||
|
|
||||||
MockSubscriptionManager* rawSubscriptionManagerPtr =
|
MockSubscriptionManager* rawSubscriptionManagerPtr = mockSubscriptionManagerPtr.get();
|
||||||
static_cast<MockSubscriptionManager*>(mockSubscriptionManagerPtr.get());
|
|
||||||
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubProposedAccount(rpc::accountFromStringStrict(ACCOUNT).value(), _))
|
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubProposedAccount(rpc::accountFromStringStrict(ACCOUNT).value(), _))
|
||||||
.Times(1);
|
.Times(1);
|
||||||
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubProposedAccount(rpc::accountFromStringStrict(ACCOUNT2).value(), _))
|
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubProposedAccount(rpc::accountFromStringStrict(ACCOUNT2).value(), _))
|
||||||
@@ -606,8 +603,7 @@ TEST_F(RPCUnsubscribeTest, Books)
|
|||||||
auto const parsedBookMaybe = rpc::parseBook(input.as_object().at("books").as_array()[0].as_object());
|
auto const parsedBookMaybe = rpc::parseBook(input.as_object().at("books").as_array()[0].as_object());
|
||||||
auto const book = std::get<ripple::Book>(parsedBookMaybe);
|
auto const book = std::get<ripple::Book>(parsedBookMaybe);
|
||||||
|
|
||||||
MockSubscriptionManager* rawSubscriptionManagerPtr =
|
MockSubscriptionManager* rawSubscriptionManagerPtr = mockSubscriptionManagerPtr.get();
|
||||||
static_cast<MockSubscriptionManager*>(mockSubscriptionManagerPtr.get());
|
|
||||||
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubBook(book, _)).Times(1);
|
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubBook(book, _)).Times(1);
|
||||||
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubBook(ripple::reversed(book), _)).Times(1);
|
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubBook(ripple::reversed(book), _)).Times(1);
|
||||||
|
|
||||||
@@ -640,8 +636,7 @@ TEST_F(RPCUnsubscribeTest, SingleBooks)
|
|||||||
auto const parsedBookMaybe = rpc::parseBook(input.as_object().at("books").as_array()[0].as_object());
|
auto const parsedBookMaybe = rpc::parseBook(input.as_object().at("books").as_array()[0].as_object());
|
||||||
auto const book = std::get<ripple::Book>(parsedBookMaybe);
|
auto const book = std::get<ripple::Book>(parsedBookMaybe);
|
||||||
|
|
||||||
MockSubscriptionManager* rawSubscriptionManagerPtr =
|
MockSubscriptionManager* rawSubscriptionManagerPtr = mockSubscriptionManagerPtr.get();
|
||||||
static_cast<MockSubscriptionManager*>(mockSubscriptionManagerPtr.get());
|
|
||||||
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubBook(book, _)).Times(1);
|
EXPECT_CALL(*rawSubscriptionManagerPtr, unsubBook(book, _)).Times(1);
|
||||||
|
|
||||||
runSpawn([&, this](auto yield) {
|
runSpawn([&, this](auto yield) {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ struct MockSession : public web::ConnectionBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
send(std::string&& msg, boost::beast::http::status status = boost::beast::http::status::ok) override
|
send(std::string&& msg, boost::beast::http::status = boost::beast::http::status::ok) override
|
||||||
{
|
{
|
||||||
message += msg;
|
message += msg;
|
||||||
}
|
}
|
||||||
@@ -43,15 +43,14 @@ struct MockSession : public web::ConnectionBase
|
|||||||
|
|
||||||
struct MockDeadSession : public web::ConnectionBase
|
struct MockDeadSession : public web::ConnectionBase
|
||||||
{
|
{
|
||||||
void
|
void send(std::shared_ptr<std::string>) override
|
||||||
send(std::shared_ptr<std::string> _) override
|
|
||||||
{
|
{
|
||||||
// err happen, the session should remove from subscribers
|
// err happen, the session should remove from subscribers
|
||||||
ec_.assign(2, boost::system::system_category());
|
ec_.assign(2, boost::system::system_category());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
send(std::string&& _, boost::beast::http::status __ = boost::beast::http::status::ok) override
|
send(std::string&&, boost::beast::http::status = boost::beast::http::status::ok) override
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ ripple::uint256
|
|||||||
binaryStringToUint256(std::string const& bin)
|
binaryStringToUint256(std::string const& bin)
|
||||||
{
|
{
|
||||||
ripple::uint256 uint;
|
ripple::uint256 uint;
|
||||||
return uint.fromVoid((void const*)bin.data());
|
return uint.fromVoid(static_cast<void const*>(bin.data()));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
#include <boost/beast.hpp>
|
#include <boost/beast.hpp>
|
||||||
#include <boost/beast/http.hpp>
|
#include <boost/beast/http.hpp>
|
||||||
|
#include <boost/beast/ssl.hpp>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@@ -57,7 +58,7 @@ struct HttpSyncClient
|
|||||||
boost::beast::error_code ec;
|
boost::beast::error_code ec;
|
||||||
stream.socket().shutdown(tcp::socket::shutdown_both, ec);
|
stream.socket().shutdown(tcp::socket::shutdown_both, ec);
|
||||||
|
|
||||||
return std::string(res.body());
|
return res.body();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -107,7 +108,7 @@ public:
|
|||||||
struct HttpsSyncClient
|
struct HttpsSyncClient
|
||||||
{
|
{
|
||||||
static bool
|
static bool
|
||||||
verify_certificate(bool preverified, boost::asio::ssl::verify_context& ctx)
|
verify_certificate(bool /* preverified */, boost::asio::ssl::verify_context& /* ctx */)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -123,7 +124,11 @@ struct HttpsSyncClient
|
|||||||
tcp::resolver resolver(ioc);
|
tcp::resolver resolver(ioc);
|
||||||
boost::beast::ssl_stream<boost::beast::tcp_stream> stream(ioc, ctx);
|
boost::beast::ssl_stream<boost::beast::tcp_stream> stream(ioc, ctx);
|
||||||
|
|
||||||
|
// We can't fix this so have to ignore
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||||
if (!SSL_set_tlsext_host_name(stream.native_handle(), host.c_str()))
|
if (!SSL_set_tlsext_host_name(stream.native_handle(), host.c_str()))
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
{
|
{
|
||||||
boost::beast::error_code ec{static_cast<int>(::ERR_get_error()), net::error::get_ssl_category()};
|
boost::beast::error_code ec{static_cast<int>(::ERR_get_error()), net::error::get_ssl_category()};
|
||||||
throw boost::beast::system_error{ec};
|
throw boost::beast::system_error{ec};
|
||||||
@@ -147,7 +152,7 @@ struct HttpsSyncClient
|
|||||||
boost::beast::error_code ec;
|
boost::beast::error_code ec;
|
||||||
stream.shutdown(ec);
|
stream.shutdown(ec);
|
||||||
|
|
||||||
return std::string(res.body());
|
return res.body();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -334,7 +334,6 @@ CreatePaymentChannelLedgerObject(
|
|||||||
|
|
||||||
[[nodiscard]] ripple::STObject
|
[[nodiscard]] ripple::STObject
|
||||||
CreateRippleStateLedgerObject(
|
CreateRippleStateLedgerObject(
|
||||||
std::string_view accountId,
|
|
||||||
std::string_view currency,
|
std::string_view currency,
|
||||||
std::string_view issuerId,
|
std::string_view issuerId,
|
||||||
int balance,
|
int balance,
|
||||||
|
|||||||
@@ -172,7 +172,6 @@ CreatePaymentChannelLedgerObject(
|
|||||||
|
|
||||||
[[nodiscard]] ripple::STObject
|
[[nodiscard]] ripple::STObject
|
||||||
CreateRippleStateLedgerObject(
|
CreateRippleStateLedgerObject(
|
||||||
std::string_view accountId,
|
|
||||||
std::string_view currency,
|
std::string_view currency,
|
||||||
std::string_view issuerId,
|
std::string_view issuerId,
|
||||||
int balance,
|
int balance,
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
operator()(boost::beast::error_code ec, std::shared_ptr<web::ConnectionBase> const& ws)
|
operator()(boost::beast::error_code /* ec */, std::shared_ptr<web::ConnectionBase> const& /* ws */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -183,13 +183,13 @@ class ExceptionExecutor
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void
|
void
|
||||||
operator()(std::string const& req, std::shared_ptr<web::ConnectionBase> const& ws)
|
operator()(std::string const& /* req */, std::shared_ptr<web::ConnectionBase> const& /* ws */)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("MyError");
|
throw std::runtime_error("MyError");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
operator()(boost::beast::error_code ec, std::shared_ptr<web::ConnectionBase> const& ws)
|
operator()(boost::beast::error_code /* ec */, std::shared_ptr<web::ConnectionBase> const& /* ws */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user