Add --rpc-max-multiple-accounts to override the getMultipleAccounts JSON RPC maximum
This commit is contained in:
parent
1dc71fb5aa
commit
6e9dbb4f6e
|
@ -108,6 +108,7 @@ pub struct JsonRpcConfig {
|
|||
pub health_check_slot_distance: u64,
|
||||
pub enable_bigtable_ledger_storage: bool,
|
||||
pub enable_bigtable_ledger_upload: bool,
|
||||
pub max_multiple_accounts: Option<usize>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1923,10 +1924,15 @@ impl RpcSol for RpcSolImpl {
|
|||
"get_multiple_accounts rpc request received: {:?}",
|
||||
pubkey_strs.len()
|
||||
);
|
||||
if pubkey_strs.len() > MAX_MULTIPLE_ACCOUNTS {
|
||||
|
||||
let max_multiple_accounts = meta
|
||||
.config
|
||||
.max_multiple_accounts
|
||||
.unwrap_or(MAX_MULTIPLE_ACCOUNTS);
|
||||
if pubkey_strs.len() > max_multiple_accounts {
|
||||
return Err(Error::invalid_params(format!(
|
||||
"Too many inputs provided; max {}",
|
||||
MAX_MULTIPLE_ACCOUNTS
|
||||
max_multiple_accounts
|
||||
)));
|
||||
}
|
||||
let mut pubkeys: Vec<Pubkey> = vec![];
|
||||
|
|
|
@ -11,7 +11,7 @@ use solana_clap_utils::{
|
|||
},
|
||||
keypair::SKIP_SEED_PHRASE_VALIDATION_ARG,
|
||||
};
|
||||
use solana_client::rpc_client::RpcClient;
|
||||
use solana_client::{rpc_client::RpcClient, rpc_request::MAX_MULTIPLE_ACCOUNTS};
|
||||
use solana_core::ledger_cleanup_service::{
|
||||
DEFAULT_MAX_LEDGER_SHREDS, DEFAULT_MIN_MAX_LEDGER_SHREDS,
|
||||
};
|
||||
|
@ -862,6 +862,7 @@ pub fn main() {
|
|||
let default_dynamic_port_range =
|
||||
&format!("{}-{}", VALIDATOR_PORT_RANGE.0, VALIDATOR_PORT_RANGE.1);
|
||||
let default_genesis_archive_unpacked_size = &MAX_GENESIS_ARCHIVE_UNPACKED_SIZE.to_string();
|
||||
let default_rpc_max_multiple_accounts = &MAX_MULTIPLE_ACCOUNTS.to_string();
|
||||
let default_rpc_pubsub_max_connections = PubSubConfig::default().max_connections.to_string();
|
||||
let default_rpc_pubsub_max_fragment_size =
|
||||
PubSubConfig::default().max_fragment_size.to_string();
|
||||
|
@ -1039,6 +1040,15 @@ pub fn main() {
|
|||
.takes_value(false)
|
||||
.help("Upload new confirmed blocks into a BigTable instance"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("rpc_max_multiple_accounts")
|
||||
.long("rpc-max-multiple-accounts")
|
||||
.value_name("MAX ACCOUNTS")
|
||||
.takes_value(true)
|
||||
.default_value(default_rpc_max_multiple_accounts)
|
||||
.help("Override the default maximum accounts accepted by \
|
||||
the getMultipleAccounts JSON RPC method")
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("health_check_slot_distance")
|
||||
.long("health-check-slot-distance")
|
||||
|
@ -1507,6 +1517,11 @@ pub fn main() {
|
|||
faucet_addr: matches.value_of("rpc_faucet_addr").map(|address| {
|
||||
solana_net_utils::parse_host_port(address).expect("failed to parse faucet address")
|
||||
}),
|
||||
max_multiple_accounts: Some(value_t_or_exit!(
|
||||
matches,
|
||||
"rpc_max_multiple_accounts",
|
||||
usize
|
||||
)),
|
||||
health_check_slot_distance: value_t_or_exit!(
|
||||
matches,
|
||||
"health_check_slot_distance",
|
||||
|
|
Loading…
Reference in New Issue