Zero the mempool metrics when the mempool is disabled (#2875)

Co-authored-by: Conrado Gouvea <conrado@zfnd.org>
This commit is contained in:
teor 2021-10-15 00:41:07 +10:00 committed by GitHub
parent a21dd26a5e
commit 70ec51d770
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -43,6 +43,13 @@ pub struct VerifiedSet {
orchard_nullifiers: HashSet<orchard::Nullifier>,
}
impl Drop for VerifiedSet {
fn drop(&mut self) {
// zero the metrics on drop
self.clear()
}
}
impl VerifiedSet {
/// Returns an iterator over the transactions in the set.
pub fn transactions(&self) -> impl Iterator<Item = &UnminedTx> + '_ {