feat: Hook up cache_le host function

This commit is contained in:
TimothyBanks
2026-08-10 16:20:50 -04:00
parent accd0cac6c
commit 3a2cf64a69
11 changed files with 118 additions and 9 deletions

View File

@@ -135,6 +135,22 @@ HostContext::isAmendmentEnabled(rust::Slice<std::uint8_t const> amendment) const
});
}
std::int32_t
HostContext::cacheLedgerObj(rust::Slice<std::uint8_t const> objId, std::int32_t cacheIdx)
const noexcept
{
return guarded(hostFunctions_.getJournal(), kHostInternal, [&] {
if (objId.size() != uint256::size())
return hfErrorToInt(HostFunctionError::InvalidParams);
auto const slot = hostFunctions_.cacheLedgerObj(uint256::fromVoid(objId.data()), cacheIdx);
if (!slot)
return hfErrorToInt(slot.error());
return *slot;
});
}
std::int32_t
HostContext::getCurrentLedgerObjField(std::int32_t field, rust::Slice<std::uint8_t> out)
const noexcept