From 592ee0ace58626267a5610d89ebdeaee6e189269 Mon Sep 17 00:00:00 2001 From: Kirill Fomichev Date: Sat, 7 Oct 2023 22:38:07 +0400 Subject: [PATCH] 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