Files
rippled/include/xrpl/protocol_autogen/STObjectValidation.h
copilot-swe-agent[bot] 89a6bb495e Merge branch 'develop' into copilot/add-ctid-to-ledger-response
Resolve conflicts in LedgerToJson.cpp:
- Keep both includes: NetworkIDService.h (ours) and TokenHelpers.h (develop)
- Keep CTID block and use develop's ownerFunds check style (!= 0)

Agent-Logs-Url: https://github.com/XRPLF/rippled/sessions/949ea030-9a83-49a4-8684-33a1ee221a3d

Co-authored-by: mvadari <8029314+mvadari@users.noreply.github.com>
2026-04-02 17:06:03 +00:00

44 lines
1.2 KiB
C++

#pragma once
#include <xrpl/protocol/SOTemplate.h>
#include <xrpl/protocol/STObject.h>
namespace xrpl::protocol_autogen {
[[nodiscard]]
inline bool
validateSTObject(STObject const& obj, SOTemplate const& format)
{
for (auto const& field : format)
{
if (!obj.isFieldPresent(field.sField()) && field.style() == soeREQUIRED)
{
return false; // LCOV_EXCL_LINE
}
if (field.supportMPT() == soeMPTNotSupported && obj.isFieldPresent(field.sField()))
{
if (field.sField().fieldType == STI_AMOUNT)
{
auto const& amount = obj.getFieldAmount(field.sField());
if (amount.asset().holds<MPTIssue>())
return false; // LCOV_EXCL_LINE
}
else if (field.sField().fieldType == STI_ISSUE)
{
auto issue = dynamic_cast<STIssue const*>(obj.peekAtPField(field.sField()));
if (!issue)
return false; // LCOV_EXCL_LINE
if (issue->holds<MPTIssue>())
return false; // LCOV_EXCL_LINE
}
}
}
return true;
}
} // namespace xrpl::protocol_autogen