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

Method challenge

bridge/src/graphs/peg_out.rs:1516–1544  ·  view source on GitHub ↗
(
        &mut self,
        client: &AsyncClient,
        crowdfundng_inputs: &Vec<InputWithScript<'_>>,
        keypair: &Keypair,
        output_script_pubkey: ScriptBuf,
    )

Source from the content-addressed store, hash-verified

1514 }
1515
1516 pub async fn challenge(
1517 &mut self,
1518 client: &AsyncClient,
1519 crowdfundng_inputs: &Vec<InputWithScript<'_>>,
1520 keypair: &Keypair,
1521 output_script_pubkey: ScriptBuf,
1522 ) -> Result<Transaction, Error> {
1523 verify_if_not_mined(client, self.challenge_transaction.tx().compute_txid()).await?;
1524
1525 let kick_off_1_txid = self.kick_off_1_transaction.tx().compute_txid();
1526 let kick_off_1_status = client.get_tx_status(&kick_off_1_txid).await;
1527
1528 match kick_off_1_status {
1529 Ok(status) => match status.confirmed {
1530 true => {
1531 self.challenge_transaction.add_inputs_and_output(
1532 crowdfundng_inputs,
1533 keypair,
1534 output_script_pubkey,
1535 );
1536 Ok(self.challenge_transaction.finalize())
1537 }
1538 false => Err(Error::Graph(GraphError::PrecedingTxNotConfirmed(vec![
1539 NamedTx::for_tx(&self.kick_off_1_transaction, status.confirmed),
1540 ]))),
1541 },
1542 Err(e) => Err(Error::Esplora(e)),
1543 }
1544 }
1545
1546 pub async fn start_time(
1547 &mut self,

Callers 2

broadcast_challengeMethod · 0.80
test_peg_out_feesFunction · 0.80

Calls 4

verify_if_not_minedFunction · 0.85
add_inputs_and_outputMethod · 0.80
txMethod · 0.45
finalizeMethod · 0.45

Tested by 1

test_peg_out_feesFunction · 0.64