From 58fb586f5aa594e2f0913a885a6d49d00d9a55a4 Mon Sep 17 00:00:00 2001 From: dzung pham Date: Thu, 7 Mar 2024 16:39:12 +0700 Subject: [PATCH] fix reference_inputs --- rust/src/tx_builder.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/rust/src/tx_builder.rs b/rust/src/tx_builder.rs index 1724343..609db9a 100644 --- a/rust/src/tx_builder.rs +++ b/rust/src/tx_builder.rs @@ -431,7 +431,7 @@ pub struct TransactionBuilder { required_signers: Ed25519KeyHashes, collateral_return: Option, total_collateral: Option, - reference_inputs: HashSet, + reference_inputs: TransactionInputs, minswap_mode: bool, plutus_scripts: Option, plutus_data: Option, @@ -849,7 +849,7 @@ impl TransactionBuilder { } pub fn add_reference_input(&mut self, reference_input: &TransactionInput) { - self.reference_inputs.insert(reference_input.clone()); + self.reference_inputs.add(reference_input); } /// We have to know what kind of inputs these are to know what kind of mock witnesses to create since @@ -1332,7 +1332,7 @@ impl TransactionBuilder { required_signers: Ed25519KeyHashes::new(), collateral_return: None, total_collateral: None, - reference_inputs: HashSet::new(), + reference_inputs: TransactionInputs::new(), minswap_mode: cfg.minswap_mode, plutus_scripts: None, plutus_data: None, @@ -1341,13 +1341,7 @@ impl TransactionBuilder { } pub fn get_reference_inputs(&self) -> TransactionInputs { - let mut inputs = self.reference_inputs.clone(); - for input in self.inputs.get_ref_inputs().0 { - inputs.insert(input); - } - - let vec_inputs = inputs.into_iter().collect(); - TransactionInputs(vec_inputs) + self.reference_inputs.clone() } /// does not include refunds or withdrawals