Skip to content

Commit 2aa3252

Browse files
committed
refactor: use logging instead of panic when allocation id is not found
1 parent d101e29 commit 2aa3252

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

crates/tap-agent/src/tracker/generic_tracker.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use std::{
88
};
99

1010
use thegraph_core::alloy::primitives::Address;
11+
use tracing::warn;
1112

1213
use super::{
1314
global_tracker::GlobalTracker, AllocationStats, DefaultFromExtra, DurationInfo, SenderFeeStats,
@@ -215,10 +216,13 @@ where
215216
}
216217

217218
pub fn is_allocation_id_blocked(&self, address: &Address) -> bool {
218-
self.id_to_fee
219-
.get(address)
220-
.map(|v| v.blocked)
221-
.expect("Allocation ID not found")
219+
match self.id_to_fee.get(address).map(|v| v.blocked) {
220+
Some(val) => val,
221+
None => {
222+
warn!("Allocation ID not found in the tracker");
223+
false
224+
}
225+
}
222226
}
223227

224228
pub fn can_trigger_rav(&self, allocation_id: Address) -> bool {

0 commit comments

Comments
 (0)