APIv2: remove tx_history and ledger_header (#4759)

Remove `tx_history` and `ledger_header` methods from API version 2.

Update `RPC::Handler` to allow for methods (or method implementations)
to be API version specific. This partially resolves #4727. We can now
store multiple handlers with the same name, as long as they belong to
different (non-overlapping) API versions. This necessarily impacts the
handler lookup algorithm and its complexity; however, there is no
performance loss on x86_64 architecture, and only minimal performance
loss on arm64 (around 10ns). This design change gives us extra
flexibility evolving the API in the future, including other parts of
#4727.

In API version 2, `tx_history` and `ledger_header` are no longer
recognised; if they are called, `rippled` will return error
`unknownCmd`

Resolve #3638

Resolve #3539
This commit is contained in:
Bronek Kozicki
2023-10-24 23:57:49 +01:00
committed by GitHub
parent 3e5f770a38
commit 1eac4d2c07
14 changed files with 367 additions and 60 deletions

View File

@@ -54,6 +54,21 @@ class TransactionHistory_test : public beast::unit_test::suite
}
}
void
testCommandRetired()
{
testcase("Command retired from API v2");
using namespace test::jtx;
Env env{*this, envconfig(no_admin)};
Json::Value params{Json::objectValue};
params[jss::api_version] = 2;
auto const result =
env.client().invoke("tx_history", params)[jss::result];
BEAST_EXPECT(result[jss::error] == "unknownCmd");
BEAST_EXPECT(result[jss::status] == "error");
}
void
testRequest()
{
@@ -148,6 +163,7 @@ public:
{
testBadInput();
testRequest();
testCommandRetired();
}
};