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

Method operator_status

bridge/src/graphs/peg_out.rs:1215–1374  ·  view source on GitHub ↗
(&self, client: &AsyncClient)

Source from the content-addressed store, hash-verified

1213 }
1214
1215 pub async fn operator_status(&self, client: &AsyncClient) -> PegOutOperatorStatus {
1216 if self.n_of_n_presigned && self.is_peg_out_initiated() {
1217 let (
1218 assert_initial_status,
1219 assert_commit_1_status,
1220 assert_commit_2_status,
1221 assert_final_status,
1222 challenge_status,
1223 disprove_chain_status,
1224 disprove_status,
1225 peg_out_confirm_status,
1226 kick_off_1_status,
1227 kick_off_2_status,
1228 kick_off_timeout_status,
1229 peg_out_status,
1230 start_time_timeout_status,
1231 start_time_status,
1232 take_1_status,
1233 take_2_status,
1234 ) = Self::get_peg_out_statuses(self, client).await;
1235 let blockchain_height = client.get_height().await;
1236
1237 if peg_out_status.is_some_and(|status| status.unwrap().confirmed) {
1238 if kick_off_2_status
1239 .as_ref()
1240 .is_ok_and(|status| status.confirmed)
1241 {
1242 if take_1_status.as_ref().is_ok_and(|status| status.confirmed)
1243 || take_2_status.as_ref().is_ok_and(|status| status.confirmed)
1244 {
1245 return PegOutOperatorStatus::PegOutComplete;
1246 } else if disprove_chain_status
1247 .as_ref()
1248 .is_ok_and(|status| status.confirmed)
1249 || disprove_status
1250 .as_ref()
1251 .is_ok_and(|status| status.confirmed)
1252 {
1253 return PegOutOperatorStatus::PegOutFailed; // TODO: can be also `PegOutOperatorStatus::PegOutComplete`
1254 } else if challenge_status.is_ok_and(|status| status.confirmed) {
1255 if assert_final_status
1256 .as_ref()
1257 .is_ok_and(|status| status.confirmed)
1258 {
1259 if assert_final_status
1260 .as_ref()
1261 .unwrap()
1262 .block_height
1263 .is_some_and(|block_height| {
1264 blockchain_height.is_ok_and(|blockchain_height| {
1265 block_height + self.connector_4.num_blocks_timelock
1266 <= blockchain_height
1267 })
1268 })
1269 {
1270 return PegOutOperatorStatus::PegOutTake2Available;
1271 } else {
1272 return PegOutOperatorStatus::PegOutWait;

Callers

nothing calls this directly

Calls 2

is_peg_out_initiatedMethod · 0.80
as_refMethod · 0.80

Tested by

no test coverage detected