Skip to content

Commit

Permalink
replace unwrap_or
Browse files Browse the repository at this point in the history
  • Loading branch information
imabdulbasit committed Oct 17, 2023
1 parent f64c19e commit 3d1a9aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions consumer/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -755,8 +755,7 @@ impl Processor {
let blockhash = with_retry!(self.solana().rpc().get_latest_blockhash())
.await
.context("blockhash not found")
.map_err(ProcessorErrorKind::Solana)
.unwrap();
.map_err(ProcessorErrorKind::Solana)?;

let send_event = |mint_transactions: Vec<SolanaMintTransaction>,
signers_pubkeys: Vec<String>| async {
Expand Down
6 changes: 5 additions & 1 deletion consumer/src/solana.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,11 @@ impl<'a> MintBackend<MintMetaplexMetadataTransaction, MintMetaplexAddresses>
let associated_token_account = get_associated_token_address(&recipient, &mint.pubkey());
let len = spl_token::state::Mint::LEN;
let rent = with_retry!(rpc.get_minimum_balance_for_rent_exemption(len)).await?;
let blockhash = blockhash.unwrap_or(with_retry!(rpc.get_latest_blockhash()).await?);
let blockhash = if let Some(blockhash) = blockhash {
blockhash
} else {
with_retry!(rpc.get_latest_blockhash()).await?
};

let create_account_ins = solana_program::system_instruction::create_account(
&payer,
Expand Down

0 comments on commit 3d1a9aa

Please sign in to comment.