Use rooted bank by default in rpc bank selection (#6759)
* Name anonymous parameters for clarity * Add CommitmentConfig to select bank for rpc * Add commitment information to jsonrpc docs * Update send_and_confirm retries as per commitment defaults * Pass CommitmentConfig into client requests; also various 'use' cleanup * Use _with_commitment methods to speed local_cluster tests * Pass CommitmentConfig into Archiver in order to enable quick confirmations in local_cluster tests * Restore solana ping speed * Increase wallet-sanity timeout to account for longer confirmation time
This commit is contained in:
36
sdk/src/commitment_config.rs
Normal file
36
sdk/src/commitment_config.rs
Normal file
@ -0,0 +1,36 @@
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CommitmentConfig {
|
||||
pub commitment: CommitmentLevel,
|
||||
}
|
||||
|
||||
impl Default for CommitmentConfig {
|
||||
fn default() -> Self {
|
||||
CommitmentConfig {
|
||||
commitment: CommitmentLevel::Max,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl CommitmentConfig {
|
||||
pub fn recent() -> Self {
|
||||
Self {
|
||||
commitment: CommitmentLevel::Recent,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn ok(&self) -> Option<Self> {
|
||||
if self == &Self::default() {
|
||||
None
|
||||
} else {
|
||||
Some(self.clone())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum CommitmentLevel {
|
||||
Max,
|
||||
Recent,
|
||||
}
|
Reference in New Issue
Block a user