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

Method peg_out

bridge/src/graphs/peg_out.rs:1408–1433  ·  view source on GitHub ↗
(
        &mut self,
        client: &AsyncClient,
        context: &OperatorContext,
        input: Input,
    )

Source from the content-addressed store, hash-verified

1406 }
1407
1408 pub async fn peg_out(
1409 &mut self,
1410 client: &AsyncClient,
1411 context: &OperatorContext,
1412 input: Input,
1413 ) -> Result<Transaction, Error> {
1414 if !self.is_peg_out_initiated() {
1415 return Err(Error::L2(L2Error::PegOutNotInitiated));
1416 }
1417
1418 if self.peg_out_transaction.is_some() {
1419 let txid = self
1420 .peg_out_transaction
1421 .as_ref()
1422 .unwrap()
1423 .tx()
1424 .compute_txid();
1425 verify_if_not_mined(client, txid).await?;
1426 } else {
1427 let event = self.peg_out_chain_event.as_ref().unwrap();
1428 let tx = PegOutTransaction::new(context, event, input);
1429 self.peg_out_transaction = Some(tx);
1430 }
1431
1432 Ok(self.peg_out_transaction.as_mut().unwrap().finalize())
1433 }
1434
1435 pub async fn peg_out_confirm(&mut self, client: &AsyncClient) -> Result<Transaction, Error> {
1436 verify_if_not_mined(client, self.peg_out_confirm_transaction.tx().compute_txid()).await?;

Callers 2

broadcast_peg_outMethod · 0.80
test_peg_out_feesFunction · 0.80

Calls 5

verify_if_not_minedFunction · 0.85
is_peg_out_initiatedMethod · 0.80
as_refMethod · 0.80
txMethod · 0.45
finalizeMethod · 0.45

Tested by 1

test_peg_out_feesFunction · 0.64