mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-08 13:02:31 +00:00
Compare commits
66 Commits
bthomee/pi
...
mvadari/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1f1546c70 | ||
|
|
a29404c706 | ||
|
|
9ac820d96b | ||
|
|
9d4574a82c | ||
|
|
8deb43c358 | ||
|
|
cc120beed1 | ||
|
|
fa7e1fa3c0 | ||
|
|
61eddd76cb | ||
|
|
f934239276 | ||
|
|
01da501753 | ||
|
|
1bf9dbf7c2 | ||
|
|
c7b39df08f | ||
|
|
c7f9904112 | ||
|
|
26bdc7198c | ||
|
|
1868979227 | ||
|
|
e9a0f1fba5 | ||
|
|
45b35aef64 | ||
|
|
4e298efb85 | ||
|
|
319eb41df9 | ||
|
|
90d7d38e76 | ||
|
|
040231a6b8 | ||
|
|
77989d9dc5 | ||
|
|
72a61484ae | ||
|
|
d2f3d392eb | ||
|
|
83137a289a | ||
|
|
d24f40ac13 | ||
|
|
e46b3468ae | ||
|
|
e2a273dfa0 | ||
|
|
37e3f03764 | ||
|
|
a227fe826f | ||
|
|
840e4303e3 | ||
|
|
949ba8e335 | ||
|
|
bdc8dc3746 | ||
|
|
ff4125f7f8 | ||
|
|
e42f243913 | ||
|
|
b4fcf80df3 | ||
|
|
39dfcdfeb8 | ||
|
|
d4c2154d6e | ||
|
|
acd34177c8 | ||
|
|
36c4060d65 | ||
|
|
eb681adbd3 | ||
|
|
d78bc9e780 | ||
|
|
2b61b2257b | ||
|
|
100ad8b531 | ||
|
|
df5226692e | ||
|
|
eca65c04ee | ||
|
|
2d53099539 | ||
|
|
69dba2e36b | ||
|
|
fd2f2b1095 | ||
|
|
50f418f40b | ||
|
|
5154649ff0 | ||
|
|
96287e20be | ||
|
|
3e07a64339 | ||
|
|
c326a80abd | ||
|
|
efa2a1b4e7 | ||
|
|
8852594a7b | ||
|
|
711d765a80 | ||
|
|
400cd02325 | ||
|
|
2116ea6eae | ||
|
|
f1f2cc70ab | ||
|
|
9e23d50339 | ||
|
|
fb5d878b86 | ||
|
|
403bfaa636 | ||
|
|
9fb088cb42 | ||
|
|
e66cfab251 | ||
|
|
17e4d38dde |
@@ -26,6 +26,10 @@ This version is supported by all `rippled` versions. For WebSocket and HTTP JSON
|
||||
|
||||
This section contains changes targeting a future version.
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
- `book_offers`: the `proof` parameter has been removed from the CLI interface and is no longer processed by the server. For HTTP and WebSocket API requests, `proof` is still accepted and ignored if present, so this is not a breaking change.
|
||||
|
||||
### Additions
|
||||
|
||||
- `server_definitions`: Added the following new sections to the response ([#6321](https://github.com/XRPLF/rippled/pull/6321)):
|
||||
|
||||
@@ -149,7 +149,6 @@ public:
|
||||
std::shared_ptr<ReadView const>& lpLedger,
|
||||
Book const& book,
|
||||
AccountID const& uTakerID,
|
||||
bool const bProof,
|
||||
unsigned int iLimit,
|
||||
Json::Value const& jvMarker,
|
||||
Json::Value& jvResult) = 0;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -121,7 +121,7 @@ printHelp(po::options_description const& desc)
|
||||
"]]] [binary]\n"
|
||||
" book_changes [<ledger hash|id>]\n"
|
||||
" book_offers <taker_pays> <taker_gets> [<taker [<ledger> "
|
||||
"[<limit> [<proof> [<marker>]]]]]\n"
|
||||
"[<limit> [<marker>]]]]\n"
|
||||
" can_delete [<ledgerid>|<ledgerhash>|now|always|never]\n"
|
||||
" channel_authorize <private_key> <channel_id> <drops>\n"
|
||||
" channel_verify <public_key> <channel_id> <drops> <signature>\n"
|
||||
|
||||
@@ -352,7 +352,6 @@ public:
|
||||
std::shared_ptr<ReadView const>& lpLedger,
|
||||
Book const&,
|
||||
AccountID const& uTakerID,
|
||||
bool const bProof,
|
||||
unsigned int iLimit,
|
||||
Json::Value const& jvMarker,
|
||||
Json::Value& jvResult) override;
|
||||
@@ -4248,7 +4247,6 @@ NetworkOPsImp::getBookPage(
|
||||
std::shared_ptr<ReadView const>& lpLedger,
|
||||
Book const& book,
|
||||
AccountID const& uTakerID,
|
||||
bool const bProof,
|
||||
unsigned int iLimit,
|
||||
Json::Value const& jvMarker,
|
||||
Json::Value& jvResult)
|
||||
@@ -4452,7 +4450,6 @@ NetworkOPsImp::getBookPage(
|
||||
std::shared_ptr<ReadView const> lpLedger,
|
||||
Book const& book,
|
||||
AccountID const& uTakerID,
|
||||
bool const bProof,
|
||||
unsigned int iLimit,
|
||||
Json::Value const& jvMarker,
|
||||
Json::Value& jvResult)
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include <xrpl/protocol/PublicKey.h>
|
||||
#include <xrpl/protocol/RPCErr.h>
|
||||
#include <xrpl/protocol/SystemParameters.h>
|
||||
#include <xrpl/protocol/UintTypes.h>
|
||||
#include <xrpl/protocol/jss.h>
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
@@ -25,7 +24,7 @@
|
||||
|
||||
#include <array>
|
||||
#include <iostream>
|
||||
#include <type_traits>
|
||||
#include <limits>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace xrpl {
|
||||
@@ -129,6 +128,41 @@ private:
|
||||
std::string("Invalid currency/issuer '") + strCurrencyIssuer + "'");
|
||||
}
|
||||
|
||||
static std::optional<std::int32_t>
|
||||
jvParseInt(Json::Value const& param)
|
||||
{
|
||||
if (param.isInt())
|
||||
return param.asInt();
|
||||
|
||||
if (param.isUInt() && param.asUInt() <= std::numeric_limits<std::int32_t>::max())
|
||||
return param.asInt();
|
||||
|
||||
if (param.isString())
|
||||
{
|
||||
std::int32_t v = 0;
|
||||
if (beast::lexicalCastChecked(v, param.asString()))
|
||||
return v;
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static std::optional<std::uint32_t>
|
||||
jvParseUInt(Json::Value const& param)
|
||||
{
|
||||
if (param.isUInt() || (param.isInt() && param.asInt() >= 0))
|
||||
return param.asUInt();
|
||||
|
||||
if (param.isString())
|
||||
{
|
||||
std::uint32_t v = 0;
|
||||
if (beast::lexicalCastChecked(v, param.asString()))
|
||||
return v;
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static bool
|
||||
validPublicKey(std::string const& strPk, TokenType type = TokenType::AccountPublic)
|
||||
{
|
||||
@@ -262,31 +296,60 @@ private:
|
||||
}
|
||||
else
|
||||
{
|
||||
std::int64_t const uLedgerMin = jvParams[1u].asInt();
|
||||
std::int64_t const uLedgerMax = jvParams[2u].asInt();
|
||||
std::int32_t ledgerMin = 0,
|
||||
ledgerMax = 0; // note: these are only used when properly set
|
||||
if (auto const ledgerMinOpt = jvParseInt(jvParams[1u]); ledgerMinOpt.has_value())
|
||||
{
|
||||
ledgerMin = *ledgerMinOpt;
|
||||
}
|
||||
else
|
||||
{
|
||||
return rpcError(rpcINVALID_LGR_RANGE);
|
||||
}
|
||||
|
||||
if (uLedgerMax != -1 && uLedgerMax < uLedgerMin)
|
||||
if (auto const ledgerMaxOpt = jvParseInt(jvParams[2u]); ledgerMaxOpt.has_value())
|
||||
{
|
||||
ledgerMax = *ledgerMaxOpt;
|
||||
}
|
||||
else
|
||||
{
|
||||
return rpcError(rpcINVALID_LGR_RANGE);
|
||||
}
|
||||
|
||||
// `-1` means "most recent validated ledger version available"
|
||||
static std::int32_t const USE_MOST_RECENT_LEDGER = -1;
|
||||
if (ledgerMax != USE_MOST_RECENT_LEDGER && ledgerMax < ledgerMin)
|
||||
{
|
||||
if (apiVersion_ == 1)
|
||||
return rpcError(rpcLGR_IDXS_INVALID);
|
||||
return rpcError(rpcNOT_SYNCED);
|
||||
}
|
||||
|
||||
jvRequest[jss::ledger_index_min] = jvParams[1u].asInt();
|
||||
jvRequest[jss::ledger_index_max] = jvParams[2u].asInt();
|
||||
jvRequest[jss::ledger_index_min] = ledgerMin;
|
||||
jvRequest[jss::ledger_index_max] = ledgerMax;
|
||||
|
||||
if (iParams >= 4)
|
||||
jvRequest[jss::limit] = jvParams[3u].asInt();
|
||||
{
|
||||
if (auto const limit = jvParseUInt(jvParams[3u]))
|
||||
jvRequest[jss::limit] = *limit;
|
||||
else
|
||||
return RPC::invalid_field_error(jss::limit);
|
||||
}
|
||||
|
||||
if (iParams >= 5)
|
||||
jvRequest[jss::offset] = jvParams[4u].asInt();
|
||||
{
|
||||
if (auto const offset = jvParseInt(jvParams[4u]))
|
||||
jvRequest[jss::offset] = *offset;
|
||||
else
|
||||
return RPC::invalid_field_error(jss::offset);
|
||||
}
|
||||
}
|
||||
|
||||
return jvRequest;
|
||||
}
|
||||
|
||||
// book_offers <taker_pays> <taker_gets> [<taker> [<ledger> [<limit>
|
||||
// [<proof> [<marker>]]]]] limit: 0 = no limit proof: 0 or 1
|
||||
// [<marker>]]]] limit: 0 = no limit
|
||||
//
|
||||
// Mnemonic: taker pays --> offer --> taker gets
|
||||
Json::Value
|
||||
@@ -322,35 +385,16 @@ private:
|
||||
|
||||
if (jvParams.size() >= 5)
|
||||
{
|
||||
try
|
||||
if (auto const limit = jvParseUInt(jvParams[4u]))
|
||||
{
|
||||
int const iLimit = jvParams[4u].asInt();
|
||||
|
||||
if (iLimit > 0)
|
||||
jvRequest[jss::limit] = iLimit;
|
||||
jvRequest[jss::limit] = *limit;
|
||||
}
|
||||
catch (std::exception const&)
|
||||
{
|
||||
else
|
||||
return RPC::invalid_field_error(jss::limit);
|
||||
}
|
||||
}
|
||||
|
||||
if (jvParams.size() >= 6)
|
||||
{
|
||||
try
|
||||
{
|
||||
int const bProof = jvParams[5u].asInt();
|
||||
if (bProof != 0)
|
||||
jvRequest[jss::proof] = true;
|
||||
}
|
||||
catch (std::exception const&)
|
||||
{
|
||||
return RPC::invalid_field_error(jss::proof);
|
||||
}
|
||||
}
|
||||
|
||||
if (jvParams.size() == 7)
|
||||
jvRequest[jss::marker] = jvParams[6u];
|
||||
if (jvParams.size() == 6)
|
||||
jvRequest[jss::marker] = jvParams[5u];
|
||||
|
||||
return jvRequest;
|
||||
}
|
||||
@@ -368,7 +412,10 @@ private:
|
||||
std::string const input = jvParams[0u].asString();
|
||||
if (input.find_first_not_of("0123456789") == std::string::npos)
|
||||
{
|
||||
jvRequest["can_delete"] = jvParams[0u].asUInt();
|
||||
if (auto const seq = jvParseUInt(jvParams[0u]))
|
||||
jvRequest["can_delete"] = *seq;
|
||||
else
|
||||
return RPC::invalid_field_error(jss::can_delete);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -388,7 +435,10 @@ private:
|
||||
if (jvParams.size() == 2)
|
||||
{
|
||||
jvRequest[jss::ip] = ip;
|
||||
jvRequest[jss::port] = jvParams[1u].asUInt();
|
||||
if (auto const port = jvParseUInt(jvParams[1u]))
|
||||
jvRequest[jss::port] = *port;
|
||||
else
|
||||
return RPC::invalid_field_error(jss::port);
|
||||
return jvRequest;
|
||||
}
|
||||
|
||||
@@ -397,7 +447,13 @@ private:
|
||||
{
|
||||
std::size_t const colon = ip.find_last_of(':');
|
||||
jvRequest[jss::ip] = std::string{ip, 0, colon};
|
||||
jvRequest[jss::port] = Json::Value{std::string{ip, colon + 1}}.asUInt();
|
||||
|
||||
Json::Value const portJson(std::string{ip, colon + 1});
|
||||
if (auto const port = jvParseUInt(portJson))
|
||||
jvRequest[jss::port] = *port;
|
||||
else
|
||||
return RPC::invalid_field_error(jss::port);
|
||||
|
||||
return jvRequest;
|
||||
}
|
||||
|
||||
@@ -479,8 +535,13 @@ private:
|
||||
{
|
||||
Json::Value jvRequest(Json::objectValue);
|
||||
|
||||
if (jvParams.size() != 0u)
|
||||
jvRequest[jss::min_count] = jvParams[0u].asUInt();
|
||||
if (jvParams.size())
|
||||
{
|
||||
if (auto const minCount = jvParseUInt(jvParams[0u]))
|
||||
jvRequest[jss::min_count] = *minCount;
|
||||
else
|
||||
return RPC::invalid_field_error(jss::min_count);
|
||||
}
|
||||
|
||||
return jvRequest;
|
||||
}
|
||||
@@ -1107,7 +1168,10 @@ private:
|
||||
{
|
||||
Json::Value jvRequest{Json::objectValue};
|
||||
|
||||
jvRequest[jss::start] = jvParams[0u].asUInt();
|
||||
if (auto const start = jvParseUInt(jvParams[0u]))
|
||||
jvRequest[jss::start] = *start;
|
||||
else
|
||||
return RPC::invalid_field_error(jss::start);
|
||||
|
||||
return jvRequest;
|
||||
}
|
||||
@@ -1260,7 +1324,7 @@ public:
|
||||
{"amm_info", &RPCParser::parseAsIs, 1, 2},
|
||||
{"vault_info", &RPCParser::parseVault, 1, 2},
|
||||
{"book_changes", &RPCParser::parseLedgerId, 1, 1},
|
||||
{"book_offers", &RPCParser::parseBookOffers, 2, 7},
|
||||
{"book_offers", &RPCParser::parseBookOffers, 2, 6},
|
||||
{"can_delete", &RPCParser::parseCanDelete, 0, 1},
|
||||
{"channel_authorize", &RPCParser::parseChannelAuthorize, 3, 4},
|
||||
{"channel_verify", &RPCParser::parseChannelVerify, 4, 4},
|
||||
|
||||
@@ -184,8 +184,6 @@ doBookOffers(RPC::JsonContext& context)
|
||||
if (auto err = readLimitField(limit, RPC::Tuning::bookOffers, context))
|
||||
return *err;
|
||||
|
||||
bool const bProof(context.params.isMember(jss::proof));
|
||||
|
||||
Json::Value const jvMarker(
|
||||
context.params.isMember(jss::marker) ? context.params[jss::marker]
|
||||
: Json::Value(Json::nullValue));
|
||||
@@ -194,7 +192,6 @@ doBookOffers(RPC::JsonContext& context)
|
||||
lpLedger,
|
||||
{{pay_currency, pay_issuer}, {get_currency, get_issuer}, domain},
|
||||
takerID ? *takerID : beast::zero,
|
||||
bProof,
|
||||
limit,
|
||||
jvMarker,
|
||||
jvResult);
|
||||
|
||||
@@ -316,7 +316,6 @@ doSubscribe(RPC::JsonContext& context)
|
||||
lpLedger,
|
||||
field == jss::asks ? reversed(book) : book,
|
||||
takerID ? *takerID : noAccount(),
|
||||
false,
|
||||
RPC::Tuning::bookOffers.rDefault,
|
||||
jvMarker,
|
||||
jvOffers);
|
||||
|
||||
Reference in New Issue
Block a user