Tx handler in new RPC framework (#526)

Fixes #527
This commit is contained in:
cyan317
2023-02-28 09:35:13 +00:00
committed by GitHub
parent a3211f4458
commit 67f0fa26ae
13 changed files with 549 additions and 14 deletions

View File

@@ -165,4 +165,21 @@ CustomValidator MarkerValidator = CustomValidator{
return MaybeError{};
}};
CustomValidator TxHashValidator = CustomValidator{
[](boost::json::value const& value, std::string_view key) -> MaybeError {
if (!value.is_string())
{
return Error{RPC::Status{
RPC::RippledError::rpcINVALID_PARAMS,
std::string(key) + "NotString"}};
}
ripple::uint256 txHash;
if (!txHash.parseHex(value.as_string().c_str()))
{
return Error{RPC::Status{
RPC::RippledError::rpcINVALID_PARAMS, "malformedTransaction"}};
}
return MaybeError{};
}};
} // namespace RPCng::validation