Skip to content

Commit e775e74

Browse files
committed
adds authentication call before fetching bundles from cache
1 parent 41e7474 commit e775e74

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/tasks/block.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ impl BlockBuilder {
143143
}
144144
}
145145

146+
/// Fetches transactions from the cache and ingests them into the in progress block
146147
async fn get_transactions(&mut self, in_progress: &mut InProgressBlock) {
147148
tracing::trace!("query transactions from cache");
148149
let txns = self.tx_poller.check_tx_cache().await;
@@ -159,7 +160,14 @@ impl BlockBuilder {
159160
}
160161
}
161162

163+
/// Fetches bundles from the cache and ingests them into the in progress block
162164
async fn get_bundles(&mut self, host_provider: &Provider, in_progress: &mut InProgressBlock) {
165+
// Authenticate before fetching to ensure access to a valid token
166+
if let Err(err) = self.bundle_poller.authenticator.authenticate().await {
167+
tracing::error!(err = %err, "bundle fetcher failed to authenticate");
168+
return
169+
}
170+
163171
tracing::trace!("query bundles from cache");
164172
let bundles = self.bundle_poller.check_bundle_cache().await;
165173
// OPTIMIZE: Sort bundles received from cache

0 commit comments

Comments
 (0)