mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-21 14:20:56 +00:00
feat: Hook up home_le_inner_arr_len host function
This commit is contained in:
@@ -350,6 +350,27 @@ HostContext::getTxNestedArrayLen(rust::Slice<std::uint8_t const> locator) const
|
||||
});
|
||||
}
|
||||
|
||||
std::int32_t
|
||||
HostContext::getCurrentLedgerObjNestedArrayLen(
|
||||
rust::Slice<std::uint8_t const> locator) const noexcept
|
||||
{
|
||||
return guarded(hostFunctions_.getJournal(), kHostInternal, [&] {
|
||||
if (locator.empty() || (locator.size() & 3) != 0)
|
||||
return hfErrorToInt(HostFunctionError::LocatorMalformed);
|
||||
|
||||
std::uint32_t const steps = locator.size() / sizeof(std::int32_t);
|
||||
std::vector<std::int32_t> locBuf(steps);
|
||||
std::memcpy(locBuf.data(), locator.data(), locator.size());
|
||||
FieldLocator const fl(std::move(locBuf));
|
||||
|
||||
auto const len = hostFunctions_.getCurrentLedgerObjNestedArrayLen(fl);
|
||||
if (!len)
|
||||
return hfErrorToInt(len.error());
|
||||
|
||||
return *len;
|
||||
});
|
||||
}
|
||||
|
||||
std::int32_t
|
||||
HostContext::sha512Half(rust::Slice<std::uint8_t const> data, rust::Slice<std::uint8_t> out)
|
||||
const noexcept
|
||||
|
||||
Reference in New Issue
Block a user