refactor: rename info() to header() (#6138)

This change renames all the `info()` functions to `header()`, since they return `LedgerHeader` structs. It also renames the underlying variables from `info_` to `header_`.
This commit is contained in:
Mayukha Vadari
2025-12-10 16:04:37 -05:00
committed by GitHub
parent bff5954acf
commit 62efecbfb1
90 changed files with 609 additions and 582 deletions

View File

@@ -242,7 +242,7 @@ class AccountTx_test : public beast::unit_test::suite
env.rpc("json", "account_tx", to_string(p)),
rpcLGR_IDX_MALFORMED));
p[jss::ledger_index_min] = env.current()->info().seq;
p[jss::ledger_index_min] = env.current()->header().seq;
BEAST_EXPECT(isErr(
env.rpc("json", "account_tx", to_string(p)),
(apiVersion == 1 ? rpcLGR_IDXS_INVALID
@@ -256,7 +256,7 @@ class AccountTx_test : public beast::unit_test::suite
BEAST_EXPECT(hasTxs(
env.rpc(apiVersion, "json", "account_tx", to_string(p))));
p[jss::ledger_index_max] = env.current()->info().seq;
p[jss::ledger_index_max] = env.current()->header().seq;
if (apiVersion < 2u)
BEAST_EXPECT(hasTxs(
env.rpc(apiVersion, "json", "account_tx", to_string(p))));
@@ -269,11 +269,11 @@ class AccountTx_test : public beast::unit_test::suite
BEAST_EXPECT(hasTxs(
env.rpc(apiVersion, "json", "account_tx", to_string(p))));
p[jss::ledger_index_max] = env.closed()->info().seq;
p[jss::ledger_index_max] = env.closed()->header().seq;
BEAST_EXPECT(hasTxs(
env.rpc(apiVersion, "json", "account_tx", to_string(p))));
p[jss::ledger_index_max] = env.closed()->info().seq - 1;
p[jss::ledger_index_max] = env.closed()->header().seq - 1;
BEAST_EXPECT(noTxs(env.rpc("json", "account_tx", to_string(p))));
}
@@ -281,19 +281,19 @@ class AccountTx_test : public beast::unit_test::suite
{
Json::Value p{jParams};
p[jss::ledger_index] = env.closed()->info().seq;
p[jss::ledger_index] = env.closed()->header().seq;
BEAST_EXPECT(hasTxs(
env.rpc(apiVersion, "json", "account_tx", to_string(p))));
p[jss::ledger_index] = env.closed()->info().seq - 1;
p[jss::ledger_index] = env.closed()->header().seq - 1;
BEAST_EXPECT(noTxs(env.rpc("json", "account_tx", to_string(p))));
p[jss::ledger_index] = env.current()->info().seq;
p[jss::ledger_index] = env.current()->header().seq;
BEAST_EXPECT(isErr(
env.rpc("json", "account_tx", to_string(p)),
rpcLGR_NOT_VALIDATED));
p[jss::ledger_index] = env.current()->info().seq + 1;
p[jss::ledger_index] = env.current()->header().seq + 1;
BEAST_EXPECT(isErr(
env.rpc("json", "account_tx", to_string(p)), rpcLGR_NOT_FOUND));
}
@@ -302,11 +302,11 @@ class AccountTx_test : public beast::unit_test::suite
{
Json::Value p{jParams};
p[jss::ledger_hash] = to_string(env.closed()->info().hash);
p[jss::ledger_hash] = to_string(env.closed()->header().hash);
BEAST_EXPECT(hasTxs(
env.rpc(apiVersion, "json", "account_tx", to_string(p))));
p[jss::ledger_hash] = to_string(env.closed()->info().parentHash);
p[jss::ledger_hash] = to_string(env.closed()->header().parentHash);
BEAST_EXPECT(noTxs(env.rpc("json", "account_tx", to_string(p))));
}
@@ -333,7 +333,7 @@ class AccountTx_test : public beast::unit_test::suite
// Ledger index max only
{
Json::Value p{jParams};
p[jss::ledger_index_max] = env.current()->info().seq;
p[jss::ledger_index_max] = env.current()->header().seq;
if (apiVersion < 2u)
BEAST_EXPECT(hasTxs(
env.rpc(apiVersion, "json", "account_tx", to_string(p))));
@@ -903,7 +903,7 @@ class AccountTx_test : public beast::unit_test::suite
//
// ledger hash should be fixed regardless any change to account history
// BEAST_EXPECT(
// to_string(env.closed()->info().hash) ==
// to_string(env.closed()->header().hash) ==
// "0BD507BB87D3C0E73B462485E6E381798A8C82FC49BF17FE39C60E08A1AF035D");
// alice authorizes bob