Skip to content

Commit

Permalink
Check blockhash is expired or not (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
godmodegalactus committed Mar 8, 2024
1 parent 6038866 commit 73973ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions core/src/stores/data_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,14 @@ impl DataCache {
pub async fn check_if_confirmed_or_expired_blockheight(
&self,
sent_transaction_info: &SentTransactionInfo,
current_blockheight: u64,
) -> bool {
let last_block = self
.block_information_store
.get_latest_block_info(CommitmentConfig::processed())
.await;
self.txs
.is_transaction_confirmed(&sent_transaction_info.signature)
|| current_blockheight > sent_transaction_info.last_valid_block_height
|| last_block.block_height > sent_transaction_info.last_valid_block_height
}

pub async fn get_current_epoch(&self, commitment: CommitmentConfig) -> Epoch {
Expand Down
2 changes: 1 addition & 1 deletion services/src/tpu_utils/tpu_connection_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl ActiveConnection {

let tx: Vec<u8> = match tx {
Ok(transaction_sent_info) => {
if self.data_cache.txs.is_transaction_confirmed(&transaction_sent_info.signature) {
if self.data_cache.check_if_confirmed_or_expired_blockheight(&transaction_sent_info).await {
// transaction is already confirmed/ no need to send
continue;
}
Expand Down

0 comments on commit 73973ba

Please sign in to comment.