| 1124 | } |
| 1125 | |
| 1126 | pub async fn broadcast_challenge( |
| 1127 | &mut self, |
| 1128 | peg_out_graph_id: &String, |
| 1129 | crowdfundng_inputs: &Vec<InputWithScript<'_>>, |
| 1130 | output_script_pubkey: ScriptBuf, |
| 1131 | ) -> Result<Txid, Error> { |
| 1132 | let graph = Self::find_peg_out_or_fail(&mut self.data, peg_out_graph_id)?; |
| 1133 | |
| 1134 | let keypair = match ( |
| 1135 | self.depositor_context.as_ref(), |
| 1136 | self.operator_context.as_ref(), |
| 1137 | self.verifier_context.as_ref(), |
| 1138 | self.withdrawer_context.as_ref(), |
| 1139 | ) { |
| 1140 | (Some(c), _, _, _) => &c.depositor_keypair, |
| 1141 | (_, Some(c), _, _) => &c.operator_keypair, |
| 1142 | (_, _, Some(c), _) => &c.verifier_keypair, |
| 1143 | (_, _, _, Some(c)) => &c.withdrawer_keypair, |
| 1144 | _ => Err(Error::Client(ClientError::NoUserContextDefined))?, |
| 1145 | }; |
| 1146 | |
| 1147 | let tx = graph |
| 1148 | .challenge( |
| 1149 | &self.esplora, |
| 1150 | crowdfundng_inputs, |
| 1151 | keypair, |
| 1152 | output_script_pubkey, |
| 1153 | ) |
| 1154 | .await?; |
| 1155 | self.broadcast_tx(&tx).await |
| 1156 | } |
| 1157 | |
| 1158 | pub async fn broadcast_assert_initial( |
| 1159 | &mut self, |