From e7bf2d00639f4958b098bb66ab8e1abf676fc98f Mon Sep 17 00:00:00 2001 From: Kirill Fomichev Date: Thu, 2 Nov 2023 01:21:53 +0600 Subject: [PATCH] check plugin name on plugin_reload rpc call (#33582) * check plugin name on plugin_reload rpc call * add name to error message (cherry picked from commit 808f67aeadcb5d0a8c1cb9685f91493df392babe) --- .../src/geyser_plugin_manager.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/geyser-plugin-manager/src/geyser_plugin_manager.rs b/geyser-plugin-manager/src/geyser_plugin_manager.rs index 0698cf1a656363..92180d1991b56e 100644 --- a/geyser-plugin-manager/src/geyser_plugin_manager.rs +++ b/geyser-plugin-manager/src/geyser_plugin_manager.rs @@ -177,6 +177,22 @@ impl GeyserPluginManager { data: None, })?; + // Then see if a plugin with this name already exists. If so, abort + if self + .plugins + .iter() + .any(|plugin| plugin.name().eq(new_plugin.name())) + { + return Err(jsonrpc_core::Error { + code: ErrorCode::InvalidRequest, + message: format!( + "There already exists a plugin named {} loaded, while reloading {name}. Did not load requested plugin", + new_plugin.name() + ), + data: None, + }); + } + // Attempt to on_load with new plugin match new_plugin.on_load(new_parsed_config_file) { // On success, push plugin and library