Prefer keylets instead of naked hashes:

Entries in the ledger are located using 256-bit locators. The locators
are calculated using a wide range of parameters specific to the entry
whose locator we are calculating (e.g. an account's locator is derived
from the account's address, whereas the locator for an offer is derived
from the account and the offer sequence.)

Keylets enhance type safety during lookup and make the code more robust,
so this commit removes most of the earlier code, which used naked
uint256 values.
This commit is contained in:
Nik Bougalis
2020-03-31 02:20:59 -07:00
parent dbee3f01b7
commit 74f9edef07
23 changed files with 477 additions and 651 deletions

View File

@@ -353,7 +353,7 @@ class LedgerRPC_test : public beast::unit_test::suite
env.fund(XRP(10000), alice);
env.close();
uint256 const checkId{getCheckIndex(env.master, env.seq(env.master))};
auto const checkId = keylet::check(env.master, env.seq(env.master));
env(check::create(env.master, alice, XRP(100)));
env.close();
@@ -362,7 +362,7 @@ class LedgerRPC_test : public beast::unit_test::suite
{
// Request a check.
Json::Value jvParams;
jvParams[jss::check] = to_string(checkId);
jvParams[jss::check] = to_string(checkId.key);
jvParams[jss::ledger_hash] = ledgerHash;
Json::Value const jrr = env.rpc(
"json", "ledger_entry", to_string(jvParams))[jss::result];