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:
@ -1,22 +1,27 @@
|
||||
use crate::bank::Bank;
|
||||
use solana_sdk::account::Account;
|
||||
use solana_sdk::client::{AsyncClient, Client, SyncClient};
|
||||
use solana_sdk::fee_calculator::FeeCalculator;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::instruction::Instruction;
|
||||
use solana_sdk::message::Message;
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::signature::Signature;
|
||||
use solana_sdk::signature::{Keypair, KeypairUtil};
|
||||
use solana_sdk::system_instruction;
|
||||
use solana_sdk::transaction::{self, Transaction};
|
||||
use solana_sdk::transport::{Result, TransportError};
|
||||
use std::io;
|
||||
use std::sync::mpsc::{channel, Receiver, Sender};
|
||||
use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
use std::thread::{sleep, Builder};
|
||||
use std::time::{Duration, Instant};
|
||||
use solana_sdk::{
|
||||
account::Account,
|
||||
client::{AsyncClient, Client, SyncClient},
|
||||
commitment_config::CommitmentConfig,
|
||||
fee_calculator::FeeCalculator,
|
||||
hash::Hash,
|
||||
instruction::Instruction,
|
||||
message::Message,
|
||||
pubkey::Pubkey,
|
||||
signature::{Keypair, KeypairUtil, Signature},
|
||||
system_instruction,
|
||||
transaction::{self, Transaction},
|
||||
transport::{Result, TransportError},
|
||||
};
|
||||
use std::{
|
||||
io,
|
||||
sync::{
|
||||
mpsc::{channel, Receiver, Sender},
|
||||
Arc, Mutex,
|
||||
},
|
||||
thread::{sleep, Builder},
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
pub struct BankClient {
|
||||
bank: Arc<Bank>,
|
||||
@ -100,14 +105,37 @@ impl SyncClient for BankClient {
|
||||
Ok(self.bank.get_account(pubkey))
|
||||
}
|
||||
|
||||
fn get_account_with_commitment(
|
||||
&self,
|
||||
pubkey: &Pubkey,
|
||||
_commitment_config: CommitmentConfig,
|
||||
) -> Result<Option<Account>> {
|
||||
Ok(self.bank.get_account(pubkey))
|
||||
}
|
||||
|
||||
fn get_balance(&self, pubkey: &Pubkey) -> Result<u64> {
|
||||
Ok(self.bank.get_balance(pubkey))
|
||||
}
|
||||
|
||||
fn get_balance_with_commitment(
|
||||
&self,
|
||||
pubkey: &Pubkey,
|
||||
_commitment_config: CommitmentConfig,
|
||||
) -> Result<u64> {
|
||||
Ok(self.bank.get_balance(pubkey))
|
||||
}
|
||||
|
||||
fn get_recent_blockhash(&self) -> Result<(Hash, FeeCalculator)> {
|
||||
Ok(self.bank.last_blockhash_with_fee_calculator())
|
||||
}
|
||||
|
||||
fn get_recent_blockhash_with_commitment(
|
||||
&self,
|
||||
_commitment_config: CommitmentConfig,
|
||||
) -> Result<(Hash, FeeCalculator)> {
|
||||
Ok(self.bank.last_blockhash_with_fee_calculator())
|
||||
}
|
||||
|
||||
fn get_signature_status(
|
||||
&self,
|
||||
signature: &Signature,
|
||||
@ -115,14 +143,33 @@ impl SyncClient for BankClient {
|
||||
Ok(self.bank.get_signature_status(signature))
|
||||
}
|
||||
|
||||
fn get_signature_status_with_commitment(
|
||||
&self,
|
||||
signature: &Signature,
|
||||
_commitment_config: CommitmentConfig,
|
||||
) -> Result<Option<transaction::Result<()>>> {
|
||||
Ok(self.bank.get_signature_status(signature))
|
||||
}
|
||||
|
||||
fn get_slot(&self) -> Result<u64> {
|
||||
Ok(self.bank.slot())
|
||||
}
|
||||
|
||||
fn get_slot_with_commitment(&self, _commitment_config: CommitmentConfig) -> Result<u64> {
|
||||
Ok(self.bank.slot())
|
||||
}
|
||||
|
||||
fn get_transaction_count(&self) -> Result<u64> {
|
||||
Ok(self.bank.transaction_count())
|
||||
}
|
||||
|
||||
fn get_transaction_count_with_commitment(
|
||||
&self,
|
||||
_commitment_config: CommitmentConfig,
|
||||
) -> Result<u64> {
|
||||
Ok(self.bank.transaction_count())
|
||||
}
|
||||
|
||||
fn poll_for_signature_confirmation(
|
||||
&self,
|
||||
signature: &Signature,
|
||||
|
Reference in New Issue
Block a user