Compare commits

...

1 Commits

Author SHA1 Message Date
Roman Zeyde
a4fec0c445
Change Mempool::get_txn() to contains() 2018-10-29 22:04:54 +02:00
2 changed files with 3 additions and 3 deletions

View File

@ -171,8 +171,8 @@ impl Tracker {
}
}
pub fn get_txn(&self, txid: &Sha256dHash) -> Option<Transaction> {
self.items.get(txid).map(|stats| stats.tx.clone())
pub fn contains(&self, txid: &Sha256dHash) -> bool {
self.items.contains_key(txid)
}
/// Returns vector of (fee_rate, vsize) pairs, where fee_{n-1} > fee_n and vsize_n is the

View File

@ -319,7 +319,7 @@ impl Query {
tx_hash: &Sha256dHash,
block_height: Option<u32>,
) -> 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)
} else {
// Lookup in confirmed transactions' index