From 624bf3000ed6b83e21eccfa3b5b45195b1923449 Mon Sep 17 00:00:00 2001 From: lisicky Date: Mon, 9 Sep 2024 16:09:56 +0900 Subject: [PATCH] FixedTxWitnessesSet fix --- rust/src/protocol_types/fixed_tx.rs | 10 +++++----- .../protocol_types/witnesses/fixed_tx_witnesses_set.rs | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/rust/src/protocol_types/fixed_tx.rs b/rust/src/protocol_types/fixed_tx.rs index 76ec61a6..cad72646 100644 --- a/rust/src/protocol_types/fixed_tx.rs +++ b/rust/src/protocol_types/fixed_tx.rs @@ -144,28 +144,28 @@ impl FixedTransaction { } pub fn add_vkey_witness(&mut self, vkey_witness: &Vkeywitness) { - self.witness_set.add_vkey_witness(vkey_witness.clone()); + self.witness_set.add_vkey_witness(vkey_witness); } pub fn add_bootstrap_witness(&mut self, bootstrap_witness: &BootstrapWitness) { - self.witness_set.add_bootstrap_witness(bootstrap_witness.clone()); + self.witness_set.add_bootstrap_witness(bootstrap_witness); } pub fn sign_and_add_vkey_signature(&mut self, private_key: &PrivateKey) -> Result<(), JsError> { let vkey_witness = make_vkey_witness(&self.tx_hash, private_key); - self.witness_set.add_vkey_witness(vkey_witness); + self.witness_set.add_vkey_witness(&vkey_witness); Ok(()) } pub fn sign_and_add_icarus_bootstrap_signature(&mut self, addr: &ByronAddress, private_key: &Bip32PrivateKey) -> Result<(), JsError> { let bootstrap_witness = make_icarus_bootstrap_witness(&self.tx_hash, addr, private_key); - self.witness_set.add_bootstrap_witness(bootstrap_witness); + self.witness_set.add_bootstrap_witness(&bootstrap_witness); Ok(()) } pub fn sign_and_add_daedalus_bootstrap_signature(&mut self, addr: &ByronAddress, private_key: &LegacyDaedalusPrivateKey) -> Result<(), JsError> { let bootstrap_witness = make_daedalus_bootstrap_witness(&self.tx_hash, addr, private_key); - self.witness_set.add_bootstrap_witness(bootstrap_witness); + self.witness_set.add_bootstrap_witness(&bootstrap_witness); Ok(()) } } diff --git a/rust/src/protocol_types/witnesses/fixed_tx_witnesses_set.rs b/rust/src/protocol_types/witnesses/fixed_tx_witnesses_set.rs index 8cea37bc..7e8f0b84 100644 --- a/rust/src/protocol_types/witnesses/fixed_tx_witnesses_set.rs +++ b/rust/src/protocol_types/witnesses/fixed_tx_witnesses_set.rs @@ -9,7 +9,7 @@ use crate::*; /// Or get TransactionWitnessSet to read fields. #[wasm_bindgen] #[derive(Clone, Debug, Eq, PartialEq)] -pub(crate) struct FixedTxWitnessesSet { +pub struct FixedTxWitnessesSet { pub(crate) raw_parts: TransactionWitnessSetRaw, pub(crate) tx_witnesses_set: TransactionWitnessSet, } @@ -20,22 +20,22 @@ impl FixedTxWitnessesSet { self.tx_witnesses_set.clone() } - pub fn add_vkey_witness(&mut self, vkey_witness: Vkeywitness) { + pub fn add_vkey_witness(&mut self, vkey_witness: &Vkeywitness) { if self.tx_witnesses_set.vkeys.is_none() { self.tx_witnesses_set.vkeys = Some(Vkeywitnesses::new()); } if let Some(vkeys) = &mut self.tx_witnesses_set.vkeys { - vkeys.add(&vkey_witness); + vkeys.add(vkey_witness); } self.raw_parts.vkeys = None; } - pub fn add_bootstrap_witness(&mut self, bootstrap_witness: BootstrapWitness) { + pub fn add_bootstrap_witness(&mut self, bootstrap_witness: &BootstrapWitness) { if self.tx_witnesses_set.bootstraps.is_none() { self.tx_witnesses_set.bootstraps = Some(BootstrapWitnesses::new()); } if let Some(bootstraps) = &mut self.tx_witnesses_set.bootstraps { - bootstraps.add(&bootstrap_witness); + bootstraps.add(bootstrap_witness); } self.raw_parts.bootstraps = None; }