use Option

This commit is contained in:
Aniket Prajapati 2023-01-04 17:43:23 +05:30
parent c5c0f86b45
commit af05b7420c
4 changed files with 11 additions and 9 deletions

View File

@ -43,7 +43,7 @@ impl BenchHelper {
.await
.context("requesting air drop")?;
info!("Air Dropping {payer_pubkey} with {amount}L");
info!("Air Dropping {payer_pubkey} with {amount}L {airdrop_sig}");
self.wait_till_signature_status(&airdrop_sig, CommitmentConfig::finalized())
.await?;

View File

@ -107,11 +107,13 @@ impl LiteRpcServer for LiteBridge {
async fn send_transaction(
&self,
tx: String,
SendTransactionConfig {
send_transaction_config: Option<SendTransactionConfig>,
) -> crate::rpc::Result<String> {
let SendTransactionConfig {
encoding,
max_retries: _,
}: SendTransactionConfig,
) -> crate::rpc::Result<String> {
} = send_transaction_config.unwrap_or_default();
let raw_tx = encoding.decode(tx).unwrap();
let sig = bincode::deserialize::<VersionedTransaction>(&raw_tx)
@ -197,14 +199,14 @@ impl LiteRpcServer for LiteBridge {
&self,
pubkey_str: String,
lamports: u64,
config: RpcRequestAirdropConfig,
config: Option<RpcRequestAirdropConfig>,
) -> crate::rpc::Result<String> {
let pubkey = Pubkey::from_str(&pubkey_str).unwrap();
Ok(self
.tpu_client
.rpc_client()
.request_airdrop_with_config(&pubkey, lamports, config)
.request_airdrop_with_config(&pubkey, lamports, config.unwrap_or_default())
.await
.unwrap()
.to_string())

View File

@ -16,7 +16,7 @@ pub trait LiteRpc {
async fn send_transaction(
&self,
tx: String,
send_transaction_config: SendTransactionConfig,
send_transaction_config: Option<SendTransactionConfig>,
) -> Result<String>;
#[method(name = "getLatestBlockhash")]
@ -40,6 +40,6 @@ pub trait LiteRpc {
&self,
pubkey_str: String,
lamports: u64,
config: RpcRequestAirdropConfig,
config: Option<RpcRequestAirdropConfig>,
) -> Result<String>;
}

View File

@ -128,7 +128,7 @@ impl BlockListener {
sig,
TransactionStatus {
slot,
confirmations: Some(1), //TODO: talk about this
confirmations: None, //TODO: talk about this
status: Ok(()), // legacy field
err: None,
confirmation_status: Some(comfirmation_status.clone()),