clementine_core::builder::transaction::challenge

Function create_watchtower_challenge_txhandler

Source
pub fn create_watchtower_challenge_txhandler(
    kickoff_txhandler: &TxHandler,
    watchtower_idx: usize,
    commit_data: &[u8],
    paramset: &'static ProtocolParamset,
) -> Result<TxHandler, BridgeError>
Expand description

Creates a TxHandler for the watchtower_challenge_tx.

This transaction is sent by a watchtower to submit a challenge proof (e.g., a Groth16 proof with public inputs). The proof data is encoded as a series of Taproot outputs and a final OP_RETURN output. Currently a watchtower challenge is in total 144 bytes, 32 + 32 + 80 bytes.

§Inputs

  1. KickoffTx: WatchtowerChallenge utxo (for the given watchtower)

§Outputs

  1. First output, first 32 bytes of challenge data encoded directly in scriptpubkey.
  2. Second output, next 32 bytes of challenge data encoded directly in scriptpubkey.
  3. OP_RETURN output, containing the last 80 bytes of challenge data.

§Arguments

  • kickoff_txhandler - The kickoff transaction handler the watchtower challenge belongs to.
  • watchtower_idx - The index of the watchtower in the deposit submitting the challenge.
  • commit_data - The challenge proof data to be included in the transaction.
  • paramset - Protocol parameter set.

§Returns

A TxHandler for the watchtower challenge transaction, or a BridgeError if construction fails.