MCPcopy Create free account
hub / github.com/SeismicSystems/summit / try_dispatch_blocks

Method try_dispatch_blocks

syncer/src/actor.rs:1174–1221  ·  view source on GitHub ↗

Attempt to dispatch finalized blocks to the application until the pipeline is full or no more blocks are available. This does NOT advance `last_processed_height` or sync metadata. It only sends blocks to the application and enqueues pending acks. Metadata is updated later when acks arrive and [`Self::handle_block_processed`] runs. Acks are processed in FIFO order so `last_processed_height` alway

(
        &mut self,
        application: &mut impl Reporter<Activity = Update<B, P::Scheme, A>>,
        resolver: &mut impl Resolver<Key = Request<B::Digest>>,
    )

Source from the content-addressed store, hash-verified

1172 block,
1173 response,
1174 } => {
1175 response.send_lossy(true);
1176 let round = notarization.round();
1177 let commitment = block.digest();
1178 debug!(?round, ?commitment, "received notarization");
1179
1180 // If there exists a finalization certificate for this block, we
1181 // should finalize it.
1182 let height = block.height();
1183 if let Some(finalization) = self.cache.get_finalization_for(commitment).await {
1184 wrote |= self
1185 .store_finalization(
1186 height,
1187 commitment,
1188 block.clone(),
1189 Some(finalization),
1190 application,
1191 buffer,
1192 )
1193 .await;
1194 }
1195
1196 // Cache the notarization and block.
1197 self.cache_block(round, commitment, block.clone()).await;
1198 self.cache
1199 .put_notarization(round, commitment, notarization)
1200 .await;
1201 application
1202 .report(Update::NotarizedBlock(block.clone()))
1203 .await;
1204 self.notify_subscribers(commitment, &block).await;
1205 }
1206 }
1207 }
1208
1209 wrote
1210 }
1211
1212 /// Returns a scheme suitable for verifying certificates at the given epoch.
1213 ///
1214 /// Prefers a certificate verifier if available, otherwise falls back
1215 /// to the scheme for the given epoch.
1216 fn get_scheme_certificate_verifier(&self, epoch: Epoch) -> Option<Arc<P::Scheme>> {
1217 self.provider.all().or_else(|| self.provider.scoped(epoch))
1218 }
1219
1220 // -------------------- Waiters --------------------
1221
1222 /// Notify any subscribers for the given commitment with the provided block.
1223 async fn notify_subscribers(&mut self, commitment: B::Digest, block: &B) {
1224 if let Some(mut bs) = self.block_subscriptions.remove(&commitment) {

Callers 1

runMethod · 0.80

Calls 10

is_last_block_of_epochFunction · 0.85
has_capacityMethod · 0.80
next_dispatch_heightMethod · 0.80
get_finalized_blockMethod · 0.80
getMethod · 0.80
enqueueMethod · 0.80
heightMethod · 0.45
digestMethod · 0.45
reportMethod · 0.45

Tested by

no test coverage detected