Check blockhash is expired or not (#351)

This commit is contained in:
galactus 2024-03-07 16:09:22 +01:00 committed by godmodegalactus
parent 60388667f5
commit 73973ba0f5
No known key found for this signature in database
GPG Key ID: 22DA4A30887FDA3C
2 changed files with 6 additions and 3 deletions

View File

@ -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 {

View File

@ -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;
}