diff --git a/teos-common/src/test_utils.rs b/teos-common/src/test_utils.rs index dd0a3336..0b5a95b2 100644 --- a/teos-common/src/test_utils.rs +++ b/teos-common/src/test_utils.rs @@ -5,10 +5,9 @@ use rand::distributions::Standard; use rand::prelude::Distribution; use rand::Rng; -use bitcoin::consensus; use bitcoin::hashes::Hash; use bitcoin::secp256k1::SecretKey; -use bitcoin::Txid; +use bitcoin::{consensus, Script, Transaction, TxOut, Txid}; use crate::appointment::{Appointment, Locator}; use crate::cryptography; @@ -48,7 +47,15 @@ pub fn generate_random_appointment(dispute_txid: Option<&Txid>) -> Appointment { }; let tx_bytes = Vec::from_hex(TX_HEX).unwrap(); - let penalty_tx = consensus::deserialize(&tx_bytes).unwrap(); + let mut penalty_tx: Transaction = consensus::deserialize(&tx_bytes).unwrap(); + + // Append a random-sized OP_RETURN to make each transcation random in size. + penalty_tx.output.push(TxOut { + value: 0, + script_pubkey: Script::new_op_return(&cryptography::get_random_bytes( + get_random_int::() % 81, + )), + }); let mut raw_locator: [u8; 16] = cryptography::get_random_bytes(16).try_into().unwrap(); raw_locator.copy_from_slice(&dispute_txid[..16]);