pub fn verify_watchtower_challenges(
circuit_input: &BridgeCircuitInput,
) -> WatchtowerChallengeSet
Expand description
Verifies watchtower challenge transactions and collects their outputs.
This function performs validation on a set of watchtower challenge transactions and their associated inputs, witnesses, and public keys. It checks that:
-
Each challenge input corresponds to the correct
kickoff_tx
output (P2TR), -
The signature is valid under the Taproot sighash rules,
-
The public key matches the one registered for the watchtower,
-
And, if all checks pass, it marks the corresponding bit in a 20-byte bitmap (
challenge_sending_watchtowers
) and collects the first 3 outputs of the watchtower transaction intowatchtower_challenges_outputs
.Note: This function only verifies keypath spends.
§Parameters
circuit_input
: Data structure holding serialized watchtower transactions, UTXOs, input indices, and pubkeys.kickoff_txid
: The transaction ID of thekickoff_tx
.
§Returns
A tuple containing:
- A 20-byte bitmap indicating which watchtower challenges were valid,
- A vector of the first 3 outputs from each valid watchtower transaction.
§Notes
Invalid or malformed challenge data (e.g., decoding errors, invalid signatures) will be skipped gracefully without causing the function to panic.