Refactor mempool transaction handling into separate methods

This commit is contained in:
Roman Zeyde 2018-05-18 21:51:00 +03:00
parent 1944bf2bd5
commit 5300149c0a
No known key found for this signature in database
GPG Key ID: 87CAE5FA46917CBB

View File

@ -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 {