Refactor mempool transaction handling into separate methods
This commit is contained in:
parent
1944bf2bd5
commit
5300149c0a
|
@ -77,10 +77,10 @@ impl Tracker {
|
|||
}
|
||||
};
|
||||
trace!("new tx: {}, {:.3}", txid, entry.fee_per_vbyte(),);
|
||||
self.stats.insert(*txid, Stats::new(tx, entry));
|
||||
self.add(txid, Stats::new(tx, entry));
|
||||
}
|
||||
for txid in old_txids.difference(&new_txids) {
|
||||
self.stats.remove(txid);
|
||||
self.remove(txid);
|
||||
}
|
||||
let dt = t.elapsed();
|
||||
debug!(
|
||||
|
@ -90,6 +90,14 @@ impl Tracker {
|
|||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn add(&mut self, txid: &Sha256dHash, stats: Stats) {
|
||||
self.stats.insert(*txid, stats);
|
||||
}
|
||||
|
||||
fn remove(&mut self, txid: &Sha256dHash) {
|
||||
self.stats.remove(txid);
|
||||
}
|
||||
}
|
||||
|
||||
trait InSeconds {
|
||||
|
|
Loading…
Reference in New Issue
Block a user