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

Method new

bridge/src/graphs/peg_out.rs:315–724  ·  view source on GitHub ↗
(
        context: &OperatorContext,
        peg_in_graph: &PegInGraph,
        peg_out_confirm_input: Input,
        commitment_secrets: &HashMap<CommitmentMessageId, WinternitzSecret>,
    )

Source from the content-addressed store, hash-verified

313
314impl PegOutGraph {
315 pub fn new(
316 context: &OperatorContext,
317 peg_in_graph: &PegInGraph,
318 peg_out_confirm_input: Input,
319 commitment_secrets: &HashMap<CommitmentMessageId, WinternitzSecret>,
320 ) -> Self {
321 let peg_in_confirm_transaction = peg_in_graph.peg_in_confirm_transaction_ref();
322 let peg_in_confirm_txid = peg_in_confirm_transaction.tx().compute_txid();
323
324 let connector_1_commitment_public_keys = HashMap::from([
325 (
326 CommitmentMessageId::Superblock,
327 WinternitzPublicKey::from(&commitment_secrets[&CommitmentMessageId::Superblock]),
328 ),
329 (
330 CommitmentMessageId::SuperblockHash,
331 WinternitzPublicKey::from(
332 &commitment_secrets[&CommitmentMessageId::SuperblockHash],
333 ),
334 ),
335 ]);
336 let connector_2_commitment_public_keys = HashMap::from([(
337 CommitmentMessageId::StartTime,
338 WinternitzPublicKey::from(&commitment_secrets[&CommitmentMessageId::StartTime]),
339 )]);
340 let connector_6_commitment_public_keys = HashMap::from([
341 (
342 CommitmentMessageId::PegOutTxIdSourceNetwork,
343 WinternitzPublicKey::from(
344 &commitment_secrets[&CommitmentMessageId::PegOutTxIdSourceNetwork],
345 ),
346 ),
347 (
348 CommitmentMessageId::PegOutTxIdDestinationNetwork,
349 WinternitzPublicKey::from(
350 &commitment_secrets[&CommitmentMessageId::PegOutTxIdDestinationNetwork],
351 ),
352 ),
353 ]);
354 let connector_b_commitment_public_keys = HashMap::from([
355 (
356 CommitmentMessageId::StartTime,
357 WinternitzPublicKey::from(&commitment_secrets[&CommitmentMessageId::StartTime]),
358 ),
359 (
360 CommitmentMessageId::SuperblockHash,
361 WinternitzPublicKey::from(
362 &commitment_secrets[&CommitmentMessageId::SuperblockHash],
363 ),
364 ),
365 ]);
366
367 let (connector_e1_commitment_public_keys, connector_e2_commitment_public_keys) =
368 groth16_commitment_secrets_to_public_keys(commitment_secrets);
369
370 let connectors = Self::create_new_connectors(
371 context.network,
372 &context.n_of_n_taproot_public_key,

Callers

nothing calls this directly

Calls 8

create_new_connectorsFunction · 0.85
connectors_numMethod · 0.80
cloneMethod · 0.80
generate_idFunction · 0.70
txMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected