From 592ee0ace58626267a5610d89ebdeaee6e189269 Mon Sep 17 00:00:00 2001 From: Kirill Fomichev Date: Sat, 7 Oct 2023 22:38:07 +0400 Subject: [PATCH 1/2] check plugin name on plugin_reload rpc call --- .../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..a09e9c85d91db1 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. 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 From 2687f4108c38eb05bba3b86c8869d01b2e616eeb Mon Sep 17 00:00:00 2001 From: Kirill Fomichev Date: Wed, 1 Nov 2023 19:28:12 +0600 Subject: [PATCH 2/2] add name to error message --- geyser-plugin-manager/src/geyser_plugin_manager.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geyser-plugin-manager/src/geyser_plugin_manager.rs b/geyser-plugin-manager/src/geyser_plugin_manager.rs index a09e9c85d91db1..92180d1991b56e 100644 --- a/geyser-plugin-manager/src/geyser_plugin_manager.rs +++ b/geyser-plugin-manager/src/geyser_plugin_manager.rs @@ -186,7 +186,7 @@ impl GeyserPluginManager { return Err(jsonrpc_core::Error { code: ErrorCode::InvalidRequest, message: format!( - "There already exists a plugin named {} loaded. Did not load requested plugin", + "There already exists a plugin named {} loaded, while reloading {name}. Did not load requested plugin", new_plugin.name() ), data: None,