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

Method process_peg_in_as_verifier

bridge/src/client/client.rs:732–767  ·  view source on GitHub ↗

TODO: refactor series of method e.g. process_*_as_* to return Result in order to properly handle internal errors

(&mut self, peg_in_graph_id: &GraphId)

Source from the content-addressed store, hash-verified

730
731 // TODO: refactor series of method e.g. process_*_as_* to return Result in order to properly handle internal errors
732 pub async fn process_peg_in_as_verifier(&mut self, peg_in_graph_id: &GraphId) {
733 if let Some(ref context) = self.verifier_context {
734 if let Ok(peg_in_graph) = self.get_peg_in_graph(peg_in_graph_id) {
735 let peg_outs_for_this_peg_in = self
736 .data
737 .peg_out_graphs
738 .iter()
739 .filter(|peg_out| peg_in_graph.peg_out_graphs.contains(peg_out.id()))
740 .collect::<Vec<_>>();
741 let status = peg_in_graph
742 .verifier_status(&self.esplora, context, &peg_outs_for_this_peg_in)
743 .await;
744 match status {
745 PegInVerifierStatus::PendingOurNonces(graph_ids) => {
746 println!("Pushing nonces for graphs {graph_ids:?}");
747 for graph_id in graph_ids {
748 self.push_verifier_nonces(&graph_id);
749 }
750 }
751 PegInVerifierStatus::PendingOurSignature(graph_ids) => {
752 println!("Pushing signature for graphs {graph_ids:?}");
753 for graph_id in graph_ids {
754 self.push_verifier_signature(&graph_id);
755 }
756 }
757 PegInVerifierStatus::ReadyToSubmit => {
758 println!("Broadcasting peg-in confirm");
759 let _ = self.broadcast_peg_in_confirm(peg_in_graph_id).await;
760 }
761 _ => {
762 // nothing to do
763 }
764 }
765 }
766 }
767 }
768
769 // TODO: refactor, see note on self.process_peg_in_as_verifier
770 pub async fn process_peg_in_as_operator(&mut self, peg_in_graph_id: &GraphId) {

Callers 5

process_peg_insMethod · 0.80
test_peg_in_feesFunction · 0.80
test_peg_out_feesFunction · 0.80
create_peg_out_graphFunction · 0.80

Calls 7

get_peg_in_graphMethod · 0.80
containsMethod · 0.80
idMethod · 0.45
verifier_statusMethod · 0.45
push_verifier_noncesMethod · 0.45

Tested by 4

test_peg_in_feesFunction · 0.64
test_peg_out_feesFunction · 0.64
create_peg_out_graphFunction · 0.64