Skip to content

Commit

Permalink
check for uninitialized acc before calling the hook
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvja committed Dec 8, 2024
1 parent 468a83d commit 70239ee
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions solana/solana-ibc/programs/solana-ibc/src/transfer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,22 @@ impl ibc::Module for IbcStorage<'_, '_> {
if success {
let store = self.borrow();
let accounts = &store.accounts.remaining_accounts;
let result = call_bridge_escrow(accounts, &maybe_ft_packet.data);
if let Err(status) = result {
ack = status.into();
// Check if any account is not initialized and return the uninitialized account
if let Some(uninitialized_account) =
accounts.iter().find(|account| account.lamports() == 0)
{
let status = ibc::TokenTransferError::Other(format!(
"Account {} not initialized",
uninitialized_account.key
))
.into();
ack = ibc::AcknowledgementStatus::error(status).into();
} else {
let result =
call_bridge_escrow(accounts, &maybe_ft_packet.data);
if let Err(status) = result {
ack = status.into();
}
}
}

Expand Down

0 comments on commit 70239ee

Please sign in to comment.