Skip to content

feat: add 'force_forward' field to request #1647

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/rpc/common/impl/ForwardingProxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ class ForwardingProxy {
if (specifiesCurrentOrClosedLedger(request))
return true;

if (isForcedForward(ctx))
return true;

auto const checkAccountInfoForward = [&]() {
return ctx.method == "account_info" and request.contains("queue") and request.at("queue").is_bool() and
request.at("queue").as_bool();
Expand Down Expand Up @@ -138,6 +141,14 @@ class ForwardingProxy {
{
return handlerProvider_->contains(method) || isProxied(method);
}

bool
isForcedForward(web::Context const& ctx) const
{
static constexpr auto FORCE_FORWARD = "force_forward";
return ctx.isAdmin and ctx.params.contains(FORCE_FORWARD) and ctx.params.at(FORCE_FORWARD).is_bool() and
ctx.params.at(FORCE_FORWARD).as_bool();
}
};

} // namespace rpc::impl
Loading
Loading