parent
4db074a5aa
commit
cea8067219
|
@ -50,6 +50,7 @@ fn new_response<T>(bank: &Bank, value: T) -> RpcResponse<T> {
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone)]
|
||||||
pub struct JsonRpcConfig {
|
pub struct JsonRpcConfig {
|
||||||
pub enable_validator_exit: bool,
|
pub enable_validator_exit: bool,
|
||||||
|
pub enable_set_log_filter: bool,
|
||||||
pub enable_get_confirmed_block: bool,
|
pub enable_get_confirmed_block: bool,
|
||||||
pub identity_pubkey: Pubkey,
|
pub identity_pubkey: Pubkey,
|
||||||
pub faucet_addr: Option<SocketAddr>,
|
pub faucet_addr: Option<SocketAddr>,
|
||||||
|
@ -339,6 +340,13 @@ impl JsonRpcRequestProcessor {
|
||||||
Ok(pubkeys)
|
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> {
|
pub fn validator_exit(&self) -> Result<bool> {
|
||||||
if self.config.enable_validator_exit {
|
if self.config.enable_validator_exit {
|
||||||
warn!("validator_exit request...");
|
warn!("validator_exit request...");
|
||||||
|
@ -1133,9 +1141,11 @@ impl RpcSol for RpcSolImpl {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_log_filter(&self, _meta: Self::Metadata, filter: String) -> Result<()> {
|
fn set_log_filter(&self, meta: Self::Metadata, filter: String) -> Result<()> {
|
||||||
solana_logger::setup_with(&filter);
|
meta.request_processor
|
||||||
Ok(())
|
.read()
|
||||||
|
.unwrap()
|
||||||
|
.set_log_filter(filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_confirmed_block(
|
fn get_confirmed_block(
|
||||||
|
|
|
@ -77,6 +77,7 @@ ledger_dir="$SOLANA_CONFIG_DIR"/bootstrap-validator
|
||||||
|
|
||||||
args+=(
|
args+=(
|
||||||
--enable-rpc-exit
|
--enable-rpc-exit
|
||||||
|
--enable-rpc-set-log-filter
|
||||||
--ledger "$ledger_dir"
|
--ledger "$ledger_dir"
|
||||||
--rpc-port 8899
|
--rpc-port 8899
|
||||||
--snapshot-interval-slots 100
|
--snapshot-interval-slots 100
|
||||||
|
|
|
@ -219,6 +219,8 @@ default_arg --voting-keypair "$voting_keypair_path"
|
||||||
default_arg --storage-keypair "$storage_keypair_path"
|
default_arg --storage-keypair "$storage_keypair_path"
|
||||||
default_arg --ledger "$ledger_dir"
|
default_arg --ledger "$ledger_dir"
|
||||||
default_arg --log -
|
default_arg --log -
|
||||||
|
default_arg --enable-rpc-exit
|
||||||
|
default_arg --enable-rpc-set-log-filter
|
||||||
|
|
||||||
if [[ -n $SOLANA_CUDA ]]; then
|
if [[ -n $SOLANA_CUDA ]]; then
|
||||||
program=$solana_validator_cuda
|
program=$solana_validator_cuda
|
||||||
|
|
|
@ -293,7 +293,6 @@ EOF
|
||||||
--enable-rpc-get-confirmed-block
|
--enable-rpc-get-confirmed-block
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
args+=(--enable-rpc-exit)
|
|
||||||
if [[ -n $internalNodesLamports ]]; then
|
if [[ -n $internalNodesLamports ]]; then
|
||||||
args+=(--node-lamports "$internalNodesLamports")
|
args+=(--node-lamports "$internalNodesLamports")
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -688,6 +688,12 @@ pub fn main() {
|
||||||
.takes_value(false)
|
.takes_value(false)
|
||||||
.help("Enable the JSON RPC 'validatorExit' API. Only enable in a debug environment"),
|
.help("Enable the JSON RPC 'validatorExit' API. Only enable in a debug environment"),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("enable_rpc_set_log_filter")
|
||||||
|
.long("enable-rpc-set-log-filter")
|
||||||
|
.takes_value(false)
|
||||||
|
.help("Enable the JSON RPC 'setLogFilter' API. Only enable in a debug environment"),
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("enable_rpc_get_confirmed_block")
|
Arg::with_name("enable_rpc_get_confirmed_block")
|
||||||
.long("enable-rpc-get-confirmed-block")
|
.long("enable-rpc-get-confirmed-block")
|
||||||
|
@ -919,6 +925,7 @@ pub fn main() {
|
||||||
new_hard_forks: hardforks_of(&matches, "hard_forks"),
|
new_hard_forks: hardforks_of(&matches, "hard_forks"),
|
||||||
rpc_config: JsonRpcConfig {
|
rpc_config: JsonRpcConfig {
|
||||||
enable_validator_exit: matches.is_present("enable_rpc_exit"),
|
enable_validator_exit: matches.is_present("enable_rpc_exit"),
|
||||||
|
enable_set_log_filter: matches.is_present("enable_rpc_set_log_filter"),
|
||||||
enable_get_confirmed_block: matches.is_present("enable_rpc_get_confirmed_block"),
|
enable_get_confirmed_block: matches.is_present("enable_rpc_get_confirmed_block"),
|
||||||
identity_pubkey: identity_keypair.pubkey(),
|
identity_pubkey: identity_keypair.pubkey(),
|
||||||
faucet_addr: matches.value_of("rpc_faucet_addr").map(|address| {
|
faucet_addr: matches.value_of("rpc_faucet_addr").map(|address| {
|
||||||
|
|
Loading…
Reference in New Issue