From 77af2695d7d1e99397da8f84a50d61449edc22c5 Mon Sep 17 00:00:00 2001 From: step Date: Tue, 19 Nov 2024 11:46:57 +0100 Subject: [PATCH] add blank_tapret_opret test --- tests/transfers.rs | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/tests/transfers.rs b/tests/transfers.rs index 1ccb8a1..4a8e5bd 100644 --- a/tests/transfers.rs +++ b/tests/transfers.rs @@ -875,3 +875,49 @@ fn collaborative_transfer() { None, ); } + +#[rstest] +#[case(CloseMethod::OpretFirst, CloseMethod::OpretFirst)] +#[case(CloseMethod::TapretFirst, CloseMethod::TapretFirst)] +#[case(CloseMethod::OpretFirst, CloseMethod::TapretFirst)] +#[case(CloseMethod::TapretFirst, CloseMethod::OpretFirst)] +fn blank_tapret_opret(#[case] close_method_0: CloseMethod, #[case] close_method_1: CloseMethod) { + println!("close_method_0 {close_method_0:?} close_method_1 {close_method_1:?}"); + + initialize(); + + let mut wlt_1 = get_wallet(&DescriptorType::Tr); + let mut wlt_2 = get_wallet(&DescriptorType::Tr); + + let utxo = wlt_1.get_utxo(None); + + let amt_0 = 200; + let (contract_id_0, iface_type_name_0) = wlt_1.issue_nia(amt_0, close_method_0, Some(&utxo)); + + // asset to be moved in blank + let amt_1 = 100; + let (contract_id_1, iface_type_name_1) = wlt_1.issue_nia(amt_1, close_method_1, Some(&utxo)); + + wlt_1.send( + &mut wlt_2, + TransferType::Blinded, + contract_id_0, + &iface_type_name_0, + amt_0, + 1000, + None, + ); + + // send opret, blank opret: pay fails with Composition(Stock("the spent UTXOs contain too many seals which can't fit the state transition input limit.")) + // send opret, blank tapret: pay fails with Composition(Stock("the spent UTXOs contain too many seals which can't fit the state transition input limit.")) + // send tapret, blank opret: pay fails with Composition(Construction(NoInputs)) + wlt_1.send( + &mut wlt_2, + TransferType::Blinded, + contract_id_1, + &iface_type_name_1, + amt_1, + 1000, + None, + ); +}