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

Function test_validate_invalid_script_pubkey

bridge/tests/bridge/validate/validate.rs:143–168  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

141
142#[tokio::test]
143async fn test_validate_invalid_script_pubkey() {
144 let (mut peg_in_graph, _, _, _) = setup_and_create_graphs().await;
145
146 let deposit_tx = peg_in_graph.peg_in_deposit_transaction.tx_mut();
147 deposit_tx.output[0].script_pubkey = generate_burn_script();
148 let deposit_txid = deposit_tx.compute_txid();
149
150 let result = peg_in_graph.validate();
151
152 assert!(matches!(
153 result,
154 Err(Error::Validation(ValidationError::TxValidationFailed(
155 _,
156 _,
157 _
158 )))
159 ));
160
161 if let Err(Error::Validation(ValidationError::TxValidationFailed(tx_name, txid, input_index))) =
162 result
163 {
164 assert_eq!(tx_name, "PegInDeposit");
165 assert_eq!(txid, deposit_txid);
166 assert_eq!(input_index, 0);
167 }
168}
169
170async fn setup_and_create_graphs() -> (PegInGraph, PegOutGraph, OutPoint, AsyncClient) {
171 let config = setup_test().await;

Callers

nothing calls this directly

Calls 4

generate_burn_scriptFunction · 0.85
setup_and_create_graphsFunction · 0.70
tx_mutMethod · 0.45
validateMethod · 0.45

Tested by

no test coverage detected