Skip to content

Commit

Permalink
fix reference_inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
ljttl3q04t committed Mar 7, 2024
1 parent b61d364 commit 58fb586
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions rust/src/tx_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ pub struct TransactionBuilder {
required_signers: Ed25519KeyHashes,
collateral_return: Option<TransactionOutput>,
total_collateral: Option<Coin>,
reference_inputs: HashSet<TransactionInput>,
reference_inputs: TransactionInputs,
minswap_mode: bool,
plutus_scripts: Option<PlutusScripts>,
plutus_data: Option<PlutusList>,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit 58fb586

Please sign in to comment.