Disable setLogFilter RPC API by default (#8693)

automerge
This commit is contained in:
Michael Vines
2020-03-06 17:03:10 -07:00
committed by GitHub
parent 4db074a5aa
commit cea8067219
5 changed files with 23 additions and 4 deletions

View File

@ -50,6 +50,7 @@ fn new_response<T>(bank: &Bank, value: T) -> RpcResponse<T> {
#[derive(Debug, Default, Clone)]
pub struct JsonRpcConfig {
pub enable_validator_exit: bool,
pub enable_set_log_filter: bool,
pub enable_get_confirmed_block: bool,
pub identity_pubkey: Pubkey,
pub faucet_addr: Option<SocketAddr>,
@ -339,6 +340,13 @@ impl JsonRpcRequestProcessor {
Ok(pubkeys)
}
pub fn set_log_filter(&self, filter: String) -> Result<()> {
if self.config.enable_set_log_filter {
solana_logger::setup_with(&filter);
}
Ok(())
}
pub fn validator_exit(&self) -> Result<bool> {
if self.config.enable_validator_exit {
warn!("validator_exit request...");
@ -1133,9 +1141,11 @@ impl RpcSol for RpcSolImpl {
})
}
fn set_log_filter(&self, _meta: Self::Metadata, filter: String) -> Result<()> {
solana_logger::setup_with(&filter);
Ok(())
fn set_log_filter(&self, meta: Self::Metadata, filter: String) -> Result<()> {
meta.request_processor
.read()
.unwrap()
.set_log_filter(filter)
}
fn get_confirmed_block(