fn handle_gas_price_update(&mut self, txn: &MempoolTransaction) -> Result<()> {
        if let Some(txns) = self.transactions.get_mut(&txn.get_sender()) {
            if let Some(current_version) = txns.get_mut(&txn.get_sequence_number()) {
                if current_version.txn.max_gas_amount() == txn.txn.max_gas_amount()
                    && current_version.txn.payload() == txn.txn.payload()
                    && current_version.txn.expiration_time() == txn.txn.expiration_time()
                    && current_version.get_gas_price() < txn.get_gas_price()
                {
                    if let Some(txn) = txns.remove(&txn.get_sequence_number()) {
                        self.index_remove(&txn);
                    }
                } else {
                    return Err(format_err!("Invalid gas price update. txn gas price: {}, current_version gas price: {}",
                            txn.get_gas_price(),
                            current_version.get_gas_price()));
                }
            }
        }
        Ok(())
    }
/// check if transaction is already present in Mempool
/// e.g. given request is update
/// we allow increase in gas price to speed up process
check if transaction is already present in Mempool
e.g. given request is update
we allow increase in gas price to speed up process
check if transaction is already present in Mempool e . g . given request is update we allow increase in gas price to speed up process
fn handle_gas_price_update(&mut self, txn: &MempoolTransaction) -> Result<()> {
        if let Some(txns) = self.transactions.get_mut(&txn.get_sender()) {
            if let Some(current_version) = txns.get_mut(&txn.get_sequence_number()) {
                if current_version.txn.max_gas_amount() == txn.txn.max_gas_amount()
                    && current_version.txn.payload() == txn.txn.payload()
                    && current_version.txn.expiration_time() == txn.txn.expiration_time()
                    && current_version.get_gas_price() < txn.get_gas_price()
                {
                    if let Some(txn) = txns.remove(&txn.get_sequence_number()) {
                        self.index_remove(&txn);
                    }
                } else {
                    return Err(format_err!("Invalid gas price update. txn gas price: {}, current_version gas price: {}",
                            txn.get_gas_price(),
                            current_version.get_gas_price()));
                }
            }
        }
        Ok(())
    }
fn handle_gas_price_update ( & mut self , txn : & MempoolTransaction ) -> Result < ( ) > { if let Some ( txns ) = self . transactions . get_mut ( & txn . get_sender ( ) ) { if let Some ( current_version ) = txns . get_mut ( & txn . get_sequence_number ( ) ) { if current_version . txn . max_gas_amount ( ) == txn . txn . max_gas_amount ( ) && current_version . txn . payload ( ) == txn . txn . payload ( ) && current_version . txn . expiration_time ( ) == txn . txn . expiration_time ( ) && current_version . get_gas_price ( ) < txn . get_gas_price ( ) { if let Some ( txn ) = txns . remove ( & txn . get_sequence_number ( ) ) { self . index_remove ( & txn ) ; } } else { return Err ( format_err ! ( " " txn get_gas_price ( ) current_version get_gas_price ( ) ) ) ; } } } Ok ( ( ) ) }
check if transaction is already present in Mempool
e.g.
check if transaction is already present in Mempool e . g .
&mut self
txn
&MempoolTransaction
&mut self
txn
&MempoolTransaction