Skip to content

Commit 0282504

Browse files
authored
feat: add 'force_forward' field to request (#1647)
Fix #1141
1 parent bea905a commit 0282504

File tree

2 files changed

+153
-215
lines changed

2 files changed

+153
-215
lines changed

src/rpc/common/impl/ForwardingProxy.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ class ForwardingProxy {
6969
if (specifiesCurrentOrClosedLedger(request))
7070
return true;
7171

72+
if (isForcedForward(ctx))
73+
return true;
74+
7275
auto const checkAccountInfoForward = [&]() {
7376
return ctx.method == "account_info" and request.contains("queue") and request.at("queue").is_bool() and
7477
request.at("queue").as_bool();
@@ -138,6 +141,14 @@ class ForwardingProxy {
138141
{
139142
return handlerProvider_->contains(method) || isProxied(method);
140143
}
144+
145+
bool
146+
isForcedForward(web::Context const& ctx) const
147+
{
148+
static constexpr auto FORCE_FORWARD = "force_forward";
149+
return ctx.isAdmin and ctx.params.contains(FORCE_FORWARD) and ctx.params.at(FORCE_FORWARD).is_bool() and
150+
ctx.params.at(FORCE_FORWARD).as_bool();
151+
}
141152
};
142153

143154
} // namespace rpc::impl

0 commit comments

Comments
 (0)