MCPcopy Create free account
hub / github.com/BitVM/BitVM / verifier_status

Method verifier_status

bridge/src/graphs/peg_in.rs:300–356  ·  view source on GitHub ↗
(
        &self,
        client: &AsyncClient,
        verifier_context: &VerifierContext,
        peg_outs: &[&PegOutGraph],
    )

Source from the content-addressed store, hash-verified

298 }
299
300 pub async fn verifier_status(
301 &self,
302 client: &AsyncClient,
303 verifier_context: &VerifierContext,
304 peg_outs: &[&PegOutGraph],
305 ) -> PegInVerifierStatus {
306 // check that the supplied peg out graphs match our expectation
307 let supplied_peg_out_ids = peg_outs.iter().map(|x| x.id()).sorted().collect::<Vec<_>>();
308 let expected_peg_out_ids = self.peg_out_graphs.iter().sorted().collect::<Vec<_>>();
309 if supplied_peg_out_ids != expected_peg_out_ids {
310 panic!("Invalid peg outs supplied as argument");
311 }
312
313 let (peg_in_deposit_status, peg_in_confirm_status, _) =
314 Self::get_peg_in_statuses(self, client).await;
315
316 if !peg_in_deposit_status.is_ok_and(|status| status.confirmed) {
317 // peg-in deposit not confirmed yet, wait
318 return PegInVerifierStatus::AwaitingDeposit;
319 }
320
321 if peg_outs.len() < NUM_REQUIRED_OPERATORS {
322 return PegInVerifierStatus::AwaitingPegOutCreation;
323 }
324
325 if peg_in_confirm_status.is_ok_and(|status| status.confirmed) {
326 // peg in complete
327 return PegInVerifierStatus::Complete;
328 }
329
330 if !self
331 .peg_in_confirm_transaction
332 .has_nonce_of(verifier_context)
333 {
334 return PegInVerifierStatus::PendingOurNonces(vec![self.id.clone()]);
335 }
336
337 let has_all_pegin_nonces = self.peg_in_confirm_transaction.has_all_nonces();
338 if !has_all_pegin_nonces {
339 return PegInVerifierStatus::AwaitingNonces;
340 }
341
342 if !self
343 .peg_in_confirm_transaction
344 .has_signatures_for(verifier_context.verifier_public_key)
345 {
346 return PegInVerifierStatus::PendingOurSignature(vec![self.id.clone()]);
347 }
348
349 let has_all_pegin_signatures = self.peg_in_confirm_transaction.has_all_signatures();
350 if !has_all_pegin_signatures {
351 return PegInVerifierStatus::AwaitingSignatures;
352 }
353
354 // we have all signature, but confirm wasn't included in a block yet
355 PegInVerifierStatus::ReadyToSubmit
356 }
357

Callers 1

Calls 6

lenMethod · 0.80
has_nonce_ofMethod · 0.80
has_signatures_forMethod · 0.80
idMethod · 0.45
has_all_noncesMethod · 0.45
has_all_signaturesMethod · 0.45

Tested by 1