Skip to content

Commit

Permalink
Zero the mempool metrics when the mempool is disabled (#2875)
Browse files Browse the repository at this point in the history
Co-authored-by: Conrado Gouvea <[email protected]>
  • Loading branch information
teor2345 and conradoplg authored Oct 14, 2021
1 parent a21dd26 commit 70ec51d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions zebrad/src/components/mempool/storage/verified_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> + '_ {
Expand Down

0 comments on commit 70ec51d

Please sign in to comment.