mirror of
https://github.com/Xahau/xahaud.git
synced 2026-07-29 10:00:09 +00:00
refactor: clean up LedgerEntry.cpp (#5199)
Refactors LedgerEntry to make it easier to read and understand.
This commit is contained in:
@@ -83,11 +83,13 @@ The [commandline](https://xrpl.org/docs/references/http-websocket-apis/api-conve
|
||||
|
||||
The `network_id` field was added in the `server_info` response in version 1.5.0 (2019), but it is not returned in [reporting mode](https://xrpl.org/rippled-server-modes.html#reporting-mode). However, use of reporting mode is now discouraged, in favor of using [Clio](https://github.com/XRPLF/clio) instead.
|
||||
|
||||
## XRP Ledger server version 2.2.0
|
||||
## XRP Ledger server version 2.4.0
|
||||
|
||||
The following is a non-breaking addition to the API.
|
||||
### Addition in 2.4
|
||||
|
||||
- The `feature` method now has a non-admin mode for users. (It was previously only available to admin connections.) The method returns an updated list of amendments, including their names and other information. ([#4781](https://github.com/XRPLF/rippled/pull/4781))
|
||||
- `ledger_entry`: `state` is added an alias for `ripple_state`.
|
||||
|
||||
## XRP Ledger server version 2.3.0
|
||||
|
||||
### Breaking change in 2.3
|
||||
|
||||
@@ -105,6 +107,12 @@ The following additions are non-breaking (because they are purely additive).
|
||||
- In `Payment` transactions, `DeliverMax` has been added. This is a replacement for the `Amount` field, which should not be used. Typically, the `delivered_amount` (in transaction metadata) should be used. To ease the transition, `DeliverMax` is present regardless of API version, since adding a field is non-breaking.
|
||||
- API version 2 has been moved from beta to supported, meaning that it is generally available (regardless of the `beta_rpc_api` setting).
|
||||
|
||||
## XRP Ledger server version 2.2.0
|
||||
|
||||
The following is a non-breaking addition to the API.
|
||||
|
||||
- The `feature` method now has a non-admin mode for users. (It was previously only available to admin connections.) The method returns an updated list of amendments, including their names and other information. ([#4781](https://github.com/XRPLF/rippled/pull/4781))
|
||||
|
||||
## XRP Ledger server version 1.12.0
|
||||
|
||||
[Version 1.12.0](https://github.com/XRPLF/rippled/releases/tag/1.12.0) was released on Sep 6, 2023. The following additions are non-breaking (because they are purely additive).
|
||||
|
||||
@@ -254,8 +254,8 @@ TxMeta::addRaw(Serializer& s, TER result, std::uint32_t index)
|
||||
mResult = TERtoInt(result);
|
||||
mIndex = index;
|
||||
ASSERT(
|
||||
(mResult == 0 || mResult == 1) ||
|
||||
((mResult > 100) && (mResult <= 255)),"ripple::TxMeta::addRaw : valid TER input");
|
||||
(mResult == 0 || mResult == 1) || ((mResult > 100) && (mResult <= 255)),
|
||||
"ripple::TxMeta::addRaw : valid TER input");
|
||||
|
||||
mNodes.sort([](STObject const& o1, STObject const& o2) {
|
||||
return o1.getFieldH256(sfLedgerIndex) < o2.getFieldH256(sfLedgerIndex);
|
||||
|
||||
@@ -2323,160 +2323,164 @@ public:
|
||||
env(pay(gw, alice, USD(97)));
|
||||
env.close();
|
||||
|
||||
std::string const ledgerHash{to_string(env.closed()->info().hash)};
|
||||
// check both aliases
|
||||
for (auto const& fieldName : {jss::ripple_state, jss::state})
|
||||
{
|
||||
// Request the trust line using the accounts and currency.
|
||||
Json::Value jvParams;
|
||||
jvParams[jss::ripple_state] = Json::objectValue;
|
||||
jvParams[jss::ripple_state][jss::accounts] = Json::arrayValue;
|
||||
jvParams[jss::ripple_state][jss::accounts][0u] = alice.human();
|
||||
jvParams[jss::ripple_state][jss::accounts][1u] = gw.human();
|
||||
jvParams[jss::ripple_state][jss::currency] = "USD";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
BEAST_EXPECT(
|
||||
jrr[jss::node][sfBalance.jsonName][jss::value] == "-97");
|
||||
BEAST_EXPECT(
|
||||
jrr[jss::node][sfHighLimit.jsonName][jss::value] == "999");
|
||||
}
|
||||
{
|
||||
// ripple_state is not an object.
|
||||
Json::Value jvParams;
|
||||
jvParams[jss::ripple_state] = "ripple_state";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedRequest", "");
|
||||
}
|
||||
{
|
||||
// ripple_state.currency is missing.
|
||||
Json::Value jvParams;
|
||||
jvParams[jss::ripple_state] = Json::objectValue;
|
||||
jvParams[jss::ripple_state][jss::accounts] = Json::arrayValue;
|
||||
jvParams[jss::ripple_state][jss::accounts][0u] = alice.human();
|
||||
jvParams[jss::ripple_state][jss::accounts][1u] = gw.human();
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedRequest", "");
|
||||
}
|
||||
{
|
||||
// ripple_state accounts is not an array.
|
||||
Json::Value jvParams;
|
||||
jvParams[jss::ripple_state] = Json::objectValue;
|
||||
jvParams[jss::ripple_state][jss::accounts] = 2;
|
||||
jvParams[jss::ripple_state][jss::currency] = "USD";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedRequest", "");
|
||||
}
|
||||
{
|
||||
// ripple_state one of the accounts is missing.
|
||||
Json::Value jvParams;
|
||||
jvParams[jss::ripple_state] = Json::objectValue;
|
||||
jvParams[jss::ripple_state][jss::accounts] = Json::arrayValue;
|
||||
jvParams[jss::ripple_state][jss::accounts][0u] = alice.human();
|
||||
jvParams[jss::ripple_state][jss::currency] = "USD";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedRequest", "");
|
||||
}
|
||||
{
|
||||
// ripple_state more than 2 accounts.
|
||||
Json::Value jvParams;
|
||||
jvParams[jss::ripple_state] = Json::objectValue;
|
||||
jvParams[jss::ripple_state][jss::accounts] = Json::arrayValue;
|
||||
jvParams[jss::ripple_state][jss::accounts][0u] = alice.human();
|
||||
jvParams[jss::ripple_state][jss::accounts][1u] = gw.human();
|
||||
jvParams[jss::ripple_state][jss::accounts][2u] = alice.human();
|
||||
jvParams[jss::ripple_state][jss::currency] = "USD";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedRequest", "");
|
||||
}
|
||||
{
|
||||
// ripple_state account[0] is not a string.
|
||||
Json::Value jvParams;
|
||||
jvParams[jss::ripple_state] = Json::objectValue;
|
||||
jvParams[jss::ripple_state][jss::accounts] = Json::arrayValue;
|
||||
jvParams[jss::ripple_state][jss::accounts][0u] = 44;
|
||||
jvParams[jss::ripple_state][jss::accounts][1u] = gw.human();
|
||||
jvParams[jss::ripple_state][jss::currency] = "USD";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedRequest", "");
|
||||
}
|
||||
{
|
||||
// ripple_state account[1] is not a string.
|
||||
Json::Value jvParams;
|
||||
jvParams[jss::ripple_state] = Json::objectValue;
|
||||
jvParams[jss::ripple_state][jss::accounts] = Json::arrayValue;
|
||||
jvParams[jss::ripple_state][jss::accounts][0u] = alice.human();
|
||||
jvParams[jss::ripple_state][jss::accounts][1u] = 21;
|
||||
jvParams[jss::ripple_state][jss::currency] = "USD";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedRequest", "");
|
||||
}
|
||||
{
|
||||
// ripple_state account[0] == account[1].
|
||||
Json::Value jvParams;
|
||||
jvParams[jss::ripple_state] = Json::objectValue;
|
||||
jvParams[jss::ripple_state][jss::accounts] = Json::arrayValue;
|
||||
jvParams[jss::ripple_state][jss::accounts][0u] = alice.human();
|
||||
jvParams[jss::ripple_state][jss::accounts][1u] = alice.human();
|
||||
jvParams[jss::ripple_state][jss::currency] = "USD";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedRequest", "");
|
||||
}
|
||||
{
|
||||
// ripple_state malformed account[0].
|
||||
Json::Value jvParams;
|
||||
jvParams[jss::ripple_state] = Json::objectValue;
|
||||
jvParams[jss::ripple_state][jss::accounts] = Json::arrayValue;
|
||||
jvParams[jss::ripple_state][jss::accounts][0u] =
|
||||
makeBadAddress(alice.human());
|
||||
jvParams[jss::ripple_state][jss::accounts][1u] = gw.human();
|
||||
jvParams[jss::ripple_state][jss::currency] = "USD";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedAddress", "");
|
||||
}
|
||||
{
|
||||
// ripple_state malformed account[1].
|
||||
Json::Value jvParams;
|
||||
jvParams[jss::ripple_state] = Json::objectValue;
|
||||
jvParams[jss::ripple_state][jss::accounts] = Json::arrayValue;
|
||||
jvParams[jss::ripple_state][jss::accounts][0u] = alice.human();
|
||||
jvParams[jss::ripple_state][jss::accounts][1u] =
|
||||
makeBadAddress(gw.human());
|
||||
jvParams[jss::ripple_state][jss::currency] = "USD";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedAddress", "");
|
||||
}
|
||||
{
|
||||
// ripple_state malformed currency.
|
||||
Json::Value jvParams;
|
||||
jvParams[jss::ripple_state] = Json::objectValue;
|
||||
jvParams[jss::ripple_state][jss::accounts] = Json::arrayValue;
|
||||
jvParams[jss::ripple_state][jss::accounts][0u] = alice.human();
|
||||
jvParams[jss::ripple_state][jss::accounts][1u] = gw.human();
|
||||
jvParams[jss::ripple_state][jss::currency] = "USDollars";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedCurrency", "");
|
||||
std::string const ledgerHash{to_string(env.closed()->info().hash)};
|
||||
{
|
||||
// Request the trust line using the accounts and currency.
|
||||
Json::Value jvParams;
|
||||
jvParams[fieldName] = Json::objectValue;
|
||||
jvParams[fieldName][jss::accounts] = Json::arrayValue;
|
||||
jvParams[fieldName][jss::accounts][0u] = alice.human();
|
||||
jvParams[fieldName][jss::accounts][1u] = gw.human();
|
||||
jvParams[fieldName][jss::currency] = "USD";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
BEAST_EXPECT(
|
||||
jrr[jss::node][sfBalance.jsonName][jss::value] == "-97");
|
||||
BEAST_EXPECT(
|
||||
jrr[jss::node][sfHighLimit.jsonName][jss::value] == "999");
|
||||
}
|
||||
{
|
||||
// ripple_state is not an object.
|
||||
Json::Value jvParams;
|
||||
jvParams[fieldName] = "ripple_state";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedRequest", "");
|
||||
}
|
||||
{
|
||||
// ripple_state.currency is missing.
|
||||
Json::Value jvParams;
|
||||
jvParams[fieldName] = Json::objectValue;
|
||||
jvParams[fieldName][jss::accounts] = Json::arrayValue;
|
||||
jvParams[fieldName][jss::accounts][0u] = alice.human();
|
||||
jvParams[fieldName][jss::accounts][1u] = gw.human();
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedRequest", "");
|
||||
}
|
||||
{
|
||||
// ripple_state accounts is not an array.
|
||||
Json::Value jvParams;
|
||||
jvParams[fieldName] = Json::objectValue;
|
||||
jvParams[fieldName][jss::accounts] = 2;
|
||||
jvParams[fieldName][jss::currency] = "USD";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedRequest", "");
|
||||
}
|
||||
{
|
||||
// ripple_state one of the accounts is missing.
|
||||
Json::Value jvParams;
|
||||
jvParams[fieldName] = Json::objectValue;
|
||||
jvParams[fieldName][jss::accounts] = Json::arrayValue;
|
||||
jvParams[fieldName][jss::accounts][0u] = alice.human();
|
||||
jvParams[fieldName][jss::currency] = "USD";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedRequest", "");
|
||||
}
|
||||
{
|
||||
// ripple_state more than 2 accounts.
|
||||
Json::Value jvParams;
|
||||
jvParams[fieldName] = Json::objectValue;
|
||||
jvParams[fieldName][jss::accounts] = Json::arrayValue;
|
||||
jvParams[fieldName][jss::accounts][0u] = alice.human();
|
||||
jvParams[fieldName][jss::accounts][1u] = gw.human();
|
||||
jvParams[fieldName][jss::accounts][2u] = alice.human();
|
||||
jvParams[fieldName][jss::currency] = "USD";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedRequest", "");
|
||||
}
|
||||
{
|
||||
// ripple_state account[0] is not a string.
|
||||
Json::Value jvParams;
|
||||
jvParams[fieldName] = Json::objectValue;
|
||||
jvParams[fieldName][jss::accounts] = Json::arrayValue;
|
||||
jvParams[fieldName][jss::accounts][0u] = 44;
|
||||
jvParams[fieldName][jss::accounts][1u] = gw.human();
|
||||
jvParams[fieldName][jss::currency] = "USD";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedRequest", "");
|
||||
}
|
||||
{
|
||||
// ripple_state account[1] is not a string.
|
||||
Json::Value jvParams;
|
||||
jvParams[fieldName] = Json::objectValue;
|
||||
jvParams[fieldName][jss::accounts] = Json::arrayValue;
|
||||
jvParams[fieldName][jss::accounts][0u] = alice.human();
|
||||
jvParams[fieldName][jss::accounts][1u] = 21;
|
||||
jvParams[fieldName][jss::currency] = "USD";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedRequest", "");
|
||||
}
|
||||
{
|
||||
// ripple_state account[0] == account[1].
|
||||
Json::Value jvParams;
|
||||
jvParams[fieldName] = Json::objectValue;
|
||||
jvParams[fieldName][jss::accounts] = Json::arrayValue;
|
||||
jvParams[fieldName][jss::accounts][0u] = alice.human();
|
||||
jvParams[fieldName][jss::accounts][1u] = alice.human();
|
||||
jvParams[fieldName][jss::currency] = "USD";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedRequest", "");
|
||||
}
|
||||
{
|
||||
// ripple_state malformed account[0].
|
||||
Json::Value jvParams;
|
||||
jvParams[fieldName] = Json::objectValue;
|
||||
jvParams[fieldName][jss::accounts] = Json::arrayValue;
|
||||
jvParams[fieldName][jss::accounts][0u] =
|
||||
makeBadAddress(alice.human());
|
||||
jvParams[fieldName][jss::accounts][1u] = gw.human();
|
||||
jvParams[fieldName][jss::currency] = "USD";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedAddress", "");
|
||||
}
|
||||
{
|
||||
// ripple_state malformed account[1].
|
||||
Json::Value jvParams;
|
||||
jvParams[fieldName] = Json::objectValue;
|
||||
jvParams[fieldName][jss::accounts] = Json::arrayValue;
|
||||
jvParams[fieldName][jss::accounts][0u] = alice.human();
|
||||
jvParams[fieldName][jss::accounts][1u] =
|
||||
makeBadAddress(gw.human());
|
||||
jvParams[fieldName][jss::currency] = "USD";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedAddress", "");
|
||||
}
|
||||
{
|
||||
// ripple_state malformed currency.
|
||||
Json::Value jvParams;
|
||||
jvParams[fieldName] = Json::objectValue;
|
||||
jvParams[fieldName][jss::accounts] = Json::arrayValue;
|
||||
jvParams[fieldName][jss::accounts][0u] = alice.human();
|
||||
jvParams[fieldName][jss::accounts][1u] = gw.human();
|
||||
jvParams[fieldName][jss::currency] = "USDollars";
|
||||
jvParams[jss::ledger_hash] = ledgerHash;
|
||||
Json::Value const jrr = env.rpc(
|
||||
"json", "ledger_entry", to_string(jvParams))[jss::result];
|
||||
checkErrorValue(jrr, "malformedCurrency", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3694,6 +3698,33 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
testLedgerEntryCLI()
|
||||
{
|
||||
testcase("ledger_entry command-line");
|
||||
using namespace test::jtx;
|
||||
|
||||
Env env{*this};
|
||||
Account const alice{"alice"};
|
||||
env.fund(XRP(10000), alice);
|
||||
env.close();
|
||||
|
||||
auto const checkId = keylet::check(env.master, env.seq(env.master));
|
||||
|
||||
env(check::create(env.master, alice, XRP(100)));
|
||||
env.close();
|
||||
|
||||
std::string const ledgerHash{to_string(env.closed()->info().hash)};
|
||||
{
|
||||
// Request a check.
|
||||
Json::Value const jrr =
|
||||
env.rpc("ledger_entry", to_string(checkId.key))[jss::result];
|
||||
BEAST_EXPECT(
|
||||
jrr[jss::node][sfLedgerEntryType.jsonName] == jss::Check);
|
||||
BEAST_EXPECT(jrr[jss::node][sfSendMax.jsonName] == "100000000");
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
void
|
||||
run() override
|
||||
@@ -3730,6 +3761,7 @@ public:
|
||||
testInvalidOracleLedgerEntry();
|
||||
testOracleLedgerEntry();
|
||||
testLedgerEntryMPT();
|
||||
testLedgerEntryCLI();
|
||||
|
||||
forAllApiVersions(std::bind_front(
|
||||
&LedgerRPC_test::testLedgerEntryInvalidParams, this));
|
||||
|
||||
@@ -732,7 +732,9 @@ public:
|
||||
beast::Journal const& j)
|
||||
{
|
||||
// HookExecutor can only execute once
|
||||
ASSERT(!spent, "HookExecutor::executeWasm : HookExecutor can only execute once");
|
||||
ASSERT(
|
||||
!spent,
|
||||
"HookExecutor::executeWasm : HookExecutor can only execute once");
|
||||
|
||||
spent = true;
|
||||
|
||||
|
||||
@@ -1136,7 +1136,9 @@ finishLoadByIndexOrHash(
|
||||
if (!ledger)
|
||||
return;
|
||||
|
||||
ASSERT(ledger->read(keylet::fees()), "ripple::finishLoadByIndexOrHash : valid ledger fees");
|
||||
ASSERT(
|
||||
ledger->read(keylet::fees()),
|
||||
"ripple::finishLoadByIndexOrHash : valid ledger fees");
|
||||
ledger->setImmutable();
|
||||
|
||||
JLOG(j.trace()) << "Loaded ledger: " << to_string(ledger->info().hash);
|
||||
|
||||
@@ -75,7 +75,9 @@ buildLedgerImpl(
|
||||
built->unshare();
|
||||
|
||||
// Accept ledger
|
||||
ASSERT(built->read(keylet::fees()), "ripple::buildLedgerImpl : valid ledger fees");
|
||||
ASSERT(
|
||||
built->read(keylet::fees()),
|
||||
"ripple::buildLedgerImpl : valid ledger fees");
|
||||
built->setAccepted(closeTime, closeResolution, closeTimeCorrect);
|
||||
|
||||
return built;
|
||||
|
||||
@@ -120,7 +120,9 @@ InboundLedger::init(ScopedLockType& collectionLock)
|
||||
|
||||
JLOG(journal_.debug()) << "Acquiring ledger we already have in "
|
||||
<< " local store. " << hash_;
|
||||
ASSERT(mLedger->read(keylet::fees()), "ripple::InboundLedger::init : valid ledger fees");
|
||||
ASSERT(
|
||||
mLedger->read(keylet::fees()),
|
||||
"ripple::InboundLedger::init : valid ledger fees");
|
||||
mLedger->setImmutable();
|
||||
|
||||
if (mReason == Reason::HISTORY)
|
||||
@@ -349,7 +351,9 @@ InboundLedger::tryDB(NodeStore::Database& srcDB)
|
||||
{
|
||||
JLOG(journal_.debug()) << "Had everything locally";
|
||||
complete_ = true;
|
||||
ASSERT(mLedger->read(keylet::fees()), "ripple::InboundLedger::tryDB : valid ledger fees");
|
||||
ASSERT(
|
||||
mLedger->read(keylet::fees()),
|
||||
"ripple::InboundLedger::tryDB : valid ledger fees");
|
||||
mLedger->setImmutable();
|
||||
}
|
||||
}
|
||||
@@ -449,7 +453,9 @@ InboundLedger::done()
|
||||
|
||||
if (complete_ && !failed_ && mLedger)
|
||||
{
|
||||
ASSERT(mLedger->read(keylet::fees()), "ripple::InboundLedger::done : valid ledger fees");
|
||||
ASSERT(
|
||||
mLedger->read(keylet::fees()),
|
||||
"ripple::InboundLedger::done : valid ledger fees");
|
||||
mLedger->setImmutable();
|
||||
switch (mReason)
|
||||
{
|
||||
|
||||
@@ -1733,7 +1733,9 @@ ApplicationImp::startGenesisLedger()
|
||||
auto const next =
|
||||
std::make_shared<Ledger>(*genesis, timeKeeper().closeTime());
|
||||
next->updateSkipList();
|
||||
ASSERT(next->read(keylet::fees()), "ripple::ApplicationImp::startGenesisLedger : valid ledger fees");
|
||||
ASSERT(
|
||||
next->read(keylet::fees()),
|
||||
"ripple::ApplicationImp::startGenesisLedger : valid ledger fees");
|
||||
next->setImmutable();
|
||||
openLedger_.emplace(next, cachedSLEs_, logs_->journal("OpenLedger"));
|
||||
m_ledgerMaster->storeLedger(next);
|
||||
@@ -1781,7 +1783,9 @@ ApplicationImp::getLastFullLedger()
|
||||
if (!ledger)
|
||||
return ledger;
|
||||
|
||||
ASSERT(ledger->read(keylet::fees()), "ripple::ApplicationImp::getLastFullLedger : valid ledger fees");
|
||||
ASSERT(
|
||||
ledger->read(keylet::fees()),
|
||||
"ripple::ApplicationImp::getLastFullLedger : valid ledger fees");
|
||||
ledger->setImmutable();
|
||||
|
||||
if (getLedgerMaster().haveLedger(seq))
|
||||
@@ -1933,7 +1937,9 @@ ApplicationImp::loadLedgerFromFile(std::string const& name)
|
||||
|
||||
loadLedger->stateMap().flushDirty(hotACCOUNT_NODE);
|
||||
|
||||
ASSERT(loadLedger->read(keylet::fees()), "ripple::ApplicationImp::loadLedgerFromFile : valid ledger fees");
|
||||
ASSERT(
|
||||
loadLedger->read(keylet::fees()),
|
||||
"ripple::ApplicationImp::loadLedgerFromFile : valid ledger fees");
|
||||
loadLedger->setAccepted(
|
||||
closeTime, closeTimeResolution, !closeTimeEstimated);
|
||||
|
||||
@@ -2061,7 +2067,9 @@ ApplicationImp::loadLedgerFromJson(std::string const& jsonValue)
|
||||
|
||||
loadLedger->stateMap().flushDirty(hotACCOUNT_NODE);
|
||||
|
||||
ASSERT(loadLedger->read(keylet::fees()), "ripple::ApplicationImp::loadLedgerFromFile : valid ledger fees");
|
||||
ASSERT(
|
||||
loadLedger->read(keylet::fees()),
|
||||
"ripple::ApplicationImp::loadLedgerFromFile : valid ledger fees");
|
||||
loadLedger->setAccepted(
|
||||
closeTime, closeTimeResolution, !closeTimeEstimated);
|
||||
|
||||
|
||||
@@ -225,7 +225,8 @@ public:
|
||||
if (!ledger->info().accountHash.isNonZero())
|
||||
{
|
||||
JLOG(j.fatal()) << "AH is zero: " << getJson({*ledger, {}});
|
||||
UNREACHABLE("RWDBDatabase::saveValidatedLedger : account hash is zero");
|
||||
UNREACHABLE(
|
||||
"RWDBDatabase::saveValidatedLedger : account hash is zero");
|
||||
}
|
||||
|
||||
if (ledger->info().accountHash !=
|
||||
@@ -235,10 +236,13 @@ public:
|
||||
<< " != " << ledger->stateMap().getHash();
|
||||
JLOG(j.fatal())
|
||||
<< "saveAcceptedLedger: seq=" << seq << ", current=" << current;
|
||||
UNREACHABLE("RWDBDatabase::saveValidatedLedger : account hash mismatch");
|
||||
UNREACHABLE(
|
||||
"RWDBDatabase::saveValidatedLedger : account hash mismatch");
|
||||
}
|
||||
|
||||
ASSERT(ledger->info().txHash == ledger->txMap().getHash().as_uint256(), "RWDBDatabase::saveValidatedLedger : tx hash mismatch");
|
||||
ASSERT(
|
||||
ledger->info().txHash == ledger->txMap().getHash().as_uint256(),
|
||||
"RWDBDatabase::saveValidatedLedger : tx hash mismatch");
|
||||
|
||||
// Save the ledger header in the hashed object store
|
||||
{
|
||||
|
||||
@@ -1087,7 +1087,10 @@ CreateOffer::applyGuts(Sandbox& sb, Sandbox& sbCancel)
|
||||
|
||||
// We expect the implementation of cross to succeed
|
||||
// or give a tec.
|
||||
ASSERT(isTesSuccess(result) || isTecClaim(result), "ripple::CreateOffer::applyGuts : result is tesSUCCESS or tecCLAIM");
|
||||
ASSERT(
|
||||
isTesSuccess(result) || isTecClaim(result),
|
||||
"ripple::CreateOffer::applyGuts : result is tesSUCCESS or "
|
||||
"tecCLAIM");
|
||||
|
||||
if (auto stream = j_.trace())
|
||||
{
|
||||
|
||||
@@ -173,7 +173,9 @@ closeChannel(
|
||||
if (!sle)
|
||||
return tefINTERNAL;
|
||||
|
||||
ASSERT((*slep)[sfAmount] >= (*slep)[sfBalance], "ripple::closeChannel : minimum channel amount");
|
||||
ASSERT(
|
||||
(*slep)[sfAmount] >= (*slep)[sfBalance],
|
||||
"ripple::closeChannel : minimum channel amount");
|
||||
|
||||
if (isXRP(amount))
|
||||
(*sle)[sfBalance] = (*sle)[sfBalance] + amount;
|
||||
@@ -773,7 +775,9 @@ PayChanClaim::doApply()
|
||||
|
||||
(*slep)[sfBalance] = ctx_.tx[sfBalance];
|
||||
STAmount const reqDelta = reqBalance - chanBalance;
|
||||
ASSERT(reqDelta >= beast::zero, "ripple::PayChanClaim::doApply : minimum balance delta");
|
||||
ASSERT(
|
||||
reqDelta >= beast::zero,
|
||||
"ripple::PayChanClaim::doApply : minimum balance delta");
|
||||
if (isXRP(reqDelta))
|
||||
(*sled)[sfBalance] = (*sled)[sfBalance] + reqDelta;
|
||||
else
|
||||
|
||||
@@ -1604,7 +1604,8 @@ SetHook::setHook()
|
||||
return tecINTERNAL;
|
||||
}
|
||||
else
|
||||
UNREACHABLE("SetHook::hsoCREATE : should never happen");
|
||||
UNREACHABLE(
|
||||
"SetHook::hsoCREATE : should never happen");
|
||||
}
|
||||
|
||||
// otherwise assign instruction counts
|
||||
|
||||
@@ -137,8 +137,12 @@ SetSignerList::preCompute()
|
||||
{
|
||||
// Get the quorum and operation info.
|
||||
auto result = determineOperation(ctx_.tx, view().flags(), j_);
|
||||
ASSERT(isTesSuccess(std::get<0>(result)), "ripple::SetSignerList::preCompute : result is tesSUCCESS");
|
||||
ASSERT(std::get<3>(result) != unknown, "ripple::SetSignerList::preCompute : result is known operation");
|
||||
ASSERT(
|
||||
isTesSuccess(std::get<0>(result)),
|
||||
"ripple::SetSignerList::preCompute : result is tesSUCCESS");
|
||||
ASSERT(
|
||||
std::get<3>(result) != unknown,
|
||||
"ripple::SetSignerList::preCompute : result is known operation");
|
||||
|
||||
quorum_ = std::get<1>(result);
|
||||
signers_ = std::get<2>(result);
|
||||
|
||||
@@ -330,7 +330,9 @@ Transactor::calculateBaseFee(ReadView const& view, STTx const& tx)
|
||||
hookExecutionFee += toAdd;
|
||||
}
|
||||
|
||||
ASSERT(emitDetails.isFieldPresent(sfEmitBurden), "Transactor::calculateBaseFee : emit burden not present");
|
||||
ASSERT(
|
||||
emitDetails.isFieldPresent(sfEmitBurden),
|
||||
"Transactor::calculateBaseFee : emit burden not present");
|
||||
|
||||
burden = emitDetails.getFieldU64(sfEmitBurden);
|
||||
}
|
||||
@@ -692,7 +694,8 @@ Transactor::checkPriorTxAndLastLedger(PreclaimContext const& ctx)
|
||||
TER
|
||||
Transactor::consumeSeqProxy(SLE::pointer const& sleAccount)
|
||||
{
|
||||
ASSERT(sleAccount, "ripple::Transactor::consumeSeqProxy : non-null account");
|
||||
ASSERT(
|
||||
sleAccount, "ripple::Transactor::consumeSeqProxy : non-null account");
|
||||
|
||||
// do not update sequence of sfAccountTxnID for emitted tx
|
||||
if (ctx_.isEmittedTxn())
|
||||
@@ -787,9 +790,10 @@ Transactor::apply()
|
||||
// that allow zero account. (and ttIMPORT)
|
||||
ASSERT(
|
||||
sle != nullptr || account_ == beast::zero ||
|
||||
view().rules().enabled(featureImport) &&
|
||||
ctx_.tx.getTxnType() == ttIMPORT &&
|
||||
!ctx_.tx.isFieldPresent(sfIssuer), "ripple::Transactor::apply : non-null SLE or zero account");
|
||||
view().rules().enabled(featureImport) &&
|
||||
ctx_.tx.getTxnType() == ttIMPORT &&
|
||||
!ctx_.tx.isFieldPresent(sfIssuer),
|
||||
"ripple::Transactor::apply : non-null SLE or zero account");
|
||||
|
||||
if (sle)
|
||||
{
|
||||
@@ -1616,7 +1620,9 @@ Transactor::doTSH(
|
||||
if (tshFeeDrops == 0)
|
||||
continue;
|
||||
|
||||
ASSERT(tshFeeDrops >= beast::zero, "Transactor::doTSH : tsh fee drops is negative");
|
||||
ASSERT(
|
||||
tshFeeDrops >= beast::zero,
|
||||
"Transactor::doTSH : tsh fee drops is negative");
|
||||
|
||||
STAmount priorBalance = tshAcc->getFieldAmount(sfBalance);
|
||||
|
||||
@@ -1657,8 +1663,13 @@ Transactor::doTSH(
|
||||
if (tshFeeDrops > beast::zero)
|
||||
{
|
||||
STAmount finalBalance = priorBalance - tshFeeDrops;
|
||||
ASSERT(finalBalance >= beast::zero, "Transactor::doTSH : final balance is negative");
|
||||
ASSERT(finalBalance < priorBalance, "Transactor::doTSH : final balance is greater than prior balance");
|
||||
ASSERT(
|
||||
finalBalance >= beast::zero,
|
||||
"Transactor::doTSH : final balance is negative");
|
||||
ASSERT(
|
||||
finalBalance < priorBalance,
|
||||
"Transactor::doTSH : final balance is greater than prior "
|
||||
"balance");
|
||||
|
||||
tshAcc->setFieldAmount(sfBalance, finalBalance);
|
||||
view.update(tshAcc);
|
||||
|
||||
@@ -161,7 +161,10 @@ ApplyStateTable::generateTxMeta(
|
||||
meta.setAffectedNode(item.first, *type, nodeType);
|
||||
if (type == &sfDeletedNode)
|
||||
{
|
||||
ASSERT(origNode && curNode, "ripple::detail::ApplyStateTable::apply : valid nodes for deletion");
|
||||
ASSERT(
|
||||
origNode && curNode,
|
||||
"ripple::detail::ApplyStateTable::apply : valid nodes for "
|
||||
"deletion");
|
||||
threadOwners(to, meta, origNode, newMod, j);
|
||||
|
||||
STObject prevs(sfPreviousFields);
|
||||
@@ -192,7 +195,10 @@ ApplyStateTable::generateTxMeta(
|
||||
}
|
||||
else if (type == &sfModifiedNode)
|
||||
{
|
||||
ASSERT(curNode && origNode, "ripple::detail::ApplyStateTable::apply : valid nodes for modification");
|
||||
ASSERT(
|
||||
curNode && origNode,
|
||||
"ripple::detail::ApplyStateTable::apply : valid nodes for "
|
||||
"modification");
|
||||
|
||||
if (curNode->isThreadedType(to.rules())) // thread transaction to
|
||||
// node item modified
|
||||
@@ -225,7 +231,10 @@ ApplyStateTable::generateTxMeta(
|
||||
}
|
||||
else if (type == &sfCreatedNode) // if created, thread to owner(s)
|
||||
{
|
||||
ASSERT(curNode && !origNode, "ripple::detail::ApplyStateTable::apply : valid nodes for creation");
|
||||
ASSERT(
|
||||
curNode && !origNode,
|
||||
"ripple::detail::ApplyStateTable::apply : valid nodes for "
|
||||
"creation");
|
||||
threadOwners(to, meta, curNode, newMod, j);
|
||||
|
||||
if (curNode->isThreadedType(to.rules())) // always thread to self
|
||||
@@ -250,7 +259,9 @@ ApplyStateTable::generateTxMeta(
|
||||
}
|
||||
else
|
||||
{
|
||||
UNREACHABLE("ripple::detail::ApplyStateTable::apply : unsupported operation type");
|
||||
UNREACHABLE(
|
||||
"ripple::detail::ApplyStateTable::apply : unsupported "
|
||||
"operation type");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -254,7 +254,10 @@ ApplyViewBase::balanceChanges(ReadView const& view) const
|
||||
{
|
||||
// modify
|
||||
auto const at = after->getType();
|
||||
ASSERT(at == before->getType(), "ripple::PaymentSandbox::balanceChanges : after and before types matching");
|
||||
ASSERT(
|
||||
at == before->getType(),
|
||||
"ripple::PaymentSandbox::balanceChanges : after and before "
|
||||
"types matching");
|
||||
switch (at)
|
||||
{
|
||||
case ltACCOUNT_ROOT:
|
||||
|
||||
@@ -1033,7 +1033,8 @@ isTrustDefault(
|
||||
std::shared_ptr<SLE> const& acc,
|
||||
std::shared_ptr<SLE> const& line)
|
||||
{
|
||||
ASSERT(acc && line, "ripple::isTrustDefault : account and line are not null");
|
||||
ASSERT(
|
||||
acc && line, "ripple::isTrustDefault : account and line are not null");
|
||||
|
||||
uint32_t const tlFlags = line->getFieldU32(sfFlags);
|
||||
|
||||
@@ -1043,7 +1044,9 @@ isTrustDefault(
|
||||
|
||||
AccountID const accID = acc->getAccountID(sfAccount);
|
||||
|
||||
ASSERT(accID == highAccID || accID == lowAccID, "ripple::isTrustDefault : account ID mismatch");
|
||||
ASSERT(
|
||||
accID == highAccID || accID == lowAccID,
|
||||
"ripple::isTrustDefault : account ID mismatch");
|
||||
|
||||
bool const high = accID == highAccID;
|
||||
|
||||
@@ -1311,7 +1314,9 @@ rippleSendIOU(
|
||||
// Calculate the amount to transfer accounting
|
||||
// for any transfer fees:
|
||||
|
||||
ASSERT(waiveFee == WaiveTransferFee::No || senderPaysXferFees == true, "ripple::rippleSendIOU : transfer fees are waived or sender pays");
|
||||
ASSERT(
|
||||
waiveFee == WaiveTransferFee::No || senderPaysXferFees == true,
|
||||
"ripple::rippleSendIOU : transfer fees are waived or sender pays");
|
||||
|
||||
STAmount senderPays = saAmount;
|
||||
STAmount destReceives = saAmount;
|
||||
|
||||
@@ -716,6 +716,21 @@ private:
|
||||
return jvRequest;
|
||||
}
|
||||
|
||||
// ledger_entry [id] [<index>]
|
||||
Json::Value
|
||||
parseLedgerEntry(Json::Value const& jvParams)
|
||||
{
|
||||
Json::Value jvRequest{Json::objectValue};
|
||||
|
||||
jvRequest[jss::index] = jvParams[0u].asString();
|
||||
|
||||
if (jvParams.size() == 2 &&
|
||||
!jvParseLedger(jvRequest, jvParams[1u].asString()))
|
||||
return rpcError(rpcLGR_IDX_MALFORMED);
|
||||
|
||||
return jvRequest;
|
||||
}
|
||||
|
||||
// log_level: Get log levels
|
||||
// log_level <severity>: Set master log level to the
|
||||
// specified severity log_level <partition> <severity>: Set specified
|
||||
@@ -1404,8 +1419,7 @@ public:
|
||||
{"ledger_accept", &RPCParser::parseAsIs, 0, 0},
|
||||
{"ledger_closed", &RPCParser::parseAsIs, 0, 0},
|
||||
{"ledger_current", &RPCParser::parseAsIs, 0, 0},
|
||||
// { "ledger_entry", &RPCParser::parseLedgerEntry,
|
||||
// -1, -1 },
|
||||
{"ledger_entry", &RPCParser::parseLedgerEntry, 1, 2},
|
||||
{"ledger_header", &RPCParser::parseLedgerId, 1, 1},
|
||||
{"ledger_request", &RPCParser::parseLedgerId, 1, 1},
|
||||
{"log_level", &RPCParser::parseLogLevel, 0, 2},
|
||||
|
||||
@@ -1236,7 +1236,8 @@ PeerImp::handleTransaction(
|
||||
bool batch)
|
||||
{
|
||||
ASSERT(
|
||||
eraseTxQueue != batch, "ripple::PeerImp::handleTransaction correct function params");
|
||||
eraseTxQueue != batch,
|
||||
"ripple::PeerImp::handleTransaction correct function params");
|
||||
if (tracking_.load() == Tracking::diverged)
|
||||
return;
|
||||
|
||||
@@ -2818,7 +2819,10 @@ PeerImp::checkTransaction(
|
||||
// TransactionMaster cache
|
||||
std::string reason;
|
||||
auto tx = std::make_shared<Transaction>(stx, reason, app_);
|
||||
ASSERT(tx->getStatus() == NEW, "ripple::PeerImp::checkTransaction Transaction created correctly");
|
||||
ASSERT(
|
||||
tx->getStatus() == NEW,
|
||||
"ripple::PeerImp::checkTransaction Transaction created "
|
||||
"correctly");
|
||||
if (tx->getStatus() == NEW)
|
||||
{
|
||||
JLOG(p_journal_.debug())
|
||||
|
||||
@@ -1076,22 +1076,22 @@ chooseLedgerEntryType(Json::Value const& params)
|
||||
{jss::fee, ltFEE_SETTINGS},
|
||||
{jss::hashes, ltLEDGER_HASHES},
|
||||
{jss::import_vlseq, ltIMPORT_VLSEQ},
|
||||
{jss::nunl, ltNEGATIVE_UNL},
|
||||
{jss::oracle, ltORACLE},
|
||||
{jss::mpt_issuance, ltMPTOKEN_ISSUANCE},
|
||||
{jss::mptoken, ltMPTOKEN},
|
||||
{jss::nft_offer, ltNFTOKEN_OFFER},
|
||||
{jss::nft_page, ltNFTOKEN_PAGE},
|
||||
{jss::nunl, ltNEGATIVE_UNL},
|
||||
{jss::offer, ltOFFER},
|
||||
{jss::oracle, ltORACLE},
|
||||
{jss::payment_channel, ltPAYCHAN},
|
||||
{jss::uri_token, ltURI_TOKEN},
|
||||
{jss::signer_list, ltSIGNER_LIST},
|
||||
{jss::state, ltRIPPLE_STATE},
|
||||
{jss::ticket, ltTICKET},
|
||||
{jss::uri_token, ltURI_TOKEN},
|
||||
{jss::unl_report, ltUNL_REPORT},
|
||||
{jss::xchain_owned_claim_id, ltXCHAIN_OWNED_CLAIM_ID},
|
||||
{jss::xchain_owned_create_account_claim_id,
|
||||
ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID},
|
||||
{jss::mpt_issuance, ltMPTOKEN_ISSUANCE},
|
||||
{jss::mptoken, ltMPTOKEN}}};
|
||||
ltXCHAIN_OWNED_CREATE_ACCOUNT_CLAIM_ID}}};
|
||||
|
||||
auto const& p = params[jss::type];
|
||||
if (!p.isString())
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user