mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
Check that HFS object is always new
This commit is contained in:
@@ -110,6 +110,12 @@ struct HostFunctions
|
||||
return j_;
|
||||
}
|
||||
|
||||
virtual bool
|
||||
checkSelf() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual Expected<std::uint32_t, HostFunctionError>
|
||||
getLedgerSqn() const
|
||||
{
|
||||
|
||||
@@ -74,6 +74,13 @@ public:
|
||||
return rt_;
|
||||
}
|
||||
|
||||
virtual bool
|
||||
checkSelf() const override
|
||||
{
|
||||
return !currentLedgerObj_ && !data_ &&
|
||||
std::ranges::find_if(cache_, [](auto& p) { return !!p; }) == cache_.end();
|
||||
}
|
||||
|
||||
std::optional<Bytes> const&
|
||||
getData() const
|
||||
{
|
||||
|
||||
@@ -782,6 +782,8 @@ WasmiEngine::runHlp(
|
||||
#ifndef WASM_PERF_TESTS
|
||||
if (wasmCode.empty())
|
||||
throw std::runtime_error("empty module");
|
||||
if (!hfs.checkSelf())
|
||||
throw std::runtime_error("hfs isn't clean");
|
||||
#else
|
||||
// re-using module only for perf tests
|
||||
if (!wasmCode.empty())
|
||||
|
||||
Reference in New Issue
Block a user