Skip to content

Commit

Permalink
Sergi's suggestions 6
Browse files Browse the repository at this point in the history
  • Loading branch information
mariocynicys committed Aug 31, 2023
1 parent 19ea462 commit c313ffe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions teos/src/gatekeeper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 3 additions & 0 deletions teos/src/responder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion teos/src/tx_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit c313ffe

Please sign in to comment.