Checks if there are any pending bottom up batch commitments, if so execute them.
(&self, submitter: Address)
| 249 | |
| 250 | /// Checks if there are any pending bottom up batch commitments, if so execute them. |
| 251 | async fn execute_pending_batch_commitments(&self, submitter: Address) -> Result<()> { |
| 252 | let pending_commitments = self |
| 253 | .parent_handler |
| 254 | .list_pending_bottom_up_batch_commitments(&self.metadata.child.id) |
| 255 | .await |
| 256 | .map_err(|e| { |
| 257 | anyhow!( |
| 258 | "cannot obtain the list of pending bottom up batch commitments due to: {e:}" |
| 259 | ) |
| 260 | })?; |
| 261 | tracing::info!("total pending commitments: {}", pending_commitments.len()); |
| 262 | |
| 263 | for commitment in pending_commitments { |
| 264 | let inclusions = self |
| 265 | .child_handler |
| 266 | .make_next_bottom_up_batch_inclusions(&commitment) |
| 267 | .await?; |
| 268 | |
| 269 | let height = commitment.height as i64; |
| 270 | self.parent_handler |
| 271 | .execute_bottom_up_batch(&submitter, &self.metadata.child.id, height, inclusions) |
| 272 | .await |
| 273 | .inspect_err(|err| { |
| 274 | tracing::error!("Fail to execute bottom up batch at height {height}: {err}"); |
| 275 | })?; |
| 276 | } |
| 277 | |
| 278 | tracing::debug!("Waiting for all execution tasks to finish"); |
| 279 | |
| 280 | Ok(()) |
| 281 | } |
| 282 | } |
no test coverage detected