From c313ffe3cf5e0cc62fb3d9a55e0bc465fa50b2cd Mon Sep 17 00:00:00 2001 From: Omer Yacine Date: Wed, 30 Aug 2023 14:52:56 +0300 Subject: [PATCH] Sergi's suggestions 6 --- teos/src/gatekeeper.rs | 2 ++ teos/src/responder.rs | 3 +++ teos/src/tx_index.rs | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/teos/src/gatekeeper.rs b/teos/src/gatekeeper.rs index fe67c156..e5d490e3 100644 --- a/teos/src/gatekeeper.rs +++ b/teos/src/gatekeeper.rs @@ -249,6 +249,8 @@ impl Gatekeeper { .lock() .unwrap() .iter() + // NOTE: Ideally there won't be a user with `block_height > subscription_expiry + expiry_delta`, but + // this might happen if we skip a couple of block connections due to a force update. .filter(|(_, info)| block_height >= info.subscription_expiry + self.expiry_delta) .map(|(user_id, _)| *user_id) .collect() diff --git a/teos/src/responder.rs b/teos/src/responder.rs index e8d00fc5..29668a85 100644 --- a/teos/src/responder.rs +++ b/teos/src/responder.rs @@ -356,6 +356,9 @@ impl Responder { // Retry sending trackers which have been in the mempool since more than `CONFIRMATIONS_BEFORE_RETRY` blocks. let stale_confirmation_status = ConfirmationStatus::InMempoolSince(height - CONFIRMATIONS_BEFORE_RETRY as u32); + // NOTE: Ideally this will only pull UUIDs which have been in mempool since `CONFIRMATIONS_BEFORE_RETRY`, but + // might also return ones which have been there for a longer period. This can only happen if the tower missed + // a couple of block connections due to a force update. for uuid in dbm .load_trackers_with_confirmation_status(stale_confirmation_status) .unwrap() diff --git a/teos/src/tx_index.rs b/teos/src/tx_index.rs index d1251d50..a0e4a35a 100644 --- a/teos/src/tx_index.rs +++ b/teos/src/tx_index.rs @@ -303,7 +303,7 @@ mod tests { ); let fake_hash = BlockHash::default(); - assert!(matches!(cache.get_height(&fake_hash), None)); + assert!(cache.get_height(&fake_hash).is_none()); } #[tokio::test]