Check blockhash is expired or not (#351)
This commit is contained in:
parent
60388667f5
commit
73973ba0f5
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue