Unverified Commit a4fec0c4 authored by Roman Zeyde's avatar Roman Zeyde
Browse files

Change Mempool::get_txn() to contains()

parent c8624575
...@@ -171,8 +171,8 @@ impl Tracker { ...@@ -171,8 +171,8 @@ impl Tracker {
} }
} }
pub fn get_txn(&self, txid: &Sha256dHash) -> Option<Transaction> { pub fn contains(&self, txid: &Sha256dHash) -> bool {
self.items.get(txid).map(|stats| stats.tx.clone()) self.items.contains_key(txid)
} }
/// Returns vector of (fee_rate, vsize) pairs, where fee_{n-1} > fee_n and vsize_n is the /// Returns vector of (fee_rate, vsize) pairs, where fee_{n-1} > fee_n and vsize_n is the
......
...@@ -319,7 +319,7 @@ impl Query { ...@@ -319,7 +319,7 @@ impl Query {
tx_hash: &Sha256dHash, tx_hash: &Sha256dHash,
block_height: Option<u32>, block_height: Option<u32>,
) -> Result<Option<Sha256dHash>> { ) -> Result<Option<Sha256dHash>> {
let blockhash = if self.tracker.read().unwrap().get_txn(&tx_hash).is_some() { let blockhash = if self.tracker.read().unwrap().contains(&tx_hash) {
None // found in mempool (as unconfirmed transaction) None // found in mempool (as unconfirmed transaction)
} else { } else {
// Lookup in confirmed transactions' index // Lookup in confirmed transactions' index
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment