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)
| 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) { |